Java Code Examples for org.eclipse.core.runtime.preferences.IEclipsePreferences#getBoolean()
The following examples show how to use
org.eclipse.core.runtime.preferences.IEclipsePreferences#getBoolean() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FixedScopedPreferenceStore.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * Does its best at determining the default value for the given key. Checks * the given object's type and then looks in the list of defaults to see if * a value exists. If not or if there is a problem converting the value, the * default default value for that type is returned. * * @param key * the key to search * @param obj * the object who default we are looking for * @return Object or <code>null</code> */ Object getDefault(String key, Object obj) { IEclipsePreferences defaults = getDefaultPreferences(); if (obj instanceof String) { return defaults.get(key, STRING_DEFAULT_DEFAULT); } else if (obj instanceof Integer) { return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); } else if (obj instanceof Double) { return Double.valueOf(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); } else if (obj instanceof Float) { return Float.valueOf(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); } else if (obj instanceof Long) { return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); } else if (obj instanceof Boolean) { return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; } else { return null; } }
Example 2
Source File: ScopedPreferenceStore.java From e4Preferences with Eclipse Public License 1.0 | 6 votes |
/** * Does its best at determining the default value for the given key. Checks * the given object's type and then looks in the list of defaults to see if * a value exists. If not or if there is a problem converting the value, the * default default value for that type is returned. * * @param key * the key to search * @param obj * the object who default we are looking for * @return Object or <code>null</code> */ Object getDefault(String key, Object obj) { IEclipsePreferences defaults = getDefaultPreferences(); if (obj instanceof String) { return defaults.get(key, STRING_DEFAULT_DEFAULT); } else if (obj instanceof Integer) { return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); } else if (obj instanceof Double) { return Double.valueOf(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); } else if (obj instanceof Float) { return Float.valueOf(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); } else if (obj instanceof Long) { return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); } else if (obj instanceof Boolean) { return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; } else { return null; } }
Example 3
Source File: ValidPreferenceStore.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Does its best at determining the default value for the given key. Checks * the given object's type and then looks in the list of defaults to see if * a value exists. If not or if there is a problem converting the value, the * default default value for that type is returned. * * @param key * the key to search * @param object * the object who default we are looking for * @return Object or <code>null</code> */ Object getDefault(final String key, final Object object) { final IEclipsePreferences defaults = getDefaultPreferences(); if (object instanceof String) { return defaults.get(key, STRING_DEFAULT_DEFAULT); } else if (object instanceof Integer) { return Integer.valueOf(defaults.getInt(key, INT_DEFAULT_DEFAULT)); } else if (object instanceof Double) { return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); } else if (object instanceof Float) { return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); } else if (object instanceof Long) { return Long.valueOf(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); } else if (object instanceof Boolean) { return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; } else { return null; } }
Example 4
Source File: FindBarActions.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { FindBarDecorator dec = findBarDecorator.get(); if (dec != null) { IEclipsePreferences preferenceStore = EclipseUtil.instanceScope().getNode(FindBarPlugin.PLUGIN_ID); boolean openEclipseFindBar = preferenceStore.getBoolean( IPreferencesConstants.CTRL_F_TWICE_OPENS_ECLIPSE_FIND_BAR, false); if (openEclipseFindBar) { dec.showFindReplaceDialog(); } else { dec.textFind.setFocus(); dec.textFind.setSelection(new Point(0, dec.textFind.getText().length())); } } return null; }
Example 5
Source File: CommonEditorPreferencePage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
private void setTabSpaceCombo() { IEclipsePreferences store = getPluginPreferenceStore(); if (store.getBoolean(IPreferenceConstants.USE_GLOBAL_DEFAULTS, false)) { tabSpaceCombo.setText(Messages.CommonEditorPreferencePage_UseDefaultOption); } else { boolean useSpaces = store.getBoolean(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, true); tabSpaceCombo.setText(useSpaces ? Messages.CommonEditorPreferencePage_UseSpacesOption : Messages.CommonEditorPreferencePage_UseTabOption); } }
Example 6
Source File: SyncSystemModulesManagerScheduler.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * To be called when we start the plugin. * * Should be called only once (when we'll make a full check for the current integrity of the information) * Later on, we'll start to check if things change in the PYTHONPATH based on changes in the filesystem. */ public void start() { boolean scheduleInitially = false; boolean reCheckOnFilesystemChanges = InterpreterGeneralPreferences.getReCheckOnFilesystemChanges(); IInterpreterManager[] managers = InterpreterManagersAPI.getAllInterpreterManagers(); for (IInterpreterManager iInterpreterManager : managers) { if (iInterpreterManager != null) { IInterpreterInfo[] interpreterInfos = iInterpreterManager.getInterpreterInfos(); if (reCheckOnFilesystemChanges) { this.registerInterpreterManager(iInterpreterManager, interpreterInfos); } scheduleInitially = scheduleInitially || (interpreterInfos != null && interpreterInfos.length > 0); } } int timeout = 1000 * 30; //Default is waiting 30 seconds after startup IEclipsePreferences preferences = PydevPrefs.getEclipsePreferences(); boolean alreadyChecked = preferences.getBoolean("INTERPRETERS_CHECKED_ONCE", false); //Now we add builtin indexing on our checks (so, force it at least once). boolean force = false; if (!alreadyChecked) { preferences.putBoolean("INTERPRETERS_CHECKED_ONCE", true); //Now we add builtin indexing on our checks (so, force it at least once). force = true; timeout = 1000 * 7; //In this case, wait only 7 seconds after startup } if (force || InterpreterGeneralPreferences.getCheckConsistentOnStartup()) { if (scheduleInitially) { //Only do the initial schedule if there's something to be tracked (otherwise, wait for some interpreter //to be configured and work only on deltas already). //The initial job will do a full check on what's available and if it's synched with the filesystem. job.addAllToTrack(); job.scheduleLater(timeout); //Wait a minute before starting our sync process. } } }
Example 7
Source File: DeployPreferences.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
protected DeployPreferences(IEclipsePreferences preferenceStore) { this.preferenceStore = preferenceStore; accountEmail = preferenceStore.get(PREF_ACCOUNT_EMAIL, DEFAULT_ACCOUNT_EMAIL); projectId = preferenceStore.get(PREF_PROJECT_ID, DEFAULT_PROJECT_ID); version = preferenceStore.get(PREF_CUSTOM_VERSION, DEFAULT_CUSTOM_VERSION); autoPromote = preferenceStore.getBoolean(PREF_ENABLE_AUTO_PROMOTE, DEFAULT_ENABLE_AUTO_PROMOTE); includeOptionalConfigurationFiles = preferenceStore.getBoolean( PREF_INCLUDE_OPTIONAL_CONFIGURATION_FILES, DEFAULT_INCLUDE_OPTIONAL_CONFIGURATION_FILES); bucket = preferenceStore.get(PREF_CUSTOM_BUCKET, DEFAULT_CUSTOM_BUCKET); stopPreviousVersion = preferenceStore.getBoolean( PREF_STOP_PREVIOUS_VERSION, DEFAULT_STOP_PREVIOUS_VERSION); }
Example 8
Source File: ScopedPreferences.java From Pydev with Eclipse Public License 1.0 | 5 votes |
@Override public boolean getBoolean(IEclipsePreferences instancePreferences, IEclipsePreferences defaultPreferences, String keyInPreferenceStore, IAdaptable adaptable) { Object object = getFromProjectOrUserSettings(keyInPreferenceStore, adaptable); if (object != null) { return toBoolean(object); } // Ok, not in project or user settings: get it from the workspace settings. return instancePreferences.getBoolean(keyInPreferenceStore, defaultPreferences.getBoolean(keyInPreferenceStore, false)); }
Example 9
Source File: CleanUpConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private void doShowCleanUpWizard(boolean showWizard) { IEclipsePreferences preferences= fCurrContext.getNode(JavaUI.ID_PLUGIN); if (preferences.get(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, null) != null && preferences.getBoolean(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, true) == showWizard) return; preferences.putBoolean(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, showWizard); }
Example 10
Source File: CleanUpConfigurationBlock.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ @Override public Composite createContents(Composite parent) { Composite composite= super.createContents(parent); if (fCurrContext == null) return composite; fShowCleanUpWizardDialogField= new SelectionButtonDialogField(SWT.CHECK); fShowCleanUpWizardDialogField.setLabelText(CleanUpMessages.CleanUpConfigurationBlock_ShowCleanUpWizard_checkBoxLabel); fShowCleanUpWizardDialogField.doFillIntoGrid(composite, 5); IEclipsePreferences node= fCurrContext.getNode(JavaUI.ID_PLUGIN); boolean showWizard; if (node.get(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, null) != null) { showWizard= node.getBoolean(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, true); } else { showWizard= DefaultScope.INSTANCE.getNode(JavaUI.ID_PLUGIN).getBoolean(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, true); } if (showWizard) fShowCleanUpWizardDialogField.setSelection(true); fShowCleanUpWizardDialogField.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { doShowCleanUpWizard(fShowCleanUpWizardDialogField.isSelected()); } }); return composite; }
Example 11
Source File: AllCleanUpsAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
private boolean showWizard() { IEclipsePreferences instanceNode= InstanceScope.INSTANCE.getNode(JavaUI.ID_PLUGIN); if (instanceNode.get(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, null) != null) return instanceNode.getBoolean(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, true); IEclipsePreferences defaultNode= DefaultScope.INSTANCE.getNode(JavaUI.ID_PLUGIN); return defaultNode.getBoolean(CleanUpConstants.SHOW_CLEAN_UP_WIZARD, true); }
Example 12
Source File: AbstractSaveParticipantPreferenceConfiguration.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * {@inheritDoc} */ public boolean isEnabled(IScopeContext context) { IEclipsePreferences node; if (hasSettingsInScope(context)) { node= context.getNode(JavaUI.ID_PLUGIN); } else { node= InstanceScope.INSTANCE.getNode(JavaUI.ID_PLUGIN); } IEclipsePreferences defaultNode= DefaultScope.INSTANCE.getNode(JavaUI.ID_PLUGIN); String key= getPreferenceKey(); return node.getBoolean(key, defaultNode.getBoolean(key, false)); }
Example 13
Source File: CodeCheckerProject.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 5 votes |
/** * Initializes project related fields. * - Is the last used configuration was local or global. */ private void initProjectRelated() { IScopeContext context = new ProjectScope(project); IEclipsePreferences preferences = context.getNode(CodeCheckerNature.NATURE_ID); isGlobal = preferences.getBoolean(ConfigTypes.IS_GLOBAL.toString(), true); }
Example 14
Source File: Preferences.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public Preferences setImportGradleOfflineEnabled(boolean enabled) { this.importGradleOfflineEnabled = enabled; IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode("org.eclipse.buildship.core"); boolean offlineMode = prefs.getBoolean(GRADLE_OFFLINE_MODE, false); if (offlineMode != enabled) { prefs.putBoolean(GRADLE_OFFLINE_MODE, enabled); } return this; }
Example 15
Source File: Activator.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
/** * In oxygen there is an nature solution lookup feature that causes a dialog to open for each imported project. * We disable it since it's not a very useful feature. * * @return */ private boolean disableProjectNatureSolutionLookup() { IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(ORG_ECLIPSE_EPP_MPC_UI_PREFS); boolean val = prefs.getBoolean(ORG_ECLIPSE_EPP_MPC_NATURELOOKUP, true); prefs.putBoolean(ORG_ECLIPSE_EPP_MPC_NATURELOOKUP, false); try { prefs.flush(); } catch (BackingStoreException e) { throw new IllegalStateException(e); } return val; }
Example 16
Source File: InitHandlerTest.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private boolean isWorkspaceInitialized(IEclipsePreferences prefs) { return prefs.getBoolean(IConstants.WORKSPACE_INITIALIZED, false); }
Example 17
Source File: BaseInitHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private boolean isWorkspaceInitialized() { IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(IConstants.PLUGIN_ID); return prefs.getBoolean(IConstants.WORKSPACE_INITIALIZED, false); }
Example 18
Source File: MarkOccurrencesPreferencesPage.java From Pydev with Eclipse Public License 1.0 | 4 votes |
public static boolean useMarkOccurrences() { IEclipsePreferences preferences = PydevPrefs.getComRefactoringEclipsePreferences(); return preferences.getBoolean(USE_MARK_OCCURRENCES, DEFAULT_USE_MARK_OCCURRENCES); }
Example 19
Source File: MarkOccurrencesPreferencesPage.java From Pydev with Eclipse Public License 1.0 | 4 votes |
public static boolean useMarkOccurrencesInStrings() { IEclipsePreferences preferences = PydevPrefs.getComRefactoringEclipsePreferences(); return preferences.getBoolean(USE_MARK_OCCURRENCES_IN_STRINGS, DEFAULT_USE_MARK_OCCURRENCES_IN_STRINGS); }
Example 20
Source File: PyParserManager.java From Pydev with Eclipse Public License 1.0 | 4 votes |
/** * Constructor * * @param prefs the prefs to get to the parser */ private PyParserManager(IEclipsePreferences prefs) { super(); Assert.isNotNull(prefs); //in this constructor the prefs may never be null! //Override the default to deal with pydev preferences. this.prefs = prefs; this.millisBeforeAnalysis = prefs.getInt(PYDEV_ELAPSE_BEFORE_ANALYSIS, PyDevBuilderPreferences.DEFAULT_PYDEV_ELAPSE_BEFORE_ANALYSIS); this.useOnlyOnSave = prefs.getBoolean(USE_PYDEV_ANALYSIS_ONLY_ON_DOC_SAVE, PyDevBuilderPreferences.DEFAULT_USE_PYDEV_ONLY_ON_DOC_SAVE); //singleton: private constructor IEclipsePreferences.IPreferenceChangeListener prefListener = new IEclipsePreferences.IPreferenceChangeListener() { @Override public void preferenceChange(PreferenceChangeEvent event) { String property = event.getKey(); if (property.equals(USE_PYDEV_ANALYSIS_ONLY_ON_DOC_SAVE) || property.equals(PYDEV_ELAPSE_BEFORE_ANALYSIS)) { //reset the caches millisBeforeAnalysis = PyParserManager.this.prefs.getInt(PYDEV_ELAPSE_BEFORE_ANALYSIS, PyDevBuilderPreferences.DEFAULT_PYDEV_ELAPSE_BEFORE_ANALYSIS); useOnlyOnSave = PyParserManager.this.prefs.getBoolean(USE_PYDEV_ANALYSIS_ONLY_ON_DOC_SAVE, PyDevBuilderPreferences.DEFAULT_USE_PYDEV_ONLY_ON_DOC_SAVE); //and set the needed parsers boolean useAnalysisOnlyOnDocSave = useAnalysisOnlyOnDocSave(); synchronized (lock) { for (IParser parser : parsers.keySet()) { parser.resetTimeoutPreferences(useAnalysisOnlyOnDocSave); } } } } }; this.prefs.addPreferenceChangeListener(prefListener); }