public class CustomScopedPreferenceStore
extends org.eclipse.ui.preferences.ScopedPreferenceStore
ScopedPreferenceStore
that gives
client code following options:
IEclipsePreferences
nodes to the store.save()
is called by the JFace preference page
platform.Constructor and Description |
---|
CustomScopedPreferenceStore(java.lang.Class<?> clazz)
A convenient constructor for getting a default
CustomScopedPreferenceStore for a class' bundle. |
CustomScopedPreferenceStore(org.eclipse.core.runtime.preferences.IScopeContext context,
java.lang.String qualifier)
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
org.eclipse.core.runtime.preferences.IEclipsePreferences |
getNode(java.lang.String path)
Gets the child preferences node from the specified relative path.
|
java.lang.String |
getSecureString(java.lang.String name)
Returns the current value of the string-valued, securely stored
preference with the given name.
|
boolean |
hasNode(java.lang.String path)
Determines whether or not the preference node with the specified relative
path exists underneath this store's associated preference node.
|
boolean |
needsSaving() |
boolean |
removeNode(java.lang.String path)
Removes the child preferences node at the specified relative path.
|
void |
removeSecureString(java.lang.String name)
Removes the specified, securely stored value from the store.
|
void |
removeValue(java.lang.String name)
Removes the specified value (including its defaults) from the store.
|
void |
save() |
void |
setSecureValue(java.lang.String name,
java.lang.String value)
Sets the current value of the string-valued, securely stored
preference with the given name.
|
addPropertyChangeListener, contains, firePropertyChangeEvent, getBoolean, getDefaultBoolean, getDefaultDouble, getDefaultFloat, getDefaultInt, getDefaultLong, getDefaultString, getDouble, getFloat, getInt, getLong, getPreferenceNodes, getString, isDefault, putValue, removePropertyChangeListener, setDefault, setDefault, setDefault, setDefault, setDefault, setDefault, setSearchContexts, setToDefault, setValue, setValue, setValue, setValue, setValue, setValue
public CustomScopedPreferenceStore(java.lang.Class<?> clazz)
CustomScopedPreferenceStore
for a class' bundle.clazz
- The target class.public CustomScopedPreferenceStore(org.eclipse.core.runtime.preferences.IScopeContext context, java.lang.String qualifier)
context
- The scope to store to, e.g., InstanceScope.INSTANCE
.qualifier
- The qualifer used to look up the preference node, e.g., the
bundle's ID.public org.eclipse.core.runtime.preferences.IEclipsePreferences getNode(java.lang.String path)
path
- The relative path. A relative path must not start with "/"
(meaning it is an absolute path) and must not be an empty
string (meaning it is the primary node itself).public java.lang.String getSecureString(java.lang.String name)
Returns the default-default value (the empty string ""
) if
there is no preference with the given name, or if the current value
cannot be treated as a string.
name
- The name of the preference.public boolean hasNode(java.lang.String path)
path
- The relative path. A relative path must not start with "/"
(meaning it is an absolute path) and must not be an empty
string (meaning it is the primary node itself).public boolean needsSaving()
needsSaving
in interface org.eclipse.jface.preference.IPreferenceStore
needsSaving
in class org.eclipse.ui.preferences.ScopedPreferenceStore
public boolean removeNode(java.lang.String path)
This operation should be used instead of calling
IEclipsePreferences.removeNode()
, as the parent node needs to be
flushed afterward.
path
- The relative path. A relative path must not start with "/"
(meaning it is an absolute path) and must not be an empty
string (meaning it is the primary node itself).IEclipsePreferences
node was removed from the
store, false otherwise.public void removeSecureString(java.lang.String name)
name
- The name of the value to remove.public void removeValue(java.lang.String name)
name
- The name of the value to remove.public void save() throws java.io.IOException
save
in interface org.eclipse.jface.preference.IPersistentPreferenceStore
save
in class org.eclipse.ui.preferences.ScopedPreferenceStore
java.io.IOException
public void setSecureValue(java.lang.String name, java.lang.String value)
A property change event is reported if the current value of the preference actually changes from its previous value. In the event object, the property name is the name of the preference, and the old and new values are wrapped as objects.
name
- The name of the preference.value
- The value of the preference that must be stored securely.