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.aptana.editor.findbar.impl.FindBarEntriesHelper.java

License:Open Source License

/**
 * When a search is entered, this method should be called to add the searched text to the list of available searches
 * (and it'll be replicated for all the combos controlled).
 *///from   w  w w. ja  v  a 2s  .  c om
public void addEntry(String entry, String preferenceName) {
    if (entry.length() == 0) {
        return; // nothing to do in this case
    }

    synchronized (lock) {
        IPreferenceStore preferenceStore = FindBarPlugin.getDefault().getPreferenceStore();

        List<String> items = loadEntries(preferenceName);
        items.remove(entry); // Remove it if it already existed
        items.add(0, entry); // And always add it as the first
        while (items.size() > 20) { // Hold at most 20 entries in the cache
            items.remove(items.size() - 1); // remove the last
        }
        Properties props = createPropertiesFromList(items);
        preferenceStore.setValue(preferenceName, createStringFromProperties(props));
        if (preferenceName.equals(PREFERENCE_NAME_FIND)) {
            eclipseFindSettings.addEntry(entry);
        }
    }
}

From source file:com.aptana.editor.findbar.impl.FindBarEntriesHelper.java

License:Open Source License

public void updateFromEclipseFindSettings() {
    List<String> items = eclipseFindSettings.fFindHistory;
    IPreferenceStore preferenceStore = FindBarPlugin.getDefault().getPreferenceStore();
    Properties props = createPropertiesFromList(items);
    preferenceStore.setValue(PREFERENCE_NAME_FIND, createStringFromProperties(props));
}

From source file:com.aptana.editor.js.folding.JSEditorFoldingTest.java

License:Open Source License

private void setFoldingEnabled(boolean b) {
    IPreferenceStore preferenceStore = JSPlugin.getDefault().getPreferenceStore();
    preferenceStore.setValue(IPreferenceConstants.EDITOR_ENABLE_FOLDING, b);
}

From source file:com.aptana.ide.core.ui.InitialRestartStartup.java

License:Open Source License

public static void start() {
    try {/*from www .  j a v  a  2s.  c o m*/
        IPreferenceStore preferences = CoreUIPlugin.getDefault().getPreferenceStore();

        IdeLog.logInfo(CoreUIPlugin.getDefault(),
                StringUtils.format(Messages.InitialRestartStartup_INF_CleanPreference,
                        preferences.getBoolean(IPreferenceConstants.PREF_CLEAN_RESTART)));

        if (preferences.getBoolean(IPreferenceConstants.PREF_CLEAN_RESTART)) {
            preferences.setValue(IPreferenceConstants.PREF_CLEAN_RESTART, false);
            System.setProperty(PROP_EXIT_CODE, Integer.toString(24));

            String commandLine = buildCommandLine("-clean"); //$NON-NLS-1$
            if (commandLine != null) {
                IdeLog.logInfo(CoreUIPlugin.getDefault(),
                        Messages.InitialRestartStartup_INF_NewCommandLine + commandLine);
                System.setProperty(PROP_EXIT_DATA, commandLine);
                restartIDE();
            }
        }
    } catch (Exception e) {
        IdeLog.logError(CoreUIPlugin.getDefault(),
                Messages.InitialRestartStartup_ERR_UnableToCleanConfiguration, e);
    }

    IdeLog.flushCache();
}

From source file:com.aptana.ide.core.ui.InitialStartup.java

License:Open Source License

