Although the behavior of the IPreferenceStore provided by AbstractUIPlugin#getPreferenceStore()
hasn't changed we have updated the specification of IPreferenceStore
to explicitly define the behavior that we have provided.
Typing of PropertyChangeEvents
Any property change event from an IPreferenceStore must have an old and new value of the same type that is consistent with the setValue call that generated it.
For instance if you call IPreferenceStore#setValue(String name, long
value)
the values in the PropertyChangeEvent generated from this method
will both be of type java.lang.Long
.
putValue
Calls to #putValue
will not generate a PropertyChangedEvent
.
Calls to the various #setValue
methods will.
Relationship between the OSGI Preference and an IPreferenceStore
The IPreferenceStore provided by AbstractUIPlugin#getPreferenceStore()
is
an instance of ScopedPreferenceStore
which uses org.osgi.service.prefs.Preferences
as a back end. org.osgi.service.prefs.Preferences
propagates change
events as Strings only.
The ScopedPreferenceStore
wrappers those OSGI events generated
by IPreferenceStore#setValue(String name, String value)
and one
of it's own PropertyChangeEvents
and forwards that event to it's
listeners. For the other implementations of IPreferenceStore#setValue
the ScopedPreferenceStore
will create it's own events of the correct
type and not propagate the events from the OSGI preferences.
Listeners to a ScopedPreferenceStore
should be prepared for both
typed and String values in thier change events as it is still possible to get
an event via the OSGI preferences (during a preference import for instance).
OSGI events are always of type java.lang.String.
It has always been possible to get a null org.eclipse.swt.widgets.Shell from the existing IWorkbenchWindows in the Eclipse SDK. We now explictly define the conditions where this occurs, namely when the shell has not been created or when the IWorkbenchWindow has been closed.