Package org.eclipse.jface.preference
Class PreferenceMemento
java.lang.Object
org.eclipse.jface.preference.PreferenceMemento
A utility to change and remember preference values and later restore there
 original value. The first time a preference value is changed its current
 value is stored. Later you can reset all preference values (which are changed
 through this class) to the state they had when creating the memento.
 
This class is most useful for testing to prevent leakage of preference changes between individual tests.
- Since:
- 3.18
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidReset every preference changed by this utility to its state before the first change.<T> voidsetValue(IPreferenceStore store, String name, T value) Set the value for the given preference on the given store.
- 
Constructor Details- 
PreferenceMementopublic PreferenceMemento()
 
- 
- 
Method Details- 
setValueSet the value for the given preference on the given store.The first time this preference is changed its value before change is remembered and can later be restored using resetPreferences().- Type Parameters:
- T- the preference value type. The type must have a corresponding- IPreferenceStoresetter.
- Parameters:
- store- the preference store to manipulate (not- null)
- name- the name of the preference (not- null)
- value- the new current value of the preference.
- Throws:
- IllegalArgumentException- when setting a type which is not supported by- IPreferenceStore
- See Also:
 
- 
resetPreferencespublic void resetPreferences()Reset every preference changed by this utility to its state before the first change. After this the instance can still be used as if it was just created.
 
-