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.ibm.research.tours.fx.FontFx.java

License:Open Source License

/**
 * sets CVS font decorator preference - this interferes with package explorer and resource font effects, so usually turn this off
 * @param enabled// ww  w  .  j a  v a  2  s  .  c om
 * @return previous preference setting
 */
protected static void setCVSFontPreference(boolean enabled) {
    // @tag hack cvs tagsea font resource fx : this is a hack - disable CVS font decorator - because it overrides our decorator! this won't prevent any other coloring decorator from stopping us...
    IPreferenceStore cvsUiPrefStore = CVSUIPlugin.getPlugin().getPreferenceStore();
    cvsUiPrefStore.setValue(ICVSUIConstants.PREF_USE_FONT_DECORATORS, enabled);
}

From source file:com.ibm.xsp.extlib.designer.tooling.prefs.ExtLibPreferencesPage.java

License:Open Source License

private void savePref() {
    IPreferenceStore prefs = ExtLibToolingPlugin.getDefault().getPreferenceStore();
    if (prefs != null) {
        if (showXPageWarnings != null) {
            boolean hide = !showXPageWarnings.getSelection();
            prefs.setValue(ExtLibToolingPlugin.PREFKEY_HIDE_XPAGE_WARNING, hide);
        }//  w w w . j a va  2s  .  c om
        //            if (hideConfigChangeWarnings != null) {
        //                boolean hide = hideConfigChangeWarnings.getSelection();
        //                prefs.setValue(ExtLibToolingPlugin.PREFKEY_HIDE_CONFIG_CHANGE_WARNING, hide);
        //            }

    }
}

From source file:com.ibm.xsp.extlib.designer.tooling.prefs.ExtLibPreferencesPage.java

License:Open Source License

@Override
protected void performDefaults() {
    super.performDefaults();
    IPreferenceStore prefs = ExtLibToolingPlugin.getDefault().getPreferenceStore();
    if (prefs != null) {
        prefs.setValue(ExtLibToolingPlugin.PREFKEY_HIDE_XPAGE_WARNING, false);
        if (showXPageWarnings != null)
            showXPageWarnings.setSelection(true);
    }/*from w w w. ja v a 2s  . c o  m*/

}

From source file:com.iw.plugins.spindle.ui.properties.ProjectTemplatesPropertyPage.java

License:Mozilla Public License

protected void exportProjectPreference(IPreferenceStore src, IPreferenceStore target, String key,
        PreferenceTemplateSelector selector) {
    boolean srcIsDefault = src.isDefault(key);
    boolean targetIsDefault = target.isDefault(key);

    if (srcIsDefault && targetIsDefault)
        return;//from  w  ww  .j  a  v  a2 s.  co  m

    if (srcIsDefault && !targetIsDefault) {
        target.setToDefault(key);
        return;
    }

    String value = selector.getSelectedTemplate().getName();

    target.setValue(key, value);
}

From source file:com.javadude.antxr.eclipse.ui.actions.TogglePresentationAction.java

License:Open Source License

/** {@inheritDoc} */
public void run() {
    ITextEditor editor = getTextEditor();
    if (editor != null) {
        IRegion remembered = editor.getHighlightRange();
        editor.resetHighlightRange();/* w w w .ja  v  a2s.c om*/

        boolean showAll = !editor.showsHighlightRangeOnly();
        setChecked(showAll);
        setToolTipText(getToolTipText(showAll));

        editor.showHighlightRangeOnly(showAll);
        if (remembered != null) {
            editor.setHighlightRange(remembered.getOffset(), remembered.getLength(), true);
        }

        IPreferenceStore store = AntxrUIPlugin.getDefault().getPreferenceStore();
        store.setValue(IPreferencesConstants.EDITOR_SHOW_SEGMENTS, showAll);
    }
}

From source file:com.joeygibson.eclipse.junitlaunchfixer.Activator.java

License:Open Source License

