org.eclipse.core.runtime.preferences.IPreferencesService Java Examples
The following examples show how to use
org.eclipse.core.runtime.preferences.IPreferencesService.
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: JavaModelManager.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public String getOption(String optionName) { if (JavaCore.CORE_ENCODING.equals(optionName)){ return JavaCore.getEncoding(); } // backward compatibility if (isDeprecatedOption(optionName)) { return JavaCore.ERROR; } int optionLevel = getOptionLevel(optionName); if (optionLevel != UNKNOWN_OPTION){ IPreferencesService service = Platform.getPreferencesService(); String value = service.get(optionName, null, this.preferencesLookup); if (value == null && optionLevel == DEPRECATED_OPTION) { // May be a deprecated option, retrieve the new value in compatible options String[] compatibleOptions = (String[]) this.deprecatedOptions.get(optionName); value = service.get(compatibleOptions[0], null, this.preferencesLookup); } return value==null ? null : value.trim(); } return null; }
Example #2
Source File: EclipseRefreshAndBuildHandler.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
protected boolean isAutoBuildEnabled() { IPreferencesService service = Platform.getPreferencesService(); String qualifier = ResourcesPlugin.getPlugin().getBundle().getSymbolicName(); String key = "description.autobuilding"; IScopeContext[] contexts = { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE }; return service.getBoolean(qualifier, key, false, contexts); }
Example #3
Source File: FileFormatUtils.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 检查是否启用 Open Office */ private static void checkAutomaticOO(List<ConverterBean> list) { IPreferencesService service = Platform.getPreferencesService(); String qualifier = Activator.getDefault().getBundle().getSymbolicName(); boolean automaticOO = service.getBoolean(qualifier, IPreferenceConstants.AUTOMATIC_OO, false, null); if (!automaticOO) { list.remove(new ConverterBean("MS Office Document to XLIFF Conveter", null)); } }
Example #4
Source File: FileFormatUtils.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
/** * 检查是否启用 Open Office */ private static void checkAutomaticOO(List<ConverterBean> list) { IPreferencesService service = Platform.getPreferencesService(); String qualifier = Activator.getDefault().getBundle().getSymbolicName(); boolean automaticOO = service.getBoolean(qualifier, IPreferenceConstants.AUTOMATIC_OO, false, null); if (!automaticOO) { list.remove(new ConverterBean("MS Office Document to XLIFF Conveter", null)); } }
Example #5
Source File: ApplicationWorkbenchAdvisor.java From gama with GNU General Public License v3.0 | 5 votes |
private void saveEclipsePreferences() { final IPreferencesService service = Platform.getPreferencesService(); try (final FileOutputStream outputStream = new FileOutputStream(Platform.getInstanceLocation().getURL().getPath() + "/.gama.epf")) { service.exportPreferences(service.getRootNode(), WorkspacePreferences.getPreferenceFilters(), outputStream); } catch (final CoreException | IOException e1) {} }
Example #6
Source File: TmfTimePreferences.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Get the locale * * @return the locale */ public static Locale getLocale() { String defaultLanguageTag = Locale.getDefault().toLanguageTag(); IPreferencesService preferencesService = Platform.getPreferencesService(); if (preferencesService == null) { return Locale.forLanguageTag(defaultLanguageTag); } return Locale.forLanguageTag(preferencesService.getString(Activator.PLUGIN_ID, ITmfTimePreferencesConstants.LOCALE, defaultLanguageTag, null)); }
Example #7
Source File: TmfTimePreferences.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Get the time zone * * @return the time zone */ public static TimeZone getTimeZone() { String defaultId = TimeZone.getDefault().getID(); IPreferencesService preferencesService = Platform.getPreferencesService(); if (preferencesService == null) { return TimeZone.getTimeZone(defaultId); } return TimeZone.getTimeZone(preferencesService.getString(Activator.PLUGIN_ID, ITmfTimePreferencesConstants.TIME_ZONE, defaultId, null)); }
Example #8
Source File: LineSeparators.java From eclipse-encoding-plugin with Eclipse Public License 1.0 | 5 votes |
public static String ofWorkspace() { IPreferencesService prefs = Platform.getPreferencesService(); IScopeContext[] scopeContext = new IScopeContext[] { InstanceScope.INSTANCE }; String lineSeparator = prefs.getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext); if (lineSeparator == null) { lineSeparator = System.getProperty("line.separator"); } return toLabel(lineSeparator); }
Example #9
Source File: ImportPlatformWizard.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
protected boolean isAutoBuildEnabled() { IPreferencesService service = Platform.getPreferencesService(); String qualifier = ResourcesPlugin.getPlugin().getBundle().getSymbolicName(); String key = "description.autobuilding"; IScopeContext[] contexts = { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE}; return service.getBoolean( qualifier, key, false, contexts ); }
Example #10
Source File: SynchronizePlatformWizard.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
protected boolean isAutoBuildEnabled() { IPreferencesService service = Platform.getPreferencesService(); String qualifier = ResourcesPlugin.getPlugin().getBundle().getSymbolicName(); String key = "description.autobuilding"; IScopeContext[] contexts = { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE}; return service.getBoolean( qualifier, key, false, contexts ); }
Example #11
Source File: BuildUtils.java From hybris-commerce-eclipse-plugin with Apache License 2.0 | 5 votes |
protected static boolean isAutoBuildEnabled() { IPreferencesService service = Platform.getPreferencesService(); String qualifier = ResourcesPlugin.getPlugin().getBundle().getSymbolicName(); String key = "description.autobuilding"; IScopeContext[] contexts = { InstanceScope.INSTANCE, ConfigurationScope.INSTANCE }; return service.getBoolean(qualifier, key, false, contexts); }
Example #12
Source File: Activator.java From orion.server with Eclipse Public License 1.0 | 5 votes |
private ServiceTracker<IPreferencesService, IPreferencesService> getPrefTracker() { if (prefTracker != null) return prefTracker; // lazy init if the bundle has been started if (bundleContext == null) return null; prefTracker = new ServiceTracker<IPreferencesService, IPreferencesService>(bundleContext, IPreferencesService.class, null); prefTracker.open(); return prefTracker; }
Example #13
Source File: Activator.java From orion.server with Eclipse Public License 1.0 | 5 votes |
/** * Returns the preference service, or <code>null</code> if not available. */ public static IPreferencesService getPreferenceService() { // protect against concurrent shutdown Activator a = singleton; if (a == null) return null; ServiceTracker<IPreferencesService, IPreferencesService> tracker = a.getPrefTracker(); if (tracker == null) return null; return tracker.getService(); }
Example #14
Source File: PreferenceHelper.java From orion.server with Eclipse Public License 1.0 | 5 votes |
/** * Returns the value of the integer preference corresponding to the given key, * or the provided default value if not defined. */ public static int getInt(String key, int defaultValue) { IPreferencesService service = Activator.getPreferenceService(); if (service == null) return defaultValue; return service.getInt(ServerConstants.PREFERENCE_SCOPE, key, defaultValue, null); }
Example #15
Source File: PreferenceHelper.java From orion.server with Eclipse Public License 1.0 | 5 votes |
/** * Returns the value of the string preference corresponding to the given key, * or the provided default value if not defined. */ public static String getString(String key, String defaultValue) { IPreferencesService service = Activator.getPreferenceService(); if (service == null) return null; return service.getString(ServerConstants.PREFERENCE_SCOPE, key, defaultValue, null); }
Example #16
Source File: FileFormatUtils.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 检查是否启用 Open Office */ private static void checkAutomaticOO(List<ConverterBean> list) { IPreferencesService service = Platform.getPreferencesService(); String qualifier = Activator.getDefault().getBundle().getSymbolicName(); boolean automaticOO = service.getBoolean(qualifier, IPreferenceConstants.AUTOMATIC_OO, false, null); if (!automaticOO) { list.remove(new ConverterBean("MS Office Document to XLIFF Conveter", null)); } }
Example #17
Source File: FileFormatUtils.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
/** * 检查是否启用 Open Office */ private static void checkAutomaticOO(List<ConverterBean> list) { IPreferencesService service = Platform.getPreferencesService(); String qualifier = Activator.getDefault().getBundle().getSymbolicName(); boolean automaticOO = service.getBoolean(qualifier, IPreferenceConstants.AUTOMATIC_OO, false, null); if (!automaticOO) { list.remove(new ConverterBean("MS Office Document to XLIFF Conveter", null)); } }
Example #18
Source File: LineSeparators.java From eclipse-encoding-plugin with Eclipse Public License 1.0 | 4 votes |
public static String ofProject(IResource resource) { IPreferencesService prefs = Platform.getPreferencesService(); IScopeContext[] scopeContext = new IScopeContext[] { new ProjectScope(resource.getProject()) }; String lineSeparator = prefs.getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext); return toLabel(lineSeparator); }
Example #19
Source File: AnsiConsoleUtils.java From tesb-studio-se with Apache License 2.0 | 4 votes |
public static Color getDebugConsoleBgColor() { IPreferencesService ps = Platform.getPreferencesService(); String value = ps.getString(DEBUG_CONSOLE_PLUGIN_ID, "org.eclipse.debug.ui.consoleBackground", DEBUG_CONSOLE_FALLBACK_BKCOLOR, null); return colorFromStringRgb(value); }
Example #20
Source File: AnsiConsoleUtils.java From tesb-studio-se with Apache License 2.0 | 4 votes |
public static Color getDebugConsoleFgColor() { IPreferencesService ps = Platform.getPreferencesService(); String value = ps.getString(DEBUG_CONSOLE_PLUGIN_ID, "org.eclipse.debug.ui.outColor", DEBUG_CONSOLE_FALLBACK_FGCOLOR, null); return colorFromStringRgb(value); }
Example #21
Source File: PreferencesLookupHelper.java From goclipse with Eclipse Public License 1.0 | 4 votes |
protected static IPreferencesService preferences() { return Platform.getPreferencesService(); }
Example #22
Source File: CheckstyleUIPluginPrefs.java From eclipse-cs with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns a string preference for the given preference id. * * @param prefId * the preference id * @return the string result */ public static String getString(String prefId) { IPreferencesService prefs = Platform.getPreferencesService(); return prefs.getString(CheckstyleUIPlugin.PLUGIN_ID, prefId, null, null); }
Example #23
Source File: CheckstylePluginPrefs.java From eclipse-cs with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns an integer preference for the given preference id. * * @param prefId * the preference id * @return the integer result */ public static int getInt(String prefId) { IPreferencesService prefs = Platform.getPreferencesService(); return prefs.getInt(CheckstylePlugin.PLUGIN_ID, prefId, 0, null); }
Example #24
Source File: CheckstylePluginPrefs.java From eclipse-cs with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns a boolean preference for the given preference id. * * @param prefId * the preference id * @return the boolean result */ public static boolean getBoolean(String prefId) { IPreferencesService prefs = Platform.getPreferencesService(); return prefs.getBoolean(CheckstylePlugin.PLUGIN_ID, prefId, false, null); }
Example #25
Source File: CheckstyleUIPluginPrefs.java From eclipse-cs with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns an integer preference for the given preference id. * * @param prefId * the preference id * @return the integer result */ public static int getInt(String prefId) { IPreferencesService prefs = Platform.getPreferencesService(); return prefs.getInt(CheckstyleUIPlugin.PLUGIN_ID, prefId, 0, null); }
Example #26
Source File: CheckstyleUIPluginPrefs.java From eclipse-cs with GNU Lesser General Public License v2.1 | 2 votes |
/** * Returns a boolean preference for the given preference id. * * @param prefId * the preference id * @return the boolean result */ public static boolean getBoolean(String prefId) { IPreferencesService prefs = Platform.getPreferencesService(); return prefs.getBoolean(CheckstyleUIPlugin.PLUGIN_ID, prefId, false, null); }