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.essiembre.eclipse.rbe.ui.preferences.RBEFormattingPrefPage.java

License:Apache License

@Override
public boolean performOk() {
    IPreferenceStore prefs = getPreferenceStore();
    prefs.setValue(RBEPreferences.SHOW_GENERATOR, showGeneratedBy.getSelection());
    prefs.setValue(RBEPreferences.CONVERT_UNICODE_TO_ENCODED, convertUnicodeToEncoded.getSelection());
    prefs.setValue(RBEPreferences.CONVERT_UNICODE_TO_ENCODED_UPPER, convertUnicodeUpperCase.getSelection());
    prefs.setValue(RBEPreferences.ALIGN_EQUAL_SIGNS, alignEqualSigns.getSelection());
    prefs.setValue(RBEPreferences.SPACES_AROUND_EQUAL_SIGNS, ensureSpacesAroundEquals.getSelection());
    prefs.setValue(RBEPreferences.GROUP_KEYS, groupKeys.getSelection());
    prefs.setValue(RBEPreferences.GROUP_LEVEL_DEPTH, groupLevelDeep.getText());
    prefs.setValue(RBEPreferences.GROUP_LINE_BREAKS, groupLineBreaks.getText());
    prefs.setValue(RBEPreferences.GROUP_ALIGN_EQUAL_SIGNS, groupAlignEqualSigns.getSelection());
    prefs.setValue(RBEPreferences.WRAP_LINES, wrapLines.getSelection());
    prefs.setValue(RBEPreferences.WRAP_CHAR_LIMIT, wrapCharLimit.getText());
    prefs.setValue(RBEPreferences.WRAP_ALIGN_EQUAL_SIGNS, wrapAlignEqualSigns.getSelection());
    prefs.setValue(RBEPreferences.WRAP_INDENT_SPACES, wrapIndentSpaces.getText());
    prefs.setValue(RBEPreferences.NEW_LINE_NICE, wrapNewLine.getSelection());
    prefs.setValue(RBEPreferences.FORCE_NEW_LINE_TYPE, newLineTypeForce.getSelection());
    for (int i = 0; i < newLineTypes.length; i++) {
        if (newLineTypes[i].getSelection()) {
            prefs.setValue(RBEPreferences.NEW_LINE_TYPE, i);
        }//www.j av  a  2s .c o  m
    }
    prefs.setValue(RBEPreferences.KEEP_EMPTY_FIELDS, keepEmptyFields.getSelection());
    refreshEnabledStatuses();
    return super.performOk();
}

From source file:com.essiembre.eclipse.rbe.ui.preferences.RBEGeneralPrefPage.java

License:Apache License

@Override
public boolean performOk() {
    IPreferenceStore prefs = getPreferenceStore();
    prefs.setValue(RBEPreferences.KEY_GROUP_SEPARATOR, keyGroupSeparator.getText());
    prefs.setValue(RBEPreferences.CONVERT_ENCODED_TO_UNICODE, convertEncodedToUnicode.getSelection());
    prefs.setValue(RBEPreferences.SUPPORT_NL, supportNL.getSelection());
    prefs.setValue(RBEPreferences.SUPPORT_FRAGMENTS, supportFragments.getSelection());
    prefs.setValue(RBEPreferences.LOAD_ONLY_FRAGMENT_RESOURCES, loadOnlyFragmentResources.getSelection());
    prefs.setValue(RBEPreferences.KEY_TREE_HIERARCHICAL, keyTreeHierarchical.getSelection());
    prefs.setValue(RBEPreferences.KEY_TREE_EXPANDED, keyTreeExpanded.getSelection());
    prefs.setValue(RBEPreferences.FIELD_TAB_INSERTS, fieldTabInserts.getSelection());
    prefs.setValue(RBEPreferences.NO_TREE_IN_EDITOR, noTreeInEditor.getSelection());
    prefs.setValue(RBEPreferences.MIN_HEIGHT, minHeight.getText());

    return super.performOk();
}

From source file:com.essiembre.eclipse.rbe.ui.preferences.RBEReportingPrefPage.java

License:Apache License

