|
|||||||||
| Home >> All >> org >> eclipse >> jface >> [ preference overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.jface.preference
Interface IPreferenceStore

- All Known Subinterfaces:
- IPersistentPreferenceStore
- All Known Implementing Classes:
- PreferenceStore
- public interface IPreferenceStore
The IPreferenceStore interface represents a table mapping
named preferences to values. If there is no value for a given name,
then that preferences's default value is returned; and if there is no
default value for that preference, then a default-default value is returned.
The default-default values for the primitive types are as follows:
boolean=falsedouble=0.0float=0.0fint=0long=0String=""(the empty string)
Thus a preference store maintains two values for each of a set of names: a current value and a default value. The typical usage is to establish the defaults for all known preferences and then restore previously stored values for preferences whose values were different from their defaults. After the current values of the preferences have been modified, it is a simple matter to write out only those preferences whose values are different from their defaults. This two-tiered approach to saving and restoring preference setting minimized the number of preferences that need to be persisted; indeed, the normal starting state does not require storing any preferences at all.
A property change event is reported whenever a preferences current
value actually changes (whether through setValue,
setToDefault, or other unspecified means). Note, however,
that manipulating default values (with setDefault)
does not cause such events to be reported.
Clients who need a preference store may implement this interface or
instantiate the standard implementation PreferenceStore.
| Field Summary | |
static boolean |
BOOLEAN_DEFAULT_DEFAULT
The default-default value for boolean preferences ( false). |
static double |
DOUBLE_DEFAULT_DEFAULT
The default-default value for double preferences ( 0.0). |
static java.lang.String |
FALSE
The string representation used for false ("false"). |
static float |
FLOAT_DEFAULT_DEFAULT
The default-default value for float preferences ( 0.0f). |
static int |
INT_DEFAULT_DEFAULT
The default-default value for int preferences ( 0). |
static long |
LONG_DEFAULT_DEFAULT
The default-default value for long preferences ( 0L). |
static java.lang.String |
STRING_DEFAULT_DEFAULT
The default-default value for String preferences ( ""). |
static java.lang.String |
TRUE
The string representation used for true ("true"). |
| Method Summary | |
void |
addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Adds a property change listener to this preference store. |
boolean |
contains(java.lang.String name)
Returns whether the named preference is known to this preference store. |
void |
firePropertyChangeEvent(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)
Fires a property change event corresponding to a change to the current value of the preference with the given name. |
boolean |
getBoolean(java.lang.String name)
Returns the current value of the boolean-valued preference with the given name. |
boolean |
getDefaultBoolean(java.lang.String name)
Returns the default value for the boolean-valued preference with the given name. |
double |
getDefaultDouble(java.lang.String name)
Returns the default value for the double-valued preference with the given name. |
float |
getDefaultFloat(java.lang.String name)
Returns the default value for the float-valued preference with the given name. |
int |
getDefaultInt(java.lang.String name)
Returns the default value for the integer-valued preference with the given name. |
long |
getDefaultLong(java.lang.String name)
Returns the default value for the long-valued preference with the given name. |
java.lang.String |
getDefaultString(java.lang.String name)
Returns the default value for the string-valued preference with the given name. |
double |
getDouble(java.lang.String name)
Returns the current value of the double-valued preference with the given name. |
float |
getFloat(java.lang.String name)
Returns the current value of the float-valued preference with the given name. |
int |
getInt(java.lang.String name)
Returns the current value of the integer-valued preference with the given name. |
long |
getLong(java.lang.String name)
Returns the current value of the long-valued preference with the given name. |
java.lang.String |
getString(java.lang.String name)
Returns the current value of the string-valued preference with the given name. |
boolean |
isDefault(java.lang.String name)
Returns whether the current value of the preference with the given name has the default value. |
boolean |
needsSaving()
Returns whether the current values in this property store require saving. |
void |
putValue(java.lang.String name,
java.lang.String value)
Sets the current value of the preference with the given name to the given string value. |
void |
removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
Removes the given listener from this preference store. |
void |
setDefault(java.lang.String name,
boolean value)
Sets the default value for the boolean-valued preference with the given name. |
void |
setDefault(java.lang.String name,
double value)
Sets the default value for the double-valued preference with the given name. |
void |
setDefault(java.lang.String name,
float value)
Sets the default value for the float-valued preference with the given name. |
void |
setDefault(java.lang.String name,
int value)
Sets the default value for the integer-valued preference with the given name. |
void |
setDefault(java.lang.String name,
long value)
Sets the default value for the long-valued preference with the given name. |
void |
setDefault(java.lang.String name,
java.lang.String defaultObject)
Sets the default value for the string-valued preference with the given name. |
void |
setToDefault(java.lang.String name)
Sets the current value of the preference with the given name back to its default value. |
void |
setValue(java.lang.String name,
boolean value)
Sets the current value of the boolean-valued preference with the given name. |
void |
setValue(java.lang.String name,
double value)
Sets the current value of the double-valued preference with the given name. |
void |
setValue(java.lang.String name,
float value)
Sets the current value of the float-valued preference with the given name. |
void |
setValue(java.lang.String name,
int value)
Sets the current value of the integer-valued preference with the given name. |
void |
setValue(java.lang.String name,
long value)
Sets the current value of the long-valued preference with the given name. |
void |
setValue(java.lang.String name,
java.lang.String value)
Sets the current value of the string-valued preference with the given name. |
| Field Detail |
BOOLEAN_DEFAULT_DEFAULT
public static final boolean BOOLEAN_DEFAULT_DEFAULT
- The default-default value for boolean preferences (
false).- See Also:
- Constant Field Values
DOUBLE_DEFAULT_DEFAULT
public static final double DOUBLE_DEFAULT_DEFAULT
- The default-default value for double preferences (
0.0).- See Also:
- Constant Field Values
FLOAT_DEFAULT_DEFAULT
public static final float FLOAT_DEFAULT_DEFAULT
- The default-default value for float preferences (
0.0f).- See Also:
- Constant Field Values
INT_DEFAULT_DEFAULT
public static final int INT_DEFAULT_DEFAULT
- The default-default value for int preferences (
0).- See Also:
- Constant Field Values
LONG_DEFAULT_DEFAULT
public static final long LONG_DEFAULT_DEFAULT
- The default-default value for long preferences (
0L).- See Also:
- Constant Field Values
STRING_DEFAULT_DEFAULT
public static final java.lang.String STRING_DEFAULT_DEFAULT
- The default-default value for String preferences (
"").- See Also:
- Constant Field Values
TRUE
public static final java.lang.String TRUE
- The string representation used for
true("true").- See Also:
- Constant Field Values
FALSE
public static final java.lang.String FALSE
- The string representation used for
false("false").- See Also:
- Constant Field Values
| Method Detail |
addPropertyChangeListener
public void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
- Adds a property change listener to this preference store.
contains
public boolean contains(java.lang.String name)
- Returns whether the named preference is known to this preference
store.
firePropertyChangeEvent
public void firePropertyChangeEvent(java.lang.String name, java.lang.Object oldValue, java.lang.Object newValue)
- Fires a property change event corresponding to a change to the
current value of the preference with the given name.
This method is provided on this interface to simplify the implementation of decorators. There is normally no need to call this method since
setValueandsetToDefaultreport such events in due course. Implementations should funnel all preference changes through this method.
getBoolean
public boolean getBoolean(java.lang.String name)
- Returns the current value of the boolean-valued preference with the
given name.
Returns the default-default value (
false) if there is no preference with the given name, or if the current value cannot be treated as a boolean.
getDefaultBoolean
public boolean getDefaultBoolean(java.lang.String name)
- Returns the default value for the boolean-valued preference
with the given name.
Returns the default-default value (
false) if there is no default preference with the given name, or if the default value cannot be treated as a boolean.
getDefaultDouble
public double getDefaultDouble(java.lang.String name)
- Returns the default value for the double-valued preference
with the given name.
Returns the default-default value (
0.0) if there is no default preference with the given name, or if the default value cannot be treated as a double.
getDefaultFloat
public float getDefaultFloat(java.lang.String name)
- Returns the default value for the float-valued preference
with the given name.
Returns the default-default value (
0.0f) if there is no default preference with the given name, or if the default value cannot be treated as a float.
getDefaultInt
public int getDefaultInt(java.lang.String name)
- Returns the default value for the integer-valued preference
with the given name.
Returns the default-default value (
0) if there is no default preference with the given name, or if the default value cannot be treated as an integer.
getDefaultLong
public long getDefaultLong(java.lang.String name)
- Returns the default value for the long-valued preference
with the given name.
Returns the default-default value (
0L) if there is no default preference with the given name, or if the default value cannot be treated as a long.
getDefaultString
public java.lang.String getDefaultString(java.lang.String name)
- Returns the default value for the string-valued preference
with the given name.
Returns the default-default value (the empty string
"") is no default preference with the given name, or if the default value cannot be treated as a string.
getDouble
public double getDouble(java.lang.String name)
- Returns the current value of the double-valued preference with the
given name.
Returns the default-default value (
0.0) if there is no preference with the given name, or if the current value cannot be treated as a double.
getFloat
public float getFloat(java.lang.String name)
- Returns the current value of the float-valued preference with the
given name.
Returns the default-default value (
0.0f) if there is no preference with the given name, or if the current value cannot be treated as a float.
getInt
public int getInt(java.lang.String name)
- Returns the current value of the integer-valued preference with the
given name.
Returns the default-default value (
0) if there is no preference with the given name, or if the current value cannot be treated as an integter.
getLong
public long getLong(java.lang.String name)
- Returns the current value of the long-valued preference with the
given name.
Returns the default-default value (
0L) if there is no preference with the given name, or if the current value cannot be treated as a long.
getString
public java.lang.String getString(java.lang.String name)
- Returns the current value of the string-valued preference with the
given 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.
isDefault
public boolean isDefault(java.lang.String name)
- Returns whether the current value of the preference with the given name
has the default value.
needsSaving
public boolean needsSaving()
- Returns whether the current values in this property store
require saving.
putValue
public void putValue(java.lang.String name, java.lang.String value)
- Sets the current value of the preference with the given name to
the given string value.
This method is provided on this interface to simplify the implementation of decorators, and does not report a property change event. Normal clients should instead call
setValue.
removePropertyChangeListener
public void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
- Removes the given listener from this preference store.
Has no affect if the listener is not registered.
setDefault
public void setDefault(java.lang.String name, double value)
- Sets the default value for the double-valued preference with the
given name.
Note that the current value of the preference is affected if the preference's current value was its old default value, in which case it changes to the new default value. If the preference's current is different from its old default value, its current value is unaffected. No property change events are reported by changing default values.
setDefault
public void setDefault(java.lang.String name, float value)
- Sets the default value for the float-valued preference with the
given name.
Note that the current value of the preference is affected if the preference's current value was its old default value, in which case it changes to the new default value. If the preference's current is different from its old default value, its current value is unaffected. No property change events are reported by changing default values.
setDefault
public void setDefault(java.lang.String name, int value)
- Sets the default value for the integer-valued preference with the
given name.
Note that the current value of the preference is affected if the preference's current value was its old default value, in which case it changes to the new default value. If the preference's current is different from its old default value, its current value is unaffected. No property change events are reported by changing default values.
setDefault
public void setDefault(java.lang.String name, long value)
- Sets the default value for the long-valued preference with the
given name.
Note that the current value of the preference is affected if the preference's current value was its old default value, in which case it changes to the new default value. If the preference's current is different from its old default value, its current value is unaffected. No property change events are reported by changing default values.
setDefault
public void setDefault(java.lang.String name, java.lang.String defaultObject)
- Sets the default value for the string-valued preference with the
given name.
Note that the current value of the preference is affected if the preference's current value was its old default value, in which case it changes to the new default value. If the preference's current is different from its old default value, its current value is unaffected. No property change events are reported by changing default values.
setDefault
public void setDefault(java.lang.String name, boolean value)
- Sets the default value for the boolean-valued preference with the
given name.
Note that the current value of the preference is affected if the preference's current value was its old default value, in which case it changes to the new default value. If the preference's current is different from its old default value, its current value is unaffected. No property change events are reported by changing default values.
setToDefault
public void setToDefault(java.lang.String name)
- Sets the current value of the preference with the given name back
to its default value.
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 named value from the store, thereby exposing the default value.
setValue
public void setValue(java.lang.String name, double value)
- Sets the current value of the double-valued preference with the
given name.
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.
Note that the preferred way of re-initializing a preference to its default value is to call
setToDefault.
setValue
public void setValue(java.lang.String name, float value)
- Sets the current value of the float-valued preference with the
given name.
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.
Note that the preferred way of re-initializing a preference to its default value is to call
setToDefault.
setValue
public void setValue(java.lang.String name, int value)
- Sets the current value of the integer-valued preference with the
given name.
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.
Note that the preferred way of re-initializing a preference to its default value is to call
setToDefault.
setValue
public void setValue(java.lang.String name, long value)
- Sets the current value of the long-valued preference with the
given name.
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.
Note that the preferred way of re-initializing a preference to its default value is to call
setToDefault.
setValue
public void setValue(java.lang.String name, java.lang.String value)
- Sets the current value of the string-valued preference with the
given name.
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.
Note that the preferred way of re-initializing a preference to its default value is to call
setToDefault.
setValue
public void setValue(java.lang.String name, boolean value)
- Sets the current value of the boolean-valued preference with the
given name.
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.
Note that the preferred way of re-initializing a preference to its default value is to call
setToDefault.
|
|||||||||
| Home >> All >> org >> eclipse >> jface >> [ preference overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC