Although JFace defines IPreferenceStore
, there's a lower-level interface called IEclipsePreferences
. The key difference between IPreferenceStore
and IEclipsePreferences
is that the latter has support for arbitrary nodes similar to nested HashMaps
. IEclipsePreferences
is also based upon the OSGi Preferences
service and can be used without any UI or JFace involvement. When the IPreferenceStore
is obtained from AbstractUIPlugin
, it lazily creates a ScopedPreferenceStore
using InstanceScope
and the bundle's symbolic name as the node name. Perform the following steps:
Modify
clock.ui
'sActivator
:int launchCount = getPreferenceStore().getInt("launchCount"); IEclipsePreferences eclipsePreferences = InstanceScope.INSTANCE. getNode(PLUGIN_ID); int launchCount2 = eclipsePreferences.getInt("launchCount",-1); System.out.println("I have been launched " + launchCount + " times and " + launchCount2);
Run the Eclipse instance and open the Time Zone View.
In the...