@Override
public boolean performOk() {
    IPreferenceStore prefs = getPreferenceStore();
    prefs.setValue(RBEPreferences.REPORT_MISSING_VALUES, reportMissingVals.getSelection());
    prefs.setValue(RBEPreferences.REPORT_DUPL_VALUES, reportDuplVals.getSelection());
    prefs.setValue(RBEPreferences.REPORT_SIM_VALUES, reportSimVals.getSelection());
    prefs.setValue(RBEPreferences.REPORT_SIM_VALUES_WORD_COMPARE, reportSimValsMode[0].getSelection());
    prefs.setValue(RBEPreferences.REPORT_SIM_VALUES_LEVENSTHEIN, reportSimValsMode[1].getSelection());
    prefs.setValue(RBEPreferences.REPORT_SIM_VALUES_PRECISION,
            Double.parseDouble(reportSimPrecision.getText()));
    refreshEnabledStatuses();// w  ww. jav  a  2  s.com
    return super.performOk();
}

From source file:com.example.app.bootstrapper.Application.java

License:Open Source License

private boolean installNewFeature() throws ProvisionException {

    /*// ww  w . j  a  va2  s.  c  om
     * Check to make sure that we are not restarting after an update. If we
     * are, then there is no need to check for updates again.
     */
    final IPreferenceStore prefStore = Activator.getDefault().getPreferenceStore();
    if (prefStore.getBoolean(JUSTUPDATED)) {
        prefStore.setValue(JUSTUPDATED, false);
        return false;
    }

    final IProvisioningAgent agent = this.getProvisioningAgent();

    /*
     * Create a runnable to execute the update. We'll show a dialog during
     * the process and then return when the runnable is complete.
     */
    final boolean[] restartRequired = new boolean[] { false };
    IRunnableWithProgress runnable = new IRunnableWithProgress() {

        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
            IStatus installStatus = doInstallOperation(agent, monitor);
            if (installStatus.getSeverity() != IStatus.ERROR) {
                prefStore.setValue(JUSTUPDATED, true);
                restartRequired[0] = true;
            } else {
                log(installStatus);
            }
        }
    };

    /*
     * Execute the runnable and wait for it to complete.
     */
    try {
        new ProgressMonitorDialog(null).run(true, true, runnable);
        return restartRequired[0];
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
    }
    return false;
}

From source file:com.excelsior.xds.ui.editor.modula.spellcheck.internal.DisableSpellCheckingProposal.java

License:Open Source License

public final void apply(final IDocument document) {
    IPreferenceStore store = EditorsUI.getPreferenceStore();
    store.setValue(SpellingService.PREFERENCE_SPELLING_ENABLED, false);
}

From source file:com.generalrobotix.ui.GrxPluginManager.java

License:Open Source License

private void versionCheck() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    String version = store.getString(PreferenceConstants.VERSION);
    if (version.equals("") || !version.equals(PreferenceConstants.CURRENT_VERSION)) {
        //  ????????????
        if (version.equals("")) {
            store.setToDefault(PreferenceConstants.PROCESS + "." + PreferenceConstants.ID);
            store.setToDefault(PreferenceConstants.PROCESS + "." + PreferenceConstants.COM);
            store.setToDefault(PreferenceConstants.PROCESS + "." + PreferenceConstants.ARGS);
            store.setToDefault(PreferenceConstants.PROCESS + "." + PreferenceConstants.AUTOSTART);
            store.setToDefault(PreferenceConstants.PROCESS + "." + PreferenceConstants.USEORB);
        }// www  . java2 s.com
        store.setValue(PreferenceConstants.VERSION, PreferenceConstants.CURRENT_VERSION);
    }
}

From source file:com.generalrobotix.ui.item.GrxProjectItem.java

License:Open Source License

