List of usage examples for org.eclipse.jface.preference IPreferenceStore putValue
void putValue(String name, String value);
From source file:org.eclipse.tm.te.rcp.application.ApplicationActionBarAdvisor.java
License:Open Source License
/** * Creates the feature-dependent actions for the menu bar. */// ww w.j a v a2 s . com @SuppressWarnings("deprecation") private void makeFeatureDependentActions(IWorkbenchWindow window) { AboutInfo[] infos = null; IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); // Optimization: avoid obtaining the about infos if the platform state is // unchanged from last time. See bug 75130 for details. String stateKey = "platformState"; //$NON-NLS-1$ String prevState = prefs.getString(stateKey); String currentState = String.valueOf(Platform.getStateStamp()); boolean sameState = currentState.equals(prevState); if (!sameState) { prefs.putValue(stateKey, currentState); } // See if a welcome page is specified. // Optimization: if welcome pages were found on a previous run, then just add the action. String quickStartKey = IDEActionFactory.QUICK_START.getId(); String showQuickStart = prefs.getString(quickStartKey); if (sameState && "true".equals(showQuickStart)) { //$NON-NLS-1$ quickStartAction = IDEActionFactory.QUICK_START.create(window); register(quickStartAction); } else if (sameState && "false".equals(showQuickStart)) { //$NON-NLS-1$ // do nothing } else { // do the work infos = IDEWorkbenchPlugin.getDefault().getFeatureInfos(); boolean found = hasWelcomePage(infos); prefs.setValue(quickStartKey, String.valueOf(found)); if (found) { quickStartAction = IDEActionFactory.QUICK_START.create(window); register(quickStartAction); } } // See if a tips and tricks page is specified. // Optimization: if tips and tricks were found on a previous run, then just add the action. String tipsAndTricksKey = IDEActionFactory.TIPS_AND_TRICKS.getId(); String showTipsAndTricks = prefs.getString(tipsAndTricksKey); if (sameState && "true".equals(showTipsAndTricks)) { //$NON-NLS-1$ tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS.create(window); register(tipsAndTricksAction); } else if (sameState && "false".equals(showTipsAndTricks)) { //$NON-NLS-1$ // do nothing } else { // do the work if (infos == null) { infos = IDEWorkbenchPlugin.getDefault().getFeatureInfos(); } boolean found = hasTipsAndTricks(infos); prefs.setValue(tipsAndTricksKey, String.valueOf(found)); if (found) { tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS.create(window); register(tipsAndTricksAction); } } }
From source file:org.eclipse.ui.ide.dialogs.ImportTypeDialog.java
License:Open Source License
protected void buttonPressed(int buttonId) { if (buttonId == IDialogConstants.OK_ID) { writeContextPreference(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_TYPE, Integer.toString(currentSelection)); IPreferenceStore store = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); store.putValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_RELATIVE, Boolean.toString(variable != null)); }/*from w ww . j a v a2s .c o m*/ super.buttonPressed(buttonId); }
From source file:org.eclipse.ui.internal.dialogs.StartupPreferencePage.java
License:Open Source License
/** * @see PreferencePage/* ww w . j a va 2 s . c o m*/ */ public boolean performOk() { StringBuffer preference = new StringBuffer(); TableItem items[] = pluginsList.getItems(); for (int i = 0; i < items.length; i++) { if (!items[i].getChecked()) { preference.append((String) items[i].getData()); preference.append(IPreferenceConstants.SEPARATOR); } } String pref = preference.toString(); IPreferenceStore store = PrefUtil.getInternalPreferenceStore(); store.putValue(IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP, pref); PrefUtil.savePrefs(); return true; }
From source file:org.eclipse.ui.internal.editors.text.EditorsPluginPreferenceInitializer.java
License:Open Source License
/** * Migrates the overview ruler preference by re-enabling it. * * @param store the preference store to migrate * @since 3.1/*from ww w . ja v a 2 s.c o m*/ */ private void migrateOverviewRulerPreference(IPreferenceStore store) { String preference = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_OVERVIEW_RULER; String postfix = "_migration"; //$NON-NLS-1$ String MIGRATED = "migrated_3.1"; //$NON-NLS-1$ String migrationKey = preference + postfix; String migrationValue = store.getString(migrationKey); if (!MIGRATED.equals(migrationValue)) { store.putValue(migrationKey, MIGRATED); if (!store.getBoolean(preference)) store.putValue(preference, Boolean.TRUE.toString()); } }
From source file:org.eclipse.ui.internal.ide.WorkbenchActionBuilder.java
License:Open Source License
/** * Creates the feature-dependent actions for the menu bar. *//*from w w w .j a va2s. c om*/ private void makeFeatureDependentActions(IWorkbenchWindow window) { AboutInfo[] infos = null; IPreferenceStore prefs = IDEWorkbenchPlugin.getDefault().getPreferenceStore(); // Optimization: avoid obtaining the about infos if the platform state is // unchanged from last time. See bug 75130 for details. String stateKey = "platformState"; //$NON-NLS-1$ String prevState = prefs.getString(stateKey); String currentState = String.valueOf(Platform.getStateStamp()); boolean sameState = currentState.equals(prevState); if (!sameState) { prefs.putValue(stateKey, currentState); } // See if a welcome page is specified. // Optimization: if welcome pages were found on a previous run, then just add the action. String quickStartKey = IDEActionFactory.QUICK_START.getId(); String showQuickStart = prefs.getString(quickStartKey); if (sameState && "true".equals(showQuickStart)) { //$NON-NLS-1$ quickStartAction = IDEActionFactory.QUICK_START.create(window); register(quickStartAction); } else if (sameState && "false".equals(showQuickStart)) { //$NON-NLS-1$ // do nothing } else { // do the work infos = IDEWorkbenchPlugin.getDefault().getFeatureInfos(); boolean found = hasWelcomePage(infos); prefs.setValue(quickStartKey, String.valueOf(found)); if (found) { quickStartAction = IDEActionFactory.QUICK_START.create(window); register(quickStartAction); } } // See if a tips and tricks page is specified. // Optimization: if tips and tricks were found on a previous run, then just add the action. String tipsAndTricksKey = IDEActionFactory.TIPS_AND_TRICKS.getId(); String showTipsAndTricks = prefs.getString(tipsAndTricksKey); if (sameState && "true".equals(showTipsAndTricks)) { //$NON-NLS-1$ tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS.create(window); register(tipsAndTricksAction); } else if (sameState && "false".equals(showTipsAndTricks)) { //$NON-NLS-1$ // do nothing } else { // do the work if (infos == null) { infos = IDEWorkbenchPlugin.getDefault().getFeatureInfos(); } boolean found = hasTipsAndTricks(infos); prefs.setValue(tipsAndTricksKey, String.valueOf(found)); if (found) { tipsAndTricksAction = IDEActionFactory.TIPS_AND_TRICKS.create(window); register(tipsAndTricksAction); } } }
From source file:org.eclipse.ui.internal.registry.EditorRegistry.java
License:Open Source License
/** * Initialize the registry state from plugin declarations and preference * overrides./*from w w w. ja v a2 s . c o m*/ */ private void initializeFromStorage() { typeEditorMappings = new EditorMap(); extensionImages = new HashMap(); //Get editors from the registry EditorRegistryReader registryReader = new EditorRegistryReader(); registryReader.addEditors(this); sortInternalEditors(); rebuildInternalEditorMap(); IPreferenceStore store = PlatformUI.getPreferenceStore(); String defaultEditors = store.getString(IPreferenceConstants.DEFAULT_EDITORS); String chachedDefaultEditors = store.getString(IPreferenceConstants.DEFAULT_EDITORS_CACHE); //If defaults has changed load it afterwards so it overrides the users // associations. if (defaultEditors == null || defaultEditors.equals(chachedDefaultEditors)) { setProductDefaults(defaultEditors); loadAssociations(); //get saved earlier state } else { loadAssociations(); //get saved earlier state setProductDefaults(defaultEditors); store.putValue(IPreferenceConstants.DEFAULT_EDITORS_CACHE, defaultEditors); } addExternalEditorsToEditorMap(); }
From source file:org.eclipse.ui.tests.intro.IntroTest.java
License:Open Source License
protected void doSetUp() throws Exception { super.doSetUp(); // these tests rely on the 3.2 behavior for sticky views IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore(); preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, "true"); oldDesc = Workbench.getInstance().getIntroDescriptor(); IntroDescriptor testDesc = (IntroDescriptor) WorkbenchPlugin.getDefault().getIntroRegistry() .getIntro("org.eclipse.ui.testintro"); Workbench.getInstance().setIntroDescriptor(testDesc); window = openTestWindow();/* ww w . j a v a2 s.c o m*/ }
From source file:org.eclipse.ui.tests.intro.IntroTest2.java
License:Open Source License
protected void doSetUp() throws Exception { super.doSetUp(); // these tests rely on the 3.3 behavior for sticky views IPreferenceStore preferenceStore = PrefUtil.getAPIPreferenceStore(); preferenceStore.putValue(IWorkbenchPreferenceConstants.ENABLE_32_STICKY_CLOSE_BEHAVIOR, "false"); oldDesc = Workbench.getInstance().getIntroDescriptor(); IntroDescriptor testDesc = (IntroDescriptor) WorkbenchPlugin.getDefault().getIntroRegistry() .getIntro("org.eclipse.ui.testintro"); Workbench.getInstance().setIntroDescriptor(testDesc); window = openTestWindow();/*from ww w . ja v a 2s . c o m*/ }
From source file:org.eclipse.ui.texteditor.MarkerAnnotationPreferences.java
License:Open Source License
/** * Removes the marker annotation values which are shown on the * general Annotations page from the given store and prevents * setting the default values in the future. * <p>/*from w w w. j a va 2 s . c o m*/ * Note: In order to work this method must be called before any * call to {@link #initializeDefaultValues(IPreferenceStore)} * </p> * <p> * This method is not part of the API and must only be called * by {@link org.eclipse.ui.editors.text.EditorsUI} * </p> * * @param store the preference store to be initialized * @throws IllegalStateException if not called by {@link org.eclipse.ui.editors.text.EditorsUI} * @since 3.0 */ public static void useAnnotationsPreferencePage(IPreferenceStore store) throws IllegalStateException { checkAccess(); store.putValue(AbstractDecoratedTextEditorPreferenceConstants.USE_ANNOTATIONS_PREFERENCE_PAGE, Boolean.toString(true)); MarkerAnnotationPreferences preferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); Iterator e = preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info = (AnnotationPreference) e.next(); // Only reset annotations shown on Annotations preference page if (!info.isIncludeOnPreferencePage() || !isComplete(info)) continue; store.setToDefault(info.getTextPreferenceKey()); store.setToDefault(info.getOverviewRulerPreferenceKey()); if (info.getVerticalRulerPreferenceKey() != null) store.setToDefault(info.getVerticalRulerPreferenceKey()); store.setToDefault(info.getColorPreferenceKey()); if (info.getShowInNextPrevDropdownToolbarActionKey() != null) store.setToDefault(info.getShowInNextPrevDropdownToolbarActionKey()); if (info.getIsGoToNextNavigationTargetKey() != null) store.setToDefault(info.getIsGoToNextNavigationTargetKey()); if (info.getIsGoToPreviousNavigationTargetKey() != null) store.setToDefault(info.getIsGoToPreviousNavigationTargetKey()); if (info.getHighlightPreferenceKey() != null) store.setToDefault(info.getHighlightPreferenceKey()); if (info.getTextStylePreferenceKey() != null) store.setToDefault(info.getTextStylePreferenceKey()); } }
From source file:org.eclipse.ui.texteditor.MarkerAnnotationPreferences.java
License:Open Source License
/** * Removes the Quick Diff marker annotation values which are shown on the * general Quick Diff page from the given store and prevents * setting the default values in the future. * <p>//from w ww . j av a 2s. c o m * Note: In order to work this method must be called before any * call to {@link #initializeDefaultValues(IPreferenceStore)} * </p> * <p> * This method is not part of the API and must only be called * by {@link EditorsUI} * </p> * * @param store the preference store to be initialized * @throws IllegalStateException if not called by {@link EditorsUI} * @since 3.0 */ public static void useQuickDiffPreferencePage(IPreferenceStore store) throws IllegalStateException { checkAccess(); store.putValue(AbstractDecoratedTextEditorPreferenceConstants.USE_QUICK_DIFF_PREFERENCE_PAGE, Boolean.toString(true)); MarkerAnnotationPreferences preferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences(); Iterator e = preferences.getAnnotationPreferences().iterator(); while (e.hasNext()) { AnnotationPreference info = (AnnotationPreference) e.next(); // Only reset annotations shown on Quick Diff preference page if (!(info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffChange") //$NON-NLS-1$ || (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffAddition")) //$NON-NLS-1$ || (info.getAnnotationType().equals("org.eclipse.ui.workbench.texteditor.quickdiffDeletion")) //$NON-NLS-1$ )) continue; store.setToDefault(info.getTextPreferenceKey()); store.setToDefault(info.getOverviewRulerPreferenceKey()); if (info.getVerticalRulerPreferenceKey() != null) store.setToDefault(info.getVerticalRulerPreferenceKey()); store.setToDefault(info.getColorPreferenceKey()); if (info.getShowInNextPrevDropdownToolbarActionKey() != null) store.setToDefault(info.getShowInNextPrevDropdownToolbarActionKey()); if (info.getIsGoToNextNavigationTargetKey() != null) store.setToDefault(info.getIsGoToNextNavigationTargetKey()); if (info.getIsGoToPreviousNavigationTargetKey() != null) store.setToDefault(info.getIsGoToPreviousNavigationTargetKey()); if (info.getHighlightPreferenceKey() != null) store.setToDefault(info.getHighlightPreferenceKey()); if (info.getTextStylePreferenceKey() != null) store.setToDefault(info.getTextStylePreferenceKey()); } }