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

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


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

getBoolean(IPreferenceConstants.TEST, true);

I hope this helps.

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

About Lars Vogel

Lars Vogel is the founder and CEO of the vogella GmbH and works as Eclipse and Android consultant, trainer and book author. He is a regular speaker at international conferences, He is the primary author of With more than one million visitors per month this website is one of the central sources for Java, Eclipse and Android programming information.
This entry was posted in Eclipse, Lars Vogel. Bookmark the permalink.

3 Responses to Eclipse 4 RCP migration – how to avoid Plugin.getDefault().getPreferenceStore()

  1. Dorian Yates says:

    Why is InstanceScope perferable to Plugin.getDefault()?

  2. Lars Vogel says:

    Dorian, because it avoids a dependency to Eclipse 3.x API.

  3. Stephan says:

    But it is not equivalent. It doesn’t check the other scopes (like the default scope), if no value is set in the instance scope. If you want to avoid the preference store of JFace, you can use e.g. the IPreferencesService.

Comments are closed.