private void restoreProject_work(String mode, IProgressMonitor monitor) {
    //manager_.restoreProcess();

    monitor.worked(1);//w  w  w .  j  ava2 s  . com

    if (file_ == null || !file_.isFile()) {
        return;
    }
    ModeNodeInfo minfo = modeInfoMap_.get(mode);

    monitor.worked(1);

    List propList = minfo.propList;
    if (propList != null) {
        for (int i = 0; i < propList.size(); i++) {
            Element propEl = (Element) propList.get(i);
            String key = propEl.getAttribute("name"); //$NON-NLS-1$
            String val = propEl.getAttribute("value"); //$NON-NLS-1$
            setProperty(key, val);
        }
    }

    monitor.worked(1);

    if (minfo.itemList != null) {

        //  ???E?E?//
        //  Mode?Simulation?SimulationItem????E??E??E??WorldStateItem?SimulationItem?//
        if (mode.equals("Simulation") && !containSimulationItem(minfo.itemList)) {
            Element simElement = doc_.createElement(ITEM_TAG);
            simElement.setAttribute("class", PreferenceConstants.SIMULATIONITEM);
            simElement.setAttribute("name", "simulationItem");
            simElement.setAttribute("select", "true");
            minfo.root.appendChild(simElement);
            minfo.itemList = minfo.root.getElementsByTagName(ITEM_TAG);
            for (int i = 0; i < minfo.itemList.getLength(); i++) {
                Element itemElement = (Element) minfo.itemList.item(i);
                if (itemElement.getAttribute("class").equals(PreferenceConstants.WORLDSTATEITEM)) {
                    NodeList props = itemElement.getElementsByTagName(PROPERTY_TAG);
                    for (int j = 0; j < props.getLength();) {
                        Element propEl = (Element) props.item(j);
                        String key = propEl.getAttribute("name"); //$NON-NLS-1$
                        String val = propEl.getAttribute("value"); //$NON-NLS-1$
                        if (!key.equals("logTimeStep")) {
                            Element element = doc_.createElement(PROPERTY_TAG);
                            element.setAttribute("name", key);
                            element.setAttribute("value", val);
                            simElement.appendChild(element);
                            itemElement.removeChild(propEl);
                        } else
                            j++;
                    }
                }
            }
        }

        List<GrxBaseItem> il = new ArrayList<GrxBaseItem>();
        for (int i = 0; i < minfo.itemList.getLength(); i++) {
            GrxBaseItem p = (GrxBaseItem) _restorePlugin((Element) minfo.itemList.item(i));
            if (p != null)
                il.add(p);
        }

        // for a item that is exclusive selection reselect 
        for (int i = 0; i < il.size(); i++) {
            GrxBaseItem item = il.get(i);
            boolean select = GrxXmlUtil.getBoolean(item.getElement(), "select", false); //$NON-NLS-1$
            //manager_.setSelectedItem(item, select);
        }
    }

    monitor.worked(1);

    if (minfo.windowConfig != null) {
        Document doc = builder_.newDocument();
        Node nodeCopy = doc.importNode(minfo.windowConfig, true);
        doc.appendChild(nodeCopy);
        StringWriter sw = new StringWriter();
        try {
            DOMSource src = new DOMSource();
            src.setNode(doc);
            StreamResult target = new StreamResult(sw);
            transformer_.transform(src, target);
        } catch (TransformerConfigurationException e) {
            e.printStackTrace();
        } catch (TransformerException e) {
            e.printStackTrace();
        }

        IWorkbenchPage page = null;
        IWorkbench workbench = PlatformUI.getWorkbench();
        if (workbench != null) {
            IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
            if (window != null) {
                page = window.getActivePage();
                if (!page.getPerspective().getId().contains(GrxUIPerspectiveFactory.ID)) {
                    return;
                }
            }
        }
        if (page != null && page.getPerspective().getId().equals(GrxUIPerspectiveFactory.ID + ".project"))
            page.closePerspective(page.getPerspective(), false, false);
        IPreferenceStore store = workbench.getPreferenceStore();
        IPerspectiveRegistry perspectiveRegistry = workbench.getPerspectiveRegistry();
        IPerspectiveDescriptor orgPd = perspectiveRegistry.findPerspectiveWithId(GrxUIPerspectiveFactory.ID);
        IPerspectiveDescriptor tempPd = perspectiveRegistry
                .findPerspectiveWithId(GrxUIPerspectiveFactory.ID + ".project");
        if (tempPd != null)
            perspectiveRegistry.deletePerspective(tempPd);
        tempPd = perspectiveRegistry.clonePerspective(GrxUIPerspectiveFactory.ID + ".project", getName(),
                orgPd);
        store.setValue(GrxUIPerspectiveFactory.ID + ".project" + "_persp", sw.toString());
        if (page != null)
            page.setPerspective(tempPd);
    } else {
        IWorkbench workbench = PlatformUI.getWorkbench();
        if (workbench != null) {
            IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
            for (IWorkbenchWindow window : windows) {
                IWorkbenchPage page = window.getActivePage();
                if (page != null
                        && page.getPerspective().getId().equals(GrxUIPerspectiveFactory.ID + ".project"))
                    page.closePerspective(page.getPerspective(), false, false);
            }
        }
    }

    viewProperties_.clear();
    if (minfo.viewList != null) {
        for (int i = 0; i < minfo.viewList.getLength(); i++) {
            Element element = (Element) minfo.viewList.item(i);
            NodeList props = element.getElementsByTagName(PROPERTY_TAG);
            Properties properties = new Properties();
            for (int j = 0; j < props.getLength(); j++) {
                Element propEl = (Element) props.item(j);
                String key = propEl.getAttribute("name"); //$NON-NLS-1$
                String val = propEl.getAttribute("value"); //$NON-NLS-1$
                properties.setProperty(key, val);
            }
            viewProperties_.put(element.getAttribute("name"), properties);
        }
    }

    List<GrxBaseView> vl = manager_.getViewList();
    for (int i = 0; i < vl.size(); i++)
        if (vl.get(i) != null)
            vl.get(i).restoreProperties();

}

