public abstract class AbstractPreference extends java.lang.Object implements IPreference
IPreferenceStore
.Constructor and Description |
---|
AbstractPreference(java.lang.String name,
org.eclipse.jface.preference.IPreferenceStore store)
Creates a new preference with the given name and the given store.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(IPreferenceListener listener)
Adds the given listener for value change events to this preference.
|
java.lang.String |
getName()
Returns the name of this preference.
|
org.eclipse.jface.preference.IPreferenceStore |
getStore()
Returns the store for this preference.
|
boolean |
isDefault()
Returns whether the current value of this preference
has the default value.
|
void |
removeListener(IPreferenceListener listener)
Removes the given value change listener from this preference.
|
void |
setToDefault()
Sets the current value of this preference back to its default value.
|
public AbstractPreference(java.lang.String name, org.eclipse.jface.preference.IPreferenceStore store)
name
- the preference name (not null
)store
- the preference store (not null
)public final java.lang.String getName()
null
)public final org.eclipse.jface.preference.IPreferenceStore getStore()
null
)public final void setToDefault()
Note that the preferred way of re-initializing a preference to the
appropriate default value is to call setToDefault
.
This is implemented by removing the preference value from the store,
thereby exposing the default value.
public final boolean isDefault()
true
if the preference has a known default value
and its current value is the same, and false
otherwisepublic final void addListener(IPreferenceListener listener)
IPreference
Make sure to remove the listener on the same preference instance.
addListener
in interface IPreference
listener
- not null
public final void removeListener(IPreferenceListener listener)
IPreference
removeListener
in interface IPreference
listener
- not null
Copyright (c) 2014, 2020 1C-Soft LLC and others. Made available under the Eclipse Public License 2.0