Example usage for org.eclipse.jface.preference IPreferenceStore setValue

List of usage examples for org.eclipse.jface.preference IPreferenceStore setValue

Introduction

In this page you can find the example usage for org.eclipse.jface.preference IPreferenceStore setValue.

Prototype

void setValue(String name, boolean value);

Source Link

Document

Sets the current value of the boolean-valued preference with the given name.

Usage

From source file:com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin.java

License:Open Source License

public static void setKeepProjectsInSync(boolean keepInSync) {
    IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore();
    store.setValue(PreferenceConstants.PREF_KEEP_PROJECTS_IN_SYNC, keepInSync);
}

From source file:com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin.java

License:Open Source License

public static void setAddFilesToProjectOption(int option) {
    IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore();
    store.setValue(PreferenceConstants.PREF_ADDED_FILES_OPTION, option);
}

From source file:com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin.java

License:Open Source License

public static void setChangedFilesInProjectOption(int option) {
    IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore();
    store.setValue(PreferenceConstants.PREF_CHANGED_FILES_OPTION, option);
}

From source file:com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin.java

License:Open Source License

public static void setIndexAllOption(boolean option) {
    IPreferenceStore store = ProjectUIPlugin.getDefault().getPreferenceStore();
    store.setValue(PreferenceConstants.PREF_INDEX_ALL, option);
}

From source file:com.nokia.carbide.cpp.internal.qt.core.QtSDKUtils.java

License:Open Source License

/**
 * Add a Qt-SDK to the Qt global preferences
 * @param name//from   ww  w.  j  av  a 2  s. com
 * @param binPath
 * @param incPath
 * @param makeDefault
 */
static private void addQtSDK(String name, IPath binPath, IPath incPath, boolean makeDefault) {

    IPreferenceStore store = QtProjectPlugin.getDefault().getPreferenceStore();
    int count = store.getInt(PreferenceConstants.QTVERSION_COUNT);

    // Store settings using zero-index base
    store.setValue(PreferenceConstants.QTVERSION_NAME + "." + Integer.toString(count), name);
    store.setValue(PreferenceConstants.QTVERSION_BINPATH + "." + Integer.toString(count), binPath.toOSString());
    store.setValue(PreferenceConstants.QTVERSION_INCLUDEPATH + "." + Integer.toString(count),
            incPath.toOSString());

    if (makeDefault || count == 0) {
        store.setValue(PreferenceConstants.QTVERSION_DEFAULT, count);
    }

    ResourcesPlugin.getPlugin().getLog()
            .log(Logging.newStatus(QtCorePlugin.getDefault(), IStatus.INFO,
                    "New Qt-Symbian SDK added to Qt global preferences: " + name, //$NON-NLS-1$
                    null));

    store.setValue(PreferenceConstants.QTVERSION_COUNT, count + 1); // # of table items, base is 1 (i.e. not zero)

    refreshQtStoredSDKs();
}

From source file:com.nokia.carbide.cpp.internal.qt.ui.QtUIPlugin.java

License:Open Source License

public static void switchToQtPerspective() {
    // set the perspective to Qt C++
    try {//from  www.  j  a  v a 2 s  .co  m
        IWorkbench workbench = getDefault().getWorkbench();
        IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow();
        if (activeWorkbenchWindow == null) {
            IWorkbenchWindow windows[] = workbench.getWorkbenchWindows();
            activeWorkbenchWindow = windows[0];
        }
        final IPerspectiveDescriptor perspective = workbench.getPerspectiveRegistry()
                .findPerspectiveWithId("com.trolltech.qtcppproject.QtCppPerspective"); //$NON-NLS-1$
        final IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        if (activePage != null) {
            if (activePage.getPerspective().getId().equals(perspective.getId()))
                return; // already on the default perspective for this projects
        }

        if (activePage != null) {

            UIJob job = new UIJob("") { //$NON-NLS-1$
                public IStatus runInUIThread(IProgressMonitor monitor) {
                    boolean switchToDefaultPerspective = false;
                    IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore();

                    if (store != null) {
                        String promptSetting = store
                                .getString(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE);
                        if ((promptSetting.equals(MessageDialogWithToggle.ALWAYS))) {
                            switchToDefaultPerspective = true;
                        } else if ((promptSetting.equals(MessageDialogWithToggle.PROMPT))) {
                            MessageDialogWithToggle toggleDialog = MessageDialogWithToggle.openYesNoQuestion(
                                    WorkbenchUtils.getActiveShell(), Messages.PerspectiveSwitchDialog_Title,
                                    Messages.PerspectiveSwitchDialog_Query,
                                    Messages.PerspectiveSwitchDialog_RememberDecisionText, false, null, null);

                            boolean toggleState = toggleDialog.getToggleState();
                            switchToDefaultPerspective = toggleDialog
                                    .getReturnCode() == IDialogConstants.YES_ID;

                            // set the store
                            if (toggleState) {
                                if (switchToDefaultPerspective)
                                    store.setValue(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE,
                                            MessageDialogWithToggle.ALWAYS);
                                else
                                    store.setValue(IDEInternalPreferences.PROJECT_SWITCH_PERSP_MODE,
                                            MessageDialogWithToggle.NEVER);
                            }
                        }
                    }

                    if (switchToDefaultPerspective) {
                        activePage.setPerspective(perspective);
                    }

                    return Status.OK_STATUS;
                }
            };
            job.setSystem(true);
            job.setRule(null); // no rule needed here - could just block important jobs
            job.schedule();
        }
    } catch (IllegalStateException e) {
        // PlatformUI.getWorkbench() throws if running headless
    }
}