public void start(BundleContext context) throws Exception {
    super.start(context);
    plugin = this;

    launchManager.addLaunchConfigurationListener(launchConfigurationListener);

    final IPreferenceStore store = Activator.getDefault().getPreferenceStore();

    if (store.getBoolean(PreferenceConstants.P_UPDATE_EXISTING_LAUNCHERS)) {
        Runnable r = new Runnable() {
            @Override//from   w w  w  . j  a  va2  s  .  c  om
            public void run() {
                Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();

                ILaunchConfiguration[] launchers = null;

                try {
                    launchers = launchManager.getLaunchConfigurations();

                    if (launchers == null || launchers.length == 0) {
                        return;
                    }
                } catch (CoreException e) {
                    e.printStackTrace();
                }

                List<ILaunchConfiguration> filteredLaunchers = LaunchProcessor
                        .filterNonJUnitLaunchers(launchers);

                if (filteredLaunchers.size() == 0) {
                    return;
                }

                LauncherSelectionDialog dlg = new LauncherSelectionDialog(shell, filteredLaunchers,
                        new ArrayContentProvider(), new LaunchLabelProvider(), "Select launchers to update");

                dlg.setHeapSize(store.getString(PreferenceConstants.P_MAX_HEAP));
                dlg.setMaxPermSize(store.getString(PreferenceConstants.P_MAX_PERM_SIZE));

                dlg.open();

                String heapSize = dlg.getHeapSize();
                String maxPermSize = dlg.getMaxPermSize();

                if (heapSize != null && heapSize.length() > 0 && maxPermSize != null
                        && maxPermSize.length() > 0) {
                    store.setValue(PreferenceConstants.P_MAX_HEAP, heapSize);
                    store.setValue(PreferenceConstants.P_MAX_PERM_SIZE, maxPermSize);

                    Object[] res = dlg.getResult();

                    if (res != null) {
                        for (Object o : res) {
                            ILaunchConfiguration config = (ILaunchConfiguration) o;

                            LaunchProcessor.processVmArgs(config);
                        }
                    }
                }
            }
        };

        PlatformUI.getWorkbench().getDisplay().syncExec(r);

        store.setValue(PreferenceConstants.P_UPDATE_EXISTING_LAUNCHERS, false);
    }
}

From source file:com.maccasoft.ui.internal.application.ApplicationWorkbenchWindowAdvisor.java

License:Open Source License

@Override
@SuppressWarnings("deprecation")
public boolean preWindowShellClose() {
    if (getWorkbench().getWorkbenchWindowCount() > 1) {
        return true;
    }/*from   ww w.j ava  2s .c  om*/

    IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
    boolean promptOnExit = preferenceStore.getBoolean(EXIT_PROMPT_ON_CLOSE_LAST_WINDOW);

    if (promptOnExit) {
        MessageDialogWithToggle dlg = MessageDialogWithToggle.openOkCancelConfirm(
                getWindowConfigurer().getWindow().getShell(), "Confirm Exit", "Exit Program ?",
                "Always exit without prompt", false, null, null);
        if (dlg.getReturnCode() != IDialogConstants.OK_ID) {
            return false;
        }

        if (dlg.getToggleState()) {
            preferenceStore.setValue(EXIT_PROMPT_ON_CLOSE_LAST_WINDOW, false);
            Activator.getDefault().savePluginPreferences();
        }
    }

    return true;
}

From source file:com.matlab.eclipse.meditor.actions.MatlabExportAsAction.java

License:Open Source License

public void run(IAction action) {
    try {/*from  ww w.jav  a 2  s  .c  om*/
        MatlabEditor editor = (MatlabEditor) getTextEditor();
        String matlabFileName = editor.getEditorInput().getName();

        // ask user for filename:
        FileDialog saveDialog = new FileDialog(editor.getSite().getShell(), SWT.SAVE);
        saveDialog.setFilterExtensions(new String[] { "*.xml", "*.html", "*.tex", "*.pdf", "*.*" });
        saveDialog.setFilterNames(
                new String[] { "XML files", "HTML files", "LaTeX source files", "PDF files", "all files" });
        saveDialog.setText("Export");
        // start from the directory last used
        IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore();
        String lastPath = preferenceStore.getString(PREF_LAST_PATH);
        String lastExtension = preferenceStore.getString(PREF_LAST_EXTENSION);
        if (!lastPath.equals("")) {
            saveDialog.setFilterPath(lastPath);
        }
        // suggest a filename similar to the matlab-file's name
        String extension = "xml";
        if (!lastExtension.equals("")) {
            extension = lastExtension;
        }
        String suggestedFileName = matlabFileName.replace(".m", "." + extension);
        saveDialog.setFileName(suggestedFileName);

        // show dialog to ask user for filename
        String targetFileName = saveDialog.open();
        if (targetFileName != null) {
            IPath targetFilePath = Path.fromOSString(targetFileName);
            String targetFileExtension = targetFilePath.getFileExtension();

            boolean xmlOutput = targetFileExtension.compareToIgnoreCase("xml") == 0;
            boolean htmlOutput = targetFileExtension.compareToIgnoreCase("html") == 0;
            boolean latexOutput = targetFileExtension.compareToIgnoreCase("tex") == 0;
            boolean pdfOutput = targetFileExtension.compareToIgnoreCase("pdf") == 0;
            boolean someOutput = xmlOutput || htmlOutput || latexOutput || pdfOutput;

            // export
            if (!targetFilePath.isEmpty() && someOutput) {
                // save used directory
                String outputDir = saveDialog.getFilterPath();
                preferenceStore.setValue(PREF_LAST_PATH, outputDir);
                preferenceStore.setValue(PREF_LAST_EXTENSION, targetFileExtension);
                MatlabSelection selection = new MatlabSelection(editor, false);
                IDocument document = selection.doc;
                IPath XMLFilePath = targetFilePath.removeFileExtension().addFileExtension("xml");

                Properties metadata = MatlabengineExportPrefsPage.getMetadataAsProperties();
                metadata.setProperty(XMLExporter.FILETITLE_KEY, matlabFileName);

                Properties exportProperties = MatlabengineExportPrefsPage.getExportProperties();

                exportProperties.setProperty(XMLExporter.OUTPUT_XML_KEY, Boolean.toString(xmlOutput));
                exportProperties.setProperty(XMLExporter.OUTPUT_HTML_KEY, Boolean.toString(htmlOutput));
                exportProperties.setProperty(XMLExporter.OUTPUT_LATEX_KEY, Boolean.toString(latexOutput));
                exportProperties.setProperty(XMLExporter.OUTPUT_PDF_KEY, Boolean.toString(pdfOutput));

                XMLExporterThread exporter = new XMLExporterThread(document, metadata, exportProperties,
                        XMLFilePath);

                exporter.doExportOperations();
            } else {
                Activator.errorDialog(XMLExporterThread.EXPORT_EXCEPTION_MSG,
                        new Exception("No target file or no supported filetype specified"));
            }
        }
    } catch (Exception e) {
        Activator.errorDialog(XMLExporterThread.EXPORT_EXCEPTION_MSG, e);
    }
}

