Class ScopedPreferenceStore
- All Implemented Interfaces:
org.eclipse.jface.preference.IPersistentPreferenceStore,org.eclipse.jface.preference.IPreferenceStore
org.eclipse.ui.preferences.ScopedPreferenceStore
to fix the memory leak issue described in
Bug 239033.
The ScopedPreferenceStore is an IPreferenceStore that uses the scopes provided in org.eclipse.core.runtime.preferences.
A ScopedPreferenceStore does the lookup of a preference based on its search scopes and sets the value of the preference based on its store scope.
The default scope is always included in the search scopes when searching for preference values.
-
Field Summary
Fields inherited from interface org.eclipse.jface.preference.IPreferenceStore
BOOLEAN_DEFAULT_DEFAULT, DOUBLE_DEFAULT_DEFAULT, FALSE, FLOAT_DEFAULT_DEFAULT, INT_DEFAULT_DEFAULT, LONG_DEFAULT_DEFAULT, STRING_DEFAULT_DEFAULT, TRUE -
Constructor Summary
ConstructorsConstructorDescriptionScopedPreferenceStore(org.eclipse.core.runtime.preferences.IScopeContext context, String qualifier) Creates a new scoped preference store that will store values in the node looked up in the given context by the given qualifier.ScopedPreferenceStore(org.eclipse.core.runtime.preferences.IScopeContext context, String qualifier, String defaultQualifierPath) Creates a new scoped preference store that will store values in the node looked up in the given context by the given qualifier. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener) booleanvoidfirePropertyChangeEvent(String name, Object oldValue, Object newValue) booleangetBoolean(String name) booleangetDefaultBoolean(String name) doublegetDefaultDouble(String name) floatgetDefaultFloat(String name) intgetDefaultInt(String name) longgetDefaultLong(String name) getDefaultString(String name) doublefloatintlongorg.eclipse.core.runtime.preferences.IEclipsePreferences[]getPreferenceNodes(boolean includeDefault) Return the preference path to search preferences on.booleanbooleanvoidvoidremovePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener) voidsave()voidsetDefault(String name, boolean value) voidsetDefault(String name, double value) voidsetDefault(String name, float value) voidsetDefault(String name, int value) voidsetDefault(String name, long value) voidsetDefault(String name, String defaultObject) voidsetSearchContexts(org.eclipse.core.runtime.preferences.IScopeContext[] scopes) Set the search contexts to scopes.voidsetToDefault(String name) voidvoidvoidvoidvoidvoidMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
-
Constructor Details
-
ScopedPreferenceStore
public ScopedPreferenceStore(org.eclipse.core.runtime.preferences.IScopeContext context, String qualifier, String defaultQualifierPath) Creates a new scoped preference store that will store values in the node looked up in the given context by the given qualifier.- Parameters:
context- the scope to store toqualifier- the qualifier used to look up the preference nodedefaultQualifierPath- the qualifier used when looking up the defaults
-
ScopedPreferenceStore
public ScopedPreferenceStore(org.eclipse.core.runtime.preferences.IScopeContext context, String qualifier) Creates a new scoped preference store that will store values in the node looked up in the given context by the given qualifier.- Parameters:
context- the scope to store toqualifier- the qualifier used to look up the preference node
-
-
Method Details
-
setSearchContexts
public void setSearchContexts(org.eclipse.core.runtime.preferences.IScopeContext[] scopes) Set the search contexts to scopes. When searching for a value the search will be done in the order of scope contexts and will not search the storeContext unless it is in this list.If the given list is
null, then clear this store's search contexts. This means that only this store's scope context and default scope will be used during preference value searching.The defaultContext will be added to the end of this list automatically and MUST NOT be included by the user.
- Parameters:
scopes- a list of scope contexts to use when searching, ornull
-
getPreferenceNodes
public org.eclipse.core.runtime.preferences.IEclipsePreferences[] getPreferenceNodes(boolean includeDefault) Return the preference path to search preferences on. This is the list of preference nodes based on the scope contexts for this store. If there are no search contexts set, then return this store's context.Whether or not the default context should be included in the resulting list is specified by the
includeDefaultparameter.- Parameters:
includeDefault-trueif the default context should be included andfalseotherwise- Returns:
- IEclipsePreferences[]
-
addPropertyChangeListener
public void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener) - Specified by:
addPropertyChangeListenerin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
contains
- Specified by:
containsin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
firePropertyChangeEvent
- Specified by:
firePropertyChangeEventin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getBoolean
- Specified by:
getBooleanin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getDefaultBoolean
- Specified by:
getDefaultBooleanin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getDefaultDouble
- Specified by:
getDefaultDoublein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getDefaultFloat
- Specified by:
getDefaultFloatin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getDefaultInt
- Specified by:
getDefaultIntin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getDefaultLong
- Specified by:
getDefaultLongin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getDefaultString
- Specified by:
getDefaultStringin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getDouble
- Specified by:
getDoublein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getFloat
- Specified by:
getFloatin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getInt
- Specified by:
getIntin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getLong
- Specified by:
getLongin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
getString
- Specified by:
getStringin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
isDefault
- Specified by:
isDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
needsSaving
public boolean needsSaving()- Specified by:
needsSavingin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
putValue
- Specified by:
putValuein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
removePropertyChangeListener
public void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener) - Specified by:
removePropertyChangeListenerin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setDefault
- Specified by:
setDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setDefault
- Specified by:
setDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setDefault
- Specified by:
setDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setDefault
- Specified by:
setDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setDefault
- Specified by:
setDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setDefault
- Specified by:
setDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setToDefault
- Specified by:
setToDefaultin interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setValue
- Specified by:
setValuein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setValue
- Specified by:
setValuein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setValue
- Specified by:
setValuein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setValue
- Specified by:
setValuein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setValue
- Specified by:
setValuein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
setValue
- Specified by:
setValuein interfaceorg.eclipse.jface.preference.IPreferenceStore
-
save
- Specified by:
savein interfaceorg.eclipse.jface.preference.IPersistentPreferenceStore- Throws:
IOException
-