When we create PreferencePages in a Eclipse RCP applications, the window->Preferences menu item opens the preferences dialog and all the preferneces are shown in the Preferences window. How about showing a particular preference page from a toolbar button in a view / application.
Before the command framework we can do it using the PreferenceUtil class like belore
PreferencesUtil.createPreferenceDialogOn(shell, preferencePageId, displayedIds, data)
But with the help of the command framework,it is way easy to do this task.
point="org.eclipse.ui.menus">
locationURI="toolbar:com.blog.sample.ui.ButtonView">
commandId="org.eclipse.ui.window.preferences"
label="Preferences"
style="push">
name="preferencePageId"
value="com.blog.sample.ui.CorePreferencePage">
The commandID opens the org.eclipse.ui.window.preferences with all the preferences. The parameter passed to the command tells the Preferences to open the preference window with the page that we want.
Have fun !.
No comments:
Post a Comment