Refine search
@Override public void putPreferences(IEclipsePreferences preferences, ColorThemeSetting setting) { preferences.put(pluginKey, setting.getColor().asRGB()); if (setting.isBoldEnabled() != null) preferences.putBoolean(pluginKey.replaceAll(".color", ".bold"), setting.isBoldEnabled()); if (setting.isItalicEnabled() != null) preferences.putBoolean(pluginKey.replaceAll(".color", ".italic"), setting.isItalicEnabled()); if (setting.isStrikethroughEnabled() != null) preferences.putBoolean(pluginKey.replaceAll(".color", ".strikethrough"), setting.isStrikethroughEnabled()); if (setting.isUnderlineEnabled() != null) preferences.putBoolean(pluginKey.replaceAll(".color", ".underline"), setting.isUnderlineEnabled()); } }
/** * Writes and applies the modified preferences. * @throws BackingStoreException */ public void flush() throws BackingStoreException { preferences.flush(); }
/** * 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. */ private 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 new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT)); else if (obj instanceof Double) return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT)); else if (obj instanceof Float) return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT)); else if (obj instanceof Long) return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT)); else if (obj instanceof byte[]) return defaults.getByteArray(key, BYTE_ARRAY_DEFAULT_DEFAULT); else if (obj instanceof Boolean) return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE : Boolean.FALSE; else return null; }
private EclipsePreferences getPluginPreferences(boolean create) { try { if (!create && !pluginRoot.nodeExists(pluginID)) return null; } catch (BackingStoreException e) { return null; } try { return (EclipsePreferences) pluginRoot.node(pluginID); } catch (ClassCastException e) { throw new RuntimeException("Plug-in preferences must be instances of EclipsePreferences: " + e.getMessage()); //$NON-NLS-1$ } }
@Override public void putPreferences(IEclipsePreferences preferences, ColorThemeSetting setting) { // Set the color itself super.putPreferences(preferences, setting); // Enables the color setting preferences.putBoolean(pluginKey + "Enabled", true); // Set style preferences.putInt(pluginKey + "Style", getStyleValue(setting)); }
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); }
protected String getSelectedProfileId(IScopeContext instanceScope) { String profileId= instanceScope.getNode(JavaUI.ID_PLUGIN).get(fProfileKey, null); if (profileId == null) { // request from bug 129427 profileId= DefaultScope.INSTANCE.getNode(JavaUI.ID_PLUGIN).get(fProfileKey, null); } return profileId; }
/** * Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope} * @param qualifier the preference qualifier * @param listener the listener to register */ public static void addPreferenceListener(String qualifier, IEclipsePreferences.IPreferenceChangeListener listener) { contexts[DEFAULT_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener); contexts[INSTANCE_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener); }
private static boolean isReuseOpenEditor() { boolean defaultReuse = DefaultScope.INSTANCE.getNode(TEAM_UI_PLUGIN) .getBoolean(REUSE_COMPARE_EDITOR_PREFID, false); return InstanceScope.INSTANCE.getNode(TEAM_UI_PLUGIN).getBoolean( REUSE_COMPARE_EDITOR_PREFID, defaultReuse); }
public static void resetScalePercentage() { IEclipsePreferences iprefs = InstanceScope.INSTANCE.getNode(IntroPlugin.PLUGIN_ID); IEclipsePreferences dprefs = DefaultScope.INSTANCE.getNode(IntroPlugin.PLUGIN_ID); String defaultScale = dprefs.get(SCALE_FACTOR, "0"); //$NON-NLS-1$ iprefs.put(SCALE_FACTOR, defaultScale); }
private void convertFromProperties(Properties props) { IEclipsePreferences preferences = getPluginPreferences(true); for (Iterator<Object> i = props.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); String value = props.getProperty(key); if (value != null) preferences.put(key, value); } }
public void setBrowserPreferences(boolean useDefault, String name, String args) { IEclipsePreferences prefs = getPrefs(); prefs.putBoolean(PREFS_DEFAULT_BROWSER, useDefault); prefs.put(PREFS_BROWSER_NAME, name); prefs.put(PREFS_BROWSER_ARGS, args); try { getPrefs().flush(); } catch (BackingStoreException exception) { logError(exception); } }
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); }
@Override public void putPreferences(IEclipsePreferences preferences, ColorThemeSetting setting) { preferences.put(pluginKey, setting.getColor().asRGB()); if (pluginKey.endsWith("TexColor")) { String styleKey = pluginKey.replaceAll("Color", "Style"); if (setting.isBoldEnabled() != null && setting.isBoldEnabled()) { preferences.putInt(styleKey, 1); } else if (setting.isItalicEnabled() != null && setting.isItalicEnabled()) { preferences.putInt(styleKey, 2); } else { preferences.remove(styleKey); } } } }
public void clearAllSettings(IScopeContext context) { for (int i= 0; i < fKeySets.length; i++) { updatePreferences(context.getNode(fKeySets[i].getNodeName()), fKeySets[i].getKeys(), Collections.<String, String>emptyMap()); } final IEclipsePreferences uiPrefs= context.getNode(JavaUI.ID_PLUGIN); uiPrefs.remove(fProfileKey); }
/** * Sets a integer in the {@link DefaultScope} * @param qualifier the preference qualifier * @param key the key * @param value the new value */ public static synchronized void setDefaultInt(String qualifier, String key, int value) { contexts[DEFAULT_CONTEXT].getNode(qualifier).putInt(key, value); }