Preferences in RCP

Preferences

Preference pages will be appear Window>Preferences dialog. It can be used to configure different features from once place. Eclipse Preferences is kind of registry of configurations.

e.g.:

As you see here are the various configuration ( preferences ) for Java, Ant, etc.

Sample Preference in Eclipse

org.eclipse.ui.preferencePages extension has to be added to in the plug-in manifest editor for Preference Pages.

Extension point for PreferencePages

Once you add the extension, the following will be the structure:

Extensions post adding PreferencePages

Following is the implementation of SamplePreferencePage.java

Following is the code for PreferenceConstants.java

Code for PreferenceInitializer.java

Once you run the Application as Eclipse Application post the above configuration, following will be the preference page:

Demo of "Sample Preferences"

Getting and Setting Preferences

Preferences for a plug-in are stored in an org.eclipse.jface.preference.IPreferenceStore object. You can access a plug-ins preference through the Activator

Last updated