# JFace Preference Stores

As of release 3.1 the org.eclipse.jface.preference.IPreferenceStore that is returned from AbstractUIPlugin#getPreferenceStore will be an instance of org.eclipse.ui.preferences.ScopedPreferenceStore. The ScopedPreferenceStore uses the new core runtime API to manage preferences. In 3.0 it used the compatibility layer to interface with an instance of org.eclipse.core.runtime.Preferences.

In 3.1 we have disambiguated IPreferenceStore to be more specific about the types of the values sent in preference changed events. The IPreferenceStore from AbstractUIPlugin#getPreferenceStore has the same behavior as before - all that has changed is that it has been specified more clearly.

Typing: org.eclipse.jface.util.IPropertyChangeListener added to an IPreferenceStore can potentially get two types of old and new values - typed or String representations. Any event generated by a call to a typed IPreferenceStore API (such as `setValue(String key, boolean value)` will generate a typed event. However it is also possible that events will be propagated from the core runtime preferences which generate an un typed event (for instance on a preference import). Property listeners need to be prepared for both. Note also that typed events will not be propagating primitive types so a call to `setValue(String key, boolean value)` will result in an event where the oldValue and newValue are Booleans.

putValue: IPreferenceStore.putValue(String key, String value) will not generate a change event. This API is meant to be used for private preferences that no listener would want to react to.

initializeDefaultPreferences. This API was deprecated in Eclipse 3.0 as it is only fired if the compatibility layer is used. As most plug-ins rely on AbstractUIPlugin#getPreferenceStore to get their preference store this was being fired on plug-in start-up previously. If your plug-in does not access the compatibility layer itself then this method may not be fired. It is recommended that you create a org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer to handle your preference initialization.