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.tetrade.eclipse.plugins.easyshell.preferences.EasyShellPreferencePage.java

License:Open Source License

/**
 * Refreshes the category.//from   www . java2s .c  om
 */
private void refreshTarget() {
    int index = targetCombo.getSelectionIndex();
    String textOpen = defaultCmdsOpen[index];
    String textRun = defaultCmdsRun[index];
    String textExplore = defaultCmdsExplore[index];
    String textCopyPath = defaultCmdsCopyPath[index];
    if (debug)
        System.out.println("Set open text to " + textOpen);
    targetOpenEditor.setStringValue(textOpen);
    if (debug)
        System.out.println("Set run text to " + textRun);
    targetRunEditor.setStringValue(textRun);
    if (debug)
        System.out.println("Set run text to " + textExplore);
    targetExploreEditor.setStringValue(textExplore);
    if (debug)
        System.out.println("Set run text to " + textCopyPath);
    targetCopyPathEditor.setStringValue(textCopyPath);
    IPreferenceStore store = getPreferenceStore();
    store.setValue(P_TARGET, textOpen);
    store.setValue(P_TARGET_RUN, textRun);
    store.setValue(P_TARGET_EXPLORE, textExplore);
    store.setValue(P_TARGET_COPYPATH, textCopyPath);
}

From source file:com.tetrade.eclipse.plugins.easyshell.preferences.EasyShellPreferencePage.java

License:Open Source License

public boolean performOk() {
    IPreferenceStore store = getPreferenceStore();
    store.setValue(P_TARGET, targetOpenEditor.getStringValue());
    store.setValue(P_TARGET_RUN, targetRunEditor.getStringValue());
    store.setValue(P_TARGET_EXPLORE, targetExploreEditor.getStringValue());
    store.setValue(P_TARGET_COPYPATH, targetCopyPathEditor.getStringValue());
    store.setValue(P_LIST, targetCombo.getSelectionIndex());
    return true;// w  w w .  j ava2s.  c o m
}

From source file:com.threecrickets.creel.eclipse.PreferencesInitializer.java

License:LGPL

public void initializeDefaultPreferences() {
    IPreferenceStore preferences = Plugin.instance.getPreferenceStore();
    preferences.setValue(PreferencesPage.QUIET, false);
    preferences.setValue(PreferencesPage.VERBOSITY, 1);
}

From source file:com.trivadis.loganalysis.ui.internal.Perspective.java

License:Open Source License

private static void saveSetting(String key, Selection guard) {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    store.setValue(key, guard.toString());
}

From source file:com.twinsoft.convertigo.eclipse.ConvertigoPlugin.java

License:Open Source License

public static void setProperty(String key, String value) {
    IPreferenceStore preferenceStore = ConvertigoPlugin.getDefault().getPreferenceStore();
    preferenceStore.setValue(key, value);
}

From source file:com.vectrace.MercurialEclipse.HgFeatures.java

License:Open Source License

public void applyTo(IPreferenceStore store) {
    for (String key : optionalPreferenceKeys) {
        store.setDefault(key, enabled);/*from  w w  w . j  av a 2 s. c  o  m*/
        if (!enabled) {
            store.setValue(key, false);
        }
    }
}