From source file:com.nokia.carbide.cpp.internal.sdk.ui.SDKPreferencePage.java

License:Open Source License

public boolean performOk() {
    IPreferenceStore prefsStore = SDKUIPlugin.getDefault().getPreferenceStore();
    prefsStore.setValue(SDKUIPreferenceConstants.SCAN_FOR_NEW_PLUGINS, scanPluginsButton.getSelection());

    // Remember which SDK is enabled
    for (ISymbianSDK sdk : sdkMgr.getSDKList()) {
        ((SymbianSDK) sdk).setEnabled(false);
    }/*from w w  w.j  av  a  2  s.  c  o m*/
    Object[] sdkObjects = sdkListTableViewer.getCheckedElements();
    for (Object currObj : sdkObjects) {
        if (currObj instanceof ISymbianSDK) {
            ISymbianSDK sdk = (ISymbianSDK) currObj;
            ((SymbianSDK) sdk).setEnabled(true);
        }
    }

    // Update cached SDK info
    sdkMgr.updateCarbideSDKCache();
    return super.performOk();
}

From source file:com.nokia.carbide.cpp.project.core.tests.QtPropertiesTest.java

License:Open Source License

public void testCreateQtSDKEntries() throws Exception {

    IPreferenceStore store = QtProjectPlugin.getDefault().getPreferenceStore();

    int count = store.getInt(PreferenceConstants.QTVERSION_COUNT);

    createQtSDKEntry(store, "TestSDK1", true);
    createQtSDKEntry(store, "TestSDK2", true);
    createQtSDKEntry(store, "TestSDK3", false);
    createQtSDKEntry(store, "TestSDK4", false);

    store.setValue(PreferenceConstants.QT_AUTOSETMKSPEC, false);
    store.setValue(PreferenceConstants.QT_AUTOSETMKCMD, false);

    count = store.getInt(PreferenceConstants.QTVERSION_COUNT);
    assertEquals("Number of Qt SDKs count if off", count, QtSDKCount);

    int defaultSDK = store.getInt(PreferenceConstants.QTVERSION_DEFAULT); // zero-based index
    assertEquals(1, defaultSDK);//from  w  w w .java2s. c o m
}

From source file:com.nokia.carbide.cpp.project.core.tests.QtPropertiesTest.java

License:Open Source License

private void createQtSDKEntry(IPreferenceStore store, String name, boolean makeDefault) {
    QtSDKCount = store.getInt(PreferenceConstants.QTVERSION_COUNT);

    store.setValue(PreferenceConstants.QTVERSION_COUNT, QtSDKCount + 1); // # of table items, not zero based
    store.setValue(PreferenceConstants.QTVERSION_NAME + "." + Integer.toString(QtSDKCount), name);
    store.setValue(PreferenceConstants.QTVERSION_BINPATH + "." + Integer.toString(QtSDKCount),
            "T:\\epoc32\\tools\\qt");
    store.setValue(PreferenceConstants.QTVERSION_INCLUDEPATH + "." + Integer.toString(QtSDKCount),
            "T:\\epoc32\\include\\mw");

    if (makeDefault) {
        store.setValue(PreferenceConstants.QTVERSION_DEFAULT, QtSDKCount);
    }//  w ww. j a v a2  s .  c  om

    QtSDKCount = store.getInt(PreferenceConstants.QTVERSION_COUNT);

}

From source file:com.nokia.carbide.cpp.sdk.ui.SDKUIPlugin.java

License:Open Source License

public void devicesXMLOutOfSync() {

    if (WorkbenchUtils.isJUnitRunning()) {
        // Don't show this dialog if JUnit is running
        return;//from   www .  j ava2  s  .co m
    }

    IPreferenceStore store = getDefault().getPreferenceStore();
    if (!store.getBoolean(SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE)) {
        return;

    }
    Shell shell;
    IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
        shell = window.getShell();
    } else {
        return;
    }

    QueryWithTristatePrefDialog query = new QueryWithTristatePrefDialog(shell, "Devices.xml change detected.",
            "The current devices.xml content is not the same as the SDK list in Carbide.\n\nDo you want to scan for SDK changes now?",
            (AbstractUIPlugin) SDKUIPlugin.getDefault(), SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE,
            false, QueryWithTristatePrefDialog.QUERY_YES_NO);

    if (query.doQuery()) {
        ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
        sdkMgr.scanSDKs();

        // User selected yes, make sure pref doesn't change
        store.setValue(SDKUIPreferenceConstants.LISTEN_FOR_DEVICES_XML_CHANGE, true);
    }

}