Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2011-01-20 16:10:22 +0000
committerDani Megert2011-01-20 16:10:22 +0000
commitf334a610a3f823299ddb2cd3a8fd85f95a34ac41 (patch)
tree4ec85e01357eba63f6fc5e31becc6720dd52608c /org.eclipse.debug.core
parent8df9c3dc9026fe757138317c5b076e25dd683481 (diff)
downloadeclipse.platform.debug-f334a610a3f823299ddb2cd3a8fd85f95a34ac41.tar.gz
eclipse.platform.debug-f334a610a3f823299ddb2cd3a8fd85f95a34ac41.tar.xz
eclipse.platform.debug-f334a610a3f823299ddb2cd3a8fd85f95a34ac41.zip
Fixed deprecation warning.
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Preferences.java832
1 files changed, 417 insertions, 415 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Preferences.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Preferences.java
index 3268363bf..5fc5fd99b 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Preferences.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/Preferences.java
@@ -1,415 +1,417 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.internal.core;
-
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.core.runtime.preferences.InstanceScope;
-import org.eclipse.debug.core.DebugPlugin;
-import org.osgi.service.prefs.BackingStoreException;
-
-/**
- * Convenience class to facilitate using the new {@link IEclipsePreferences} story
- *
- * @since 3.6
- * @noinstantiate This class is not intended to be instantiated by clients.
- */
-public final class Preferences {
-
- static final IScopeContext[] contexts = new IScopeContext[] {new DefaultScope(), new InstanceScope()};
-
- static final int DEFAULT_CONTEXT = 0;
- static final int INSTANCE_CONTEXT = 1;
-
- /**
- * Constructor
- */
- private Preferences() {
- // no direct instantiation
- }
-
- /**
- * Sets a string preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
- * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
- * @param qualifier
- * @param key the key
- * @param value the value
- * @param context
- */
- public static synchronized void setString(String qualifier, String key, String value, IScopeContext context) {
- if(context != null) {
- try {
- IEclipsePreferences node = context.getNode(qualifier);
- node.put(key, value);
- node.flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
- else {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).put(key, value);
- }
- }
-
- /**
- * Sets a boolean preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
- * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
- * @param qualifier
- * @param key the key
- * @param value the value
- * @param context
- */
- public static synchronized void setBoolean(String qualifier, String key, boolean value, IScopeContext context) {
- if(context != null) {
- try {
- IEclipsePreferences node = context.getNode(qualifier);
- node.putBoolean(key, value);
- node.flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
- else {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).putBoolean(key, value);
- }
- }
-
- /**
- * Sets a integer preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
- * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
- * @param qualifier
- * @param key the key
- * @param value the value
- * @param context
- */
- public static synchronized void setInt(String qualifier, String key, int value, IScopeContext context) {
- if(context != null) {
- try {
- IEclipsePreferences node = context.getNode(qualifier);
- node.putInt(key, value);
- node.flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
- else {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).putInt(key, value);
- }
- }
-
- /**
- * Sets a long preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
- * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
- * @param qualifier
- * @param key the key
- * @param value the value
- * @param context
- */
- public static synchronized void setLong(String qualifier, String key, long value, IScopeContext context) {
- if(context != null) {
- try {
- IEclipsePreferences node = context.getNode(qualifier);
- node.putLong(key, value);
- node.flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
- else {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).putLong(key, value);
- }
- }
-
- /**
- * Sets a byte array preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
- * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
- * @param qualifier
- * @param key the key
- * @param value the value
- * @param context
- */
- public static synchronized void setByteArray(String qualifier, String key, byte[] value, IScopeContext context) {
- if(context != null) {
- try {
- IEclipsePreferences node = context.getNode(qualifier);
- node.putByteArray(key, value);
- node.flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
- else {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).putByteArray(key, value);
- }
- }
-
- /**
- * Sets a double preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
- * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
- * @param qualifier
- * @param key the key
- * @param value the value
- * @param context
- */
- public static synchronized void setDouble(String qualifier, String key, double value, IScopeContext context) {
- if(context != null) {
- try {
- IEclipsePreferences node = context.getNode(qualifier);
- node.putDouble(key, value);
- node.flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
- else {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).putDouble(key, value);
- }
- }
-
- /**
- * Sets a float preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
- * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
- * @param qualifier
- * @param key the key
- * @param value the value
- * @param context
- */
- public static synchronized void setFloat(String qualifier, String key, float value, IScopeContext context) {
- if(context != null) {
- try {
- IEclipsePreferences node = context.getNode(qualifier);
- node.putFloat(key, value);
- node.flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
- else {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).putFloat(key, value);
- }
- }
-
- /**
- * Sets a string in the {@link DefaultScope}
- * @param qualifier
- * @param key the key
- * @param value the new value
- */
- public static synchronized void setDefaultString(String qualifier, String key, String value) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).put(key, value);
- }
-
- /**
- * Sets a boolean in the {@link DefaultScope}
- * @param qualifier
- * @param key the key
- * @param value the new value
- */
- public static synchronized void setDefaultBoolean(String qualifier, String key, boolean value) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).putBoolean(key, value);
- }
-
- /**
- * Sets a byte array in the {@link DefaultScope}
- * @param qualifier
- * @param key the key
- * @param value the new value
- */
- public static synchronized void setDefaultByteArray(String qualifier, String key, byte[] value) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).putByteArray(key, value);
- }
-
- /**
- * Sets a double in the {@link DefaultScope}
- * @param qualifier
- * @param key the key
- * @param value the new value
- */
- public static synchronized void setDefaultDouble(String qualifier, String key, double value) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).putDouble(key, value);
- }
-
- /**
- * Sets a float in the {@link DefaultScope}
- * @param qualifier
- * @param key the key
- * @param value the new value
- */
- public static synchronized void setDefaultFloat(String qualifier, String key, float value) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).putFloat(key, value);
- }
-
- /**
- * Sets a integer in the {@link DefaultScope}
- * @param 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);
- }
-
- /**
- * Sets a long in the {@link DefaultScope}
- * @param qualifier
- * @param key the key
- * @param value the new value
- */
- public static synchronized void setDefaultLong(String qualifier, String key, long value) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).putLong(key, value);
- }
-
- /**
- * Sets the given preference to its default value. This is done by removing any set value
- * from the {@link InstanceScope}. Has no effect if the given key is <code>null</code>.
- * @param qualifier
- * @param key the key for the preference
- */
- public static synchronized void setToDefault(String qualifier, String key) {
- if(key != null) {
- contexts[INSTANCE_CONTEXT].getNode(qualifier).remove(key);
- }
- }
-
- /**
- * Returns the default boolean value stored in the {@link DefaultScope} for the given key
- * or the specified default value if the key does not appear in the {@link DefaultScope}
- * @param qualifier
- * @param key
- * @param defaultvalue
- *
- * @return the boolean value set in the {@link DefaultScope} for the given key, or the specified default value.
- */
- public static synchronized boolean getDefaultBoolean(String qualifier, String key, boolean defaultvalue) {
- return contexts[DEFAULT_CONTEXT].getNode(qualifier).getBoolean(key, defaultvalue);
- }
-
- /**
- * Returns the default string value stored in the {@link DefaultScope} for the given key
- * or the specified default value if the key does not appear in the {@link DefaultScope}
- * @param qualifier
- * @param key
- * @param defaultvalue
- *
- * @return the string value set in the {@link DefaultScope} for the given key, or the specified default value.
- */
- public static synchronized String getDefaultString(String qualifier, String key, String defaultvalue) {
- return contexts[DEFAULT_CONTEXT].getNode(qualifier).get(key, defaultvalue);
- }
-
- /**
- * Returns the default byte array value stored in the {@link DefaultScope} for the given key
- * or the specified default value if the key does not appear in the {@link DefaultScope}
- * @param qualifier
- * @param key
- * @param defaultvalue
- *
- * @return the byte array value set in the {@link DefaultScope} for the given key, or the specified default value.
- */
- public static synchronized byte[] getDefaultByteArray(String qualifier, String key, byte[] defaultvalue) {
- return contexts[DEFAULT_CONTEXT].getNode(qualifier).getByteArray(key, defaultvalue);
- }
-
- /**
- * Returns the default integer value stored in the {@link DefaultScope} for the given key
- * or the specified default value if the key does not appear in the {@link DefaultScope}
- * @param qualifier
- * @param key
- * @param defaultvalue
- *
- * @return the integer value set in the {@link DefaultScope} for the given key, or the specified default value.
- */
- public static synchronized int getDefaultInt(String qualifier, String key, int defaultvalue) {
- return contexts[DEFAULT_CONTEXT].getNode(qualifier).getInt(key, defaultvalue);
- }
-
- /**
- * Returns the default long value stored in the {@link DefaultScope} for the given key
- * or the specified default value if the key does not appear in the {@link DefaultScope}
- * @param qualifier
- * @param key
- * @param defaultvalue
- *
- * @return the long value set in the {@link DefaultScope} for the given key, or the specified default value.
- */
- public static synchronized long getDefaultLong(String qualifier, String key, long defaultvalue) {
- return contexts[DEFAULT_CONTEXT].getNode(qualifier).getLong(key, defaultvalue);
- }
-
- /**
- * Returns the default double value stored in the {@link DefaultScope} for the given key
- * or the specified default value if the key does not appear in the {@link DefaultScope}
- * @param qualifier
- * @param key
- * @param defaultvalue
- *
- * @return the double value set in the {@link DefaultScope} for the given key, or the specified default value.
- */
- public static synchronized double getDefaultDouble(String qualifier, String key, double defaultvalue) {
- return contexts[DEFAULT_CONTEXT].getNode(qualifier).getDouble(key, defaultvalue);
- }
-
- /**
- * Returns the default float value stored in the {@link DefaultScope} for the given key
- * or the specified default value if the key does not appear in the {@link DefaultScope}
- * @param qualifier
- * @param key
- * @param defaultvalue
- *
- * @return the float value set in the {@link DefaultScope} for the given key, or the specified default value.
- */
- public static synchronized float getDefaultFloat(String qualifier, String key, float defaultvalue) {
- return contexts[DEFAULT_CONTEXT].getNode(qualifier).getFloat(key, defaultvalue);
- }
-
- /**
- * Save the preferences for the given plugin identifier.
- * It should be noted that all pending preference changes will be flushed with this method.
- * @param qualifier
- */
- public static synchronized void savePreferences(String qualifier) {
- try {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).flush();
- contexts[INSTANCE_CONTEXT].getNode(qualifier).flush();
- }
- catch(BackingStoreException bse) {
- DebugPlugin.log(bse);
- }
- }
-
- /**
- * Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope}
- * @param qualifier
- * @param listener
- */
- public static void addPreferenceListener(String qualifier, IEclipsePreferences.IPreferenceChangeListener listener) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener);
- contexts[INSTANCE_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener);
- }
-
- /**
- * Removes the given preference listener from the {@link DefaultScope} and the {@link InstanceScope}
- * @param qualifier
- * @param listener
- */
- public static void removePreferenceListener(String qualifier, IEclipsePreferences.IPreferenceChangeListener listener) {
- contexts[DEFAULT_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener);
- contexts[INSTANCE_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.core;
+
+import org.osgi.service.prefs.BackingStoreException;
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+import org.eclipse.debug.core.DebugPlugin;
+
+/**
+ * Convenience class to facilitate using the new {@link IEclipsePreferences} story
+ *
+ * @since 3.6
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public final class Preferences {
+
+ static final IScopeContext[] contexts= new IScopeContext[] { DefaultScope.INSTANCE, InstanceScope.INSTANCE };
+
+ static final int DEFAULT_CONTEXT = 0;
+ static final int INSTANCE_CONTEXT = 1;
+
+ /**
+ * Constructor
+ */
+ private Preferences() {
+ // no direct instantiation
+ }
+
+ /**
+ * Sets a string preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
+ * @param qualifier
+ * @param key the key
+ * @param value the value
+ * @param context
+ */
+ public static synchronized void setString(String qualifier, String key, String value, IScopeContext context) {
+ if(context != null) {
+ try {
+ IEclipsePreferences node = context.getNode(qualifier);
+ node.put(key, value);
+ node.flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+ else {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).put(key, value);
+ }
+ }
+
+ /**
+ * Sets a boolean preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
+ * @param qualifier
+ * @param key the key
+ * @param value the value
+ * @param context
+ */
+ public static synchronized void setBoolean(String qualifier, String key, boolean value, IScopeContext context) {
+ if(context != null) {
+ try {
+ IEclipsePreferences node = context.getNode(qualifier);
+ node.putBoolean(key, value);
+ node.flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+ else {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putBoolean(key, value);
+ }
+ }
+
+ /**
+ * Sets a integer preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
+ * @param qualifier
+ * @param key the key
+ * @param value the value
+ * @param context
+ */
+ public static synchronized void setInt(String qualifier, String key, int value, IScopeContext context) {
+ if(context != null) {
+ try {
+ IEclipsePreferences node = context.getNode(qualifier);
+ node.putInt(key, value);
+ node.flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+ else {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putInt(key, value);
+ }
+ }
+
+ /**
+ * Sets a long preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
+ * @param qualifier
+ * @param key the key
+ * @param value the value
+ * @param context
+ */
+ public static synchronized void setLong(String qualifier, String key, long value, IScopeContext context) {
+ if(context != null) {
+ try {
+ IEclipsePreferences node = context.getNode(qualifier);
+ node.putLong(key, value);
+ node.flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+ else {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putLong(key, value);
+ }
+ }
+
+ /**
+ * Sets a byte array preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
+ * @param qualifier
+ * @param key the key
+ * @param value the value
+ * @param context
+ */
+ public static synchronized void setByteArray(String qualifier, String key, byte[] value, IScopeContext context) {
+ if(context != null) {
+ try {
+ IEclipsePreferences node = context.getNode(qualifier);
+ node.putByteArray(key, value);
+ node.flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+ else {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putByteArray(key, value);
+ }
+ }
+
+ /**
+ * Sets a double preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
+ * @param qualifier
+ * @param key the key
+ * @param value the value
+ * @param context
+ */
+ public static synchronized void setDouble(String qualifier, String key, double value, IScopeContext context) {
+ if(context != null) {
+ try {
+ IEclipsePreferences node = context.getNode(qualifier);
+ node.putDouble(key, value);
+ node.flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+ else {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putDouble(key, value);
+ }
+ }
+
+ /**
+ * Sets a float preference in the {@link InstanceScope} or the given {@link IScopeContext} if it
+ * is not <code>null</code>. Preferences set in a given context are flushed as they are set.
+ * @param qualifier
+ * @param key the key
+ * @param value the value
+ * @param context
+ */
+ public static synchronized void setFloat(String qualifier, String key, float value, IScopeContext context) {
+ if(context != null) {
+ try {
+ IEclipsePreferences node = context.getNode(qualifier);
+ node.putFloat(key, value);
+ node.flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+ else {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).putFloat(key, value);
+ }
+ }
+
+ /**
+ * Sets a string in the {@link DefaultScope}
+ * @param qualifier
+ * @param key the key
+ * @param value the new value
+ */
+ public static synchronized void setDefaultString(String qualifier, String key, String value) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).put(key, value);
+ }
+
+ /**
+ * Sets a boolean in the {@link DefaultScope}
+ * @param qualifier
+ * @param key the key
+ * @param value the new value
+ */
+ public static synchronized void setDefaultBoolean(String qualifier, String key, boolean value) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putBoolean(key, value);
+ }
+
+ /**
+ * Sets a byte array in the {@link DefaultScope}
+ * @param qualifier
+ * @param key the key
+ * @param value the new value
+ */
+ public static synchronized void setDefaultByteArray(String qualifier, String key, byte[] value) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putByteArray(key, value);
+ }
+
+ /**
+ * Sets a double in the {@link DefaultScope}
+ * @param qualifier
+ * @param key the key
+ * @param value the new value
+ */
+ public static synchronized void setDefaultDouble(String qualifier, String key, double value) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putDouble(key, value);
+ }
+
+ /**
+ * Sets a float in the {@link DefaultScope}
+ * @param qualifier
+ * @param key the key
+ * @param value the new value
+ */
+ public static synchronized void setDefaultFloat(String qualifier, String key, float value) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putFloat(key, value);
+ }
+
+ /**
+ * Sets a integer in the {@link DefaultScope}
+ * @param 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);
+ }
+
+ /**
+ * Sets a long in the {@link DefaultScope}
+ * @param qualifier
+ * @param key the key
+ * @param value the new value
+ */
+ public static synchronized void setDefaultLong(String qualifier, String key, long value) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).putLong(key, value);
+ }
+
+ /**
+ * Sets the given preference to its default value. This is done by removing any set value
+ * from the {@link InstanceScope}. Has no effect if the given key is <code>null</code>.
+ * @param qualifier
+ * @param key the key for the preference
+ */
+ public static synchronized void setToDefault(String qualifier, String key) {
+ if(key != null) {
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).remove(key);
+ }
+ }
+
+ /**
+ * Returns the default boolean value stored in the {@link DefaultScope} for the given key
+ * or the specified default value if the key does not appear in the {@link DefaultScope}
+ * @param qualifier
+ * @param key
+ * @param defaultvalue
+ *
+ * @return the boolean value set in the {@link DefaultScope} for the given key, or the specified default value.
+ */
+ public static synchronized boolean getDefaultBoolean(String qualifier, String key, boolean defaultvalue) {
+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getBoolean(key, defaultvalue);
+ }
+
+ /**
+ * Returns the default string value stored in the {@link DefaultScope} for the given key
+ * or the specified default value if the key does not appear in the {@link DefaultScope}
+ * @param qualifier
+ * @param key
+ * @param defaultvalue
+ *
+ * @return the string value set in the {@link DefaultScope} for the given key, or the specified default value.
+ */
+ public static synchronized String getDefaultString(String qualifier, String key, String defaultvalue) {
+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).get(key, defaultvalue);
+ }
+
+ /**
+ * Returns the default byte array value stored in the {@link DefaultScope} for the given key
+ * or the specified default value if the key does not appear in the {@link DefaultScope}
+ * @param qualifier
+ * @param key
+ * @param defaultvalue
+ *
+ * @return the byte array value set in the {@link DefaultScope} for the given key, or the specified default value.
+ */
+ public static synchronized byte[] getDefaultByteArray(String qualifier, String key, byte[] defaultvalue) {
+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getByteArray(key, defaultvalue);
+ }
+
+ /**
+ * Returns the default integer value stored in the {@link DefaultScope} for the given key
+ * or the specified default value if the key does not appear in the {@link DefaultScope}
+ * @param qualifier
+ * @param key
+ * @param defaultvalue
+ *
+ * @return the integer value set in the {@link DefaultScope} for the given key, or the specified default value.
+ */
+ public static synchronized int getDefaultInt(String qualifier, String key, int defaultvalue) {
+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getInt(key, defaultvalue);
+ }
+
+ /**
+ * Returns the default long value stored in the {@link DefaultScope} for the given key
+ * or the specified default value if the key does not appear in the {@link DefaultScope}
+ * @param qualifier
+ * @param key
+ * @param defaultvalue
+ *
+ * @return the long value set in the {@link DefaultScope} for the given key, or the specified default value.
+ */
+ public static synchronized long getDefaultLong(String qualifier, String key, long defaultvalue) {
+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getLong(key, defaultvalue);
+ }
+
+ /**
+ * Returns the default double value stored in the {@link DefaultScope} for the given key
+ * or the specified default value if the key does not appear in the {@link DefaultScope}
+ * @param qualifier
+ * @param key
+ * @param defaultvalue
+ *
+ * @return the double value set in the {@link DefaultScope} for the given key, or the specified default value.
+ */
+ public static synchronized double getDefaultDouble(String qualifier, String key, double defaultvalue) {
+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getDouble(key, defaultvalue);
+ }
+
+ /**
+ * Returns the default float value stored in the {@link DefaultScope} for the given key
+ * or the specified default value if the key does not appear in the {@link DefaultScope}
+ * @param qualifier
+ * @param key
+ * @param defaultvalue
+ *
+ * @return the float value set in the {@link DefaultScope} for the given key, or the specified default value.
+ */
+ public static synchronized float getDefaultFloat(String qualifier, String key, float defaultvalue) {
+ return contexts[DEFAULT_CONTEXT].getNode(qualifier).getFloat(key, defaultvalue);
+ }
+
+ /**
+ * Save the preferences for the given plugin identifier.
+ * It should be noted that all pending preference changes will be flushed with this method.
+ * @param qualifier
+ */
+ public static synchronized void savePreferences(String qualifier) {
+ try {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).flush();
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).flush();
+ }
+ catch(BackingStoreException bse) {
+ DebugPlugin.log(bse);
+ }
+ }
+
+ /**
+ * Adds the given preference listener to the {@link DefaultScope} and the {@link InstanceScope}
+ * @param qualifier
+ * @param listener
+ */
+ public static void addPreferenceListener(String qualifier, IEclipsePreferences.IPreferenceChangeListener listener) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener);
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).addPreferenceChangeListener(listener);
+ }
+
+ /**
+ * Removes the given preference listener from the {@link DefaultScope} and the {@link InstanceScope}
+ * @param qualifier
+ * @param listener
+ */
+ public static void removePreferenceListener(String qualifier, IEclipsePreferences.IPreferenceChangeListener listener) {
+ contexts[DEFAULT_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener);
+ contexts[INSTANCE_CONTEXT].getNode(qualifier).removePreferenceChangeListener(listener);
+ }
+}

Back to the top