-
Notifications
You must be signed in to change notification settings - Fork 44
Preferences and Properties
Preferences and properties looks in Eclipse UI very similar, the main difference is that preferences are stored on workbench level and properties are tight to some object - e.g. project or file. In fact, in Red Deer as well as in Eclipse, the PropertyDialog and PropertyPage are inherited from the PreferenceDialog and PreferencePage classes.
To start working with preferences (properties) in RD, you need to create an instance of a dialog. RD provides an implementation of PreferenceDialog called WorkbenchPreferenceDialog that uses Eclipse menu Window > Preferences to open it. Similarly, there is ExplorerItemPropertyDialog that opens PropertyDialog for given explorer item. These dialogs allows you to select preference page, to save its values or to cancel the dialog.
PreferenceDialog dialog = new WorkbenchPreferenceDialog();
dialog.open();
Once you have opened the dialog you need to instantiate the PreferencePage / PropertyPage and let the dialog to select it. Now you are ready to work with the concrete page that will allow you to apply / revert the values.
dialog.select(new RuntimePreferencePage());
Here is a small example of how to work with preferences.
And how to work with properties.