From source file:com.generalrobotix.ui.util.GrxServerManager.java

License:Open Source License

public static void setServerInfoToPreferenceStore() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    String id = PreferenceConstants.ALLSERVER;
    String com = "\"\"";
    String args = "\"\"";
    String autoStart = "false";
    String useORB = "false";
    for (int i = 0; i < vecServerInfo.size(); i++) {
        ProcessInfo processInfo = vecServerInfo.elementAt(i);
        id += PreferenceConstants.SEPARATOR + processInfo.id;
        com += PreferenceConstants.SEPARATOR + "\"" + processInfo.com.get(processInfo.editComIndex) + "\"";
        args += PreferenceConstants.SEPARATOR + "\"" + processInfo.args + "\"";
        autoStart += PreferenceConstants.SEPARATOR + (processInfo.autoStart ? "true" : "false");
        useORB += PreferenceConstants.SEPARATOR + (processInfo.useORB ? "true" : "false");
    }//from  w  w w. j a v a2 s.  c o  m
    store.setValue(PreferenceConstants.PROCESS + "." + PreferenceConstants.ID, id);
    store.setValue(PreferenceConstants.PROCESS + "." + PreferenceConstants.COM, com);
    store.setValue(PreferenceConstants.PROCESS + "." + PreferenceConstants.ARGS, args);
    store.setValue(PreferenceConstants.PROCESS + "." + PreferenceConstants.AUTOSTART, autoStart);
    store.setValue(PreferenceConstants.PROCESS + "." + PreferenceConstants.USEORB, useORB);
}

From source file:com.generalrobotix.ui.util.GrxServerManager.java

License:Open Source License

public static void setNameServerInfoToPreferenceStore() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setValue(
            PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.PORT,
            newPort_.get());/*  w ww .ja  v  a  2  s.  c o m*/
    store.setValue(
            PreferenceConstants.PROCESS + "." + PreferenceConstants.NAMESERVER + "." + PreferenceConstants.HOST,
            newHost_.get());
}

From source file:com.genericworkflownodes.knime.preferences.PreferencePage.java

License:Open Source License

@Override
public boolean performOk() {
    IPreferenceStore store = GenericNodesPlugin.getDefault().getPreferenceStore();
    boolean flag = debugModeFieldEditor.getBooleanValue();
    store.setValue(PreferenceInitializer.PREF_DEBUG_MODE, flag);
    GenericNodesPlugin.setDebug(flag);/* w w  w.j a  v  a2  s  .  c om*/
    return true;
}