From source file:com.mentor.nucleus.bp.als.oal.test.ArrayBaseTest.java

License:Open Source License

@Override
public void initialSetup() throws CoreException {
    TestingUtilities.importTestingProjectIntoWorkspace(projectName);
    project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
    m_sys = getSystemModel(projectName);
    BaseTest.dispatchEvents(0);//from   w ww  .  j  a  va2  s.c  om
    arrayModelRoot = Ooaofooa.getInstance("/APVT/models/APVT/Arrays/Arrays.xtuml");

    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ALLOW_IMPLICIT_COMPONENT_ADDRESSING, true);

    class ComponentNameTest implements ClassQueryInterface_c {
        public boolean evaluate(Object candidate) {
            Component_c selected = (Component_c) candidate;
            return selected.getName().equals("SingleDimensionFixedArrays");
        }
    }
    Component_c comp = Component_c.ComponentInstance(arrayModelRoot, new ComponentNameTest());

    populateFunctionInstances();
    populateBridgeInstances();
    class Object_test1_c implements ClassQueryInterface_c {
        Object_test1_c(String id) {
            m_id = id;
        }

        private String m_id;

        public boolean evaluate(Object inst) {
            ModelClass_c selected = (ModelClass_c) inst;
            return selected.getKey_lett().equals(m_id);
        }
    }
    ModelClass_c testObj = ModelClass_c.ModelClassInstance(arrayModelRoot, new Object_test1_c("A_T"));//$NON-NLS-1$

    populateTransformerInstances(testObj, false);

    populateInterfaceOperationInstances(comp, "Port1", true);
    populateInterfaceOperationInstances(comp, "Port2", false);
    populateArrayStateActionInstances();
}

From source file:com.mentor.nucleus.bp.als.oal.test.ArrayBaseTest_Generics.java

License:Open Source License

protected void setUp() throws Exception {
    super.setUp();
    String componentPackageName = "Arrays";
    PersistableModelComponent domainComponentPackage = ensureAvailableAndLoaded(projectName,
            componentPackageName, false, false, "Component Package");
    arrayModelRoot = (Ooaofooa) domainComponentPackage.getRootModelElement().getModelRoot();

    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ALLOW_IMPLICIT_COMPONENT_ADDRESSING, true);

    class ComponentNameTest implements ClassQueryInterface_c {
        public boolean evaluate(Object candidate) {
            Component_c selected = (Component_c) candidate;
            return selected.getName().equals("SingleDimensionFixedArrays");
        }//  w  ww.j  a  va 2s.c  o m
    }
    Component_c comp = Component_c.ComponentInstance(arrayModelRoot, new ComponentNameTest());

    populateFunctionInstances();
    populateBridgeInstances();
    class Object_test1_c implements ClassQueryInterface_c {
        Object_test1_c(String id) {
            m_id = id;
        }

        private String m_id;

        public boolean evaluate(Object inst) {
            ModelClass_c selected = (ModelClass_c) inst;
            return selected.getKey_lett().equals(m_id);
        }
    }
    ModelClass_c testObj = ModelClass_c.ModelClassInstance(arrayModelRoot, new Object_test1_c("A_T"));//$NON-NLS-1$

    populateTransformerInstances(testObj, false);

    populateInterfaceOperationInstances(comp, "Port1", true);
    populateInterfaceOperationInstances(comp, "Port2", false);
    populateArrayStateActionInstances();
}