Eclipse 4 RCP migration - how to avoid Plugin.getDefault().getPreferenceStore()

less than 1 minute read

Today I got the question how to avoid the usage of Plugin.getDefault().getPreferenceStore() to access preferences as for example in:

Plugin.getDefault().getPreferenceStore() .getBoolean(IPreferenceConstants.TEST);

The solution is easy you can directly use InstanceScope.Instance, the underlying storage is the same.

InstanceScope.INSTANCE.getNode("com.vogella.eclipse.test"). getBoolean(IPreferenceConstants.TEST, true);

I hope this helps.

[Reminder for myself, we should probably start using that also in platform…]