Java Code Examples for org.eclipse.core.runtime.preferences.IPreferencesService#getString()

The following examples show how to use org.eclipse.core.runtime.preferences.IPreferencesService#getString() . 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: PreferenceHelper.java    From orion.server with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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 2
Source File: LineSeparators.java    From eclipse-encoding-plugin with Eclipse Public License 1.0 5 votes vote down vote up
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 3
Source File: LineSeparators.java    From eclipse-encoding-plugin with Eclipse Public License 1.0 4 votes vote down vote up
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 4
Source File: AnsiConsoleUtils.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
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 5
Source File: AnsiConsoleUtils.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
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 6
Source File: CheckstyleUIPluginPrefs.java    From eclipse-cs with GNU Lesser General Public License v2.1 2 votes vote down vote up
/**
 * 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);
}