From source file:com.vectrace.MercurialEclipse.history.MercurialHistoryPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    IActionBars actionBars = getHistoryPageSite().getWorkbenchPageSite().getActionBars();
    IMenuManager actionBarsMenu = actionBars.getMenuManager();

    final IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore();
    showTags = store.getBoolean(PREF_SHOW_ALL_TAGS);

    Action toggleShowTags = new Action(Messages.getString("HistoryView.showTags"), //$NON-NLS-1$
            MercurialEclipsePlugin.getImageDescriptor("actions/tag.gif")) { //$NON-NLS-1$
        @Override//from w  ww .  java 2 s  .  co  m
        public void run() {
            showTags = isChecked();
            store.setValue(PREF_SHOW_ALL_TAGS, showTags);
            if (mercurialHistory != null) {
                refresh();
            }
        }
    };
    toggleShowTags.setChecked(showTags);
    actionBarsMenu.add(toggleShowTags);

    showGraph = store.getBoolean(PREF_SHOW_GRAPH);

    Action toggleShowGraph = new Action(Messages.getString("HistoryView.showGraph"), //$NON-NLS-1$
            MercurialEclipsePlugin.getImageDescriptor("actions/branch.gif")) { //$NON-NLS-1$
        @Override
        public void run() {
            showGraph = isChecked();
            store.setValue(PREF_SHOW_GRAPH, showGraph);
            if (mercurialHistory != null) {
                refresh();
            }
        }
    };
    toggleShowGraph.setChecked(showGraph);
    actionBarsMenu.add(toggleShowGraph);

    showGoTo = store.getBoolean(PREF_SHOW_GOTO_TEXT);
    Action toggleGotoText = new Action("Show 'Go To' Panel", //$NON-NLS-1$
            MercurialEclipsePlugin.getImageDescriptor("actions/goto.gif")) { //$NON-NLS-1$
        @Override
        public void run() {
            showGoTo = isChecked();
            store.setValue(PREF_SHOW_GOTO_TEXT, showGoTo);
            if (mercurialHistory != null) {
                GridData gd = (GridData) gotoPanel.getLayoutData();
                gd.exclude = !showGoTo;
                gotoPanel.setVisible(showGoTo);
                rootControl.layout(false);
                changedPaths.refreshLayout();
            }
        }
    };
    toggleGotoText.setChecked(showGoTo);
    actionBarsMenu.add(toggleGotoText);

    actionShowParentHistory = new Action("Show Parent History", //$NON-NLS-1$
            PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_UP)) {
        @Override
        public void run() {
            if (mercurialHistory == null || hgRoot != null || resource == null) {
                setEnabled(false);
                return;
            }
            if (resource instanceof IProject) {
                HgRoot root = MercurialTeamProvider.getHgRoot(resource);
                if (root != null) {
                    getHistoryView().showHistoryFor(root, true);
                } else {
                    setEnabled(false);
                }
            } else {
                IContainer parentRes = resource.getParent();
                if (parentRes instanceof IFolder || parentRes instanceof IProject) {
                    getHistoryView().showHistoryFor(parentRes, true);
                } else {
                    setEnabled(false);
                }
            }
        }
    };

    IToolBarManager tbm = actionBars.getToolBarManager();
    tbm.add(new Separator());
    tbm.add(toggleShowTags);
    tbm.add(toggleShowGraph);
    tbm.add(actionShowParentHistory);
    tbm.add(new Separator());
    tbm.add(toggleGotoText);

    rootControl = createComposite(parent);
    createGotoText(rootControl);
    changedPaths = new ChangedPathsPage(this, rootControl);
    createTableHistory(changedPaths.getControl());
    changedPaths.createControl();
    setSelectionProvider(viewer);
    getSite().getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), new Action() {
        @Override
        public void run() {
            copyToClipboard();
        }
    });
}

From source file:com.vectrace.MercurialEclipse.preferences.PreferenceInitializer.java

License:Open Source License

private static void detectAndSetHgExecutable(IPreferenceStore store) {
    // Currently only tested on Windows. The binary is expected to be found
    // at "os\win32\x86\hg.exe" (relative to the plugin/fragment directory)
    File hgExecutable = getIntegratedHgExecutable();
    String defaultExecPath;/* w  w  w.  j a  v a 2  s  .c om*/
    String existingValue = store.getString(MERCURIAL_EXECUTABLE);

    // Use built in if possible
    if (store.getBoolean(USE_BUILT_IN_HG_EXECUTABLE) && hgExecutable != null) {
        defaultExecPath = hgExecutable.getPath();
        store.setValue(MERCURIAL_EXECUTABLE, defaultExecPath);
        store.setDefault(MERCURIAL_EXECUTABLE, defaultExecPath);
        return;
    }

    // Future: Should we ignore the integrated executable if the pref is disabled?
    if (hgExecutable == null) {
        hgExecutable = checkForPossibleHgExecutables();
    }
    if (hgExecutable == null) {
        defaultExecPath = "hg";
    } else {
        defaultExecPath = hgExecutable.getPath();
    }

    if (existingValue != null && !new File(existingValue).isFile()) {
        // If already set override if it's invalid
        store.setValue(MERCURIAL_EXECUTABLE, defaultExecPath);
    }
    store.setDefault(MERCURIAL_EXECUTABLE, defaultExecPath);
}

From source file:com.vectrace.MercurialEclipse.storage.HgCommitMessageManager.java

License:Open Source License

public static void setDefaultCommitName(HgRoot hgRoot, String name) {
    IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore();
    store.setValue(getKey(hgRoot), name);
}

From source file:com.vectrace.MercurialEclipse.storage.HgRepositoryLocationManager.java

License:Open Source License

/**
 * Set given location as default (topmost in hg repositories)
 * @param hgRoot a valid hg root (not null)
 * @param loc a valid repoository location (not null)
 */// w w w.  ja v a  2 s. c  o m
public void setDefaultRepository(HgRoot hgRoot, IHgRepositoryLocation loc) {
    Assert.isNotNull(hgRoot);
    Assert.isNotNull(loc);
    Set<IHgRepositoryLocation> locations = rootRepos.get(hgRoot);
    IPreferenceStore store = MercurialEclipsePlugin.getDefault().getPreferenceStore();
    store.setValue(KEY_DEF_REPO_PREFIX + getRootKey(hgRoot), loc.getLocation());
    if (locations != null && !locations.contains(loc)) {
        synchronized (entriesLock) {
            locations.add(loc);
        }
    } else {
        internalAddRepoLocation(hgRoot, loc);
    }
    //
    // Add the default path to the .hg/hgrc file
    //
    hgRoot.setAndStoreDefaultPath(loc.getLocation());
}