public static void start() {
    ImageDescriptor imageDescriptor = CoreUIPlugin.getImageDescriptor("icons/editorarea.gif"); //$NON-NLS-1$
    if (imageDescriptor != null) {
        editorAreaImage_studio = imageDescriptor.createImage();
        editorAreaImage = editorAreaImage_studio;
    }/* w w  w .  jav a 2 s  . c  o m*/

    ImageDescriptor imageDescriptor_radrails = CoreUIPlugin.getImageDescriptor("icons/editorarea_radrails.gif"); //$NON-NLS-1$
    if (imageDescriptor_radrails != null) {
        editorAreaImage_radrails = imageDescriptor_radrails.createImage();
    }

    IPreferenceStore prefs = CoreUIPlugin.getDefault().getPreferenceStore();
    boolean hasRunFirstStartup = prefs.getBoolean(IPreferenceConstants.PREF_KEY_FIRST_STARTUP);
    if (!hasRunFirstStartup) {
        initForFirstTimeStartup();
        prefs.setValue(IPreferenceConstants.PREF_KEY_FIRST_STARTUP, true);
    }

    final IWorkbench workbench = PlatformUI.getWorkbench();

    perpListener = new IPerspectiveListener() {
        public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
            recordPerspectiveActivation(perspective);
            checkPerspective(page, perspective);
            setEditorAreaPaintListener(page);
        }

        public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective,
                String changeId) {
        }
    };

    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
        public void run() {
            IWorkbenchWindow w = workbench.getActiveWorkbenchWindow();
            addListenerToWindow(w);
        }
    });

    addWindowListener(workbench);

    final IPartListener _partListener = createPartActivationListener();

    PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
        public void run() {
            IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();

            if (window != null) {
                window.getPartService().addPartListener(_partListener);

            }
        }
    });
}

From source file:com.aptana.ide.core.ui.InitialStartup.java

License:Open Source License

/**
 * Run whenever the web perspective is activated
 * /*from w w  w.j a  v  a2 s .c  o  m*/
 * @param page
 * @param listener
 */
private static void onWebPerspectiveActivated(IWorkbenchPage page) {
    IPreferenceStore prefs = CoreUIPlugin.getDefault().getPreferenceStore();
    int lastWorkspace = prefs.getInt(IPreferenceConstants.WEB_PERSPECTIVE_LAST_VERSION);

    if (WebPerspectiveFactory.VERSION > lastWorkspace) {
        prefs.setValue(IPreferenceConstants.WEB_PERSPECTIVE_LAST_VERSION, WebPerspectiveFactory.VERSION);

        prefs.setValue(IPreferenceConstants.WEB_PERSPECTIVE_RESET_PERSPECTIVE, false);
        WebPerspectiveFactory.resetPerspective(page);
    }
}

From source file:com.aptana.ide.core.ui.InitialStartup.java

License:Open Source License

/**
 * Runs the first time startup logic for this workspace.
 */// w  w  w . j  a  v  a 2 s.  c om
private static void initForFirstTimeStartup() {
    IPreferenceStore prefs = CoreUIPlugin.getDefault().getPreferenceStore();

    // Set here so that a new user does not immediately get a "perspective has changed" warning
    prefs.setValue(IPreferenceConstants.WEB_PERSPECTIVE_LAST_VERSION, WebPerspectiveFactory.VERSION);
}

From source file:com.aptana.ide.core.ui.preferences.FileExtensionPreferencePage.java

License:Open Source License

/**
 * Saves the items from the table editor into the preference store
 * /*from  ww w . ja  v  a 2  s .com*/
 * @return boolean
 */
public boolean performOk() {
    IPreferenceStore store = doGetPreferenceStore();

    List<Object> items = _tableEditor.getItems();
    String resources = StringUtils.join(";", items.toArray(new String[items.size()])); //$NON-NLS-1$

    store.setValue(doGetPreferenceID(), resources);

    return true;
}

From source file:com.aptana.ide.core.ui.PreferenceUtils.java

License:Open Source License

/**
 * stores widths of table columns to preference store and back
 * /*from  w w w  .ja v a 2  s . c o m*/
 * @param store
 * @param key
 * @param table
 */
public static void persistSettingsToPreferenceStore(IPreferenceStore store, String key, Table table) {
    TableColumn[] columns = table.getColumns();
    for (int a = 0; a < columns.length; a++) {
        int width = columns[a].getWidth();
        store.setValue(getColumnKey(key, a), width);
    }
}

From source file:com.aptana.ide.core.ui.PreferenceUtils.java

License:Open Source License

/**
 * registers tree for persisting widths of its column to preference store and back
 * //from w  ww. j  a  va 2  s  .  c om
 * @param store
 * @param key
 * @param tree
 */
public static void persistSettingsToPreferenceStore(IPreferenceStore store, String key, Tree tree) {
    TreeColumn[] columns = tree.getColumns();
    for (int a = 0; a < columns.length; a++) {
        int width = columns[a].getWidth();
        store.setValue(getColumnKey(key, a), width);
    }
}