Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse RCP: How to OpenPreferencesAction on particular page?

Tags:

eclipse-rcp

How do I make preferences dialog to open up on a particular page? Doing this opens pref. dialog on the first page by default :

OpenPreferencesAction action = new OpenPreferencesAction();
action.run();

How can I tell it to display some other page from preferences tree?

like image 394
Dima Avatar asked Jan 23 '23 10:01

Dima


1 Answers

You need to create your own action extending OpenPreferencesAction and overriding the run() method, passing the id of the page to be opened. If you look at OpenPreferencesAction you'll see the run method is like this:

public void run() {
    if (workbenchWindow == null) {
        // action has been dispose
        return;
    }
    PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(null, null, null, null);
    dialog.open();
}

The second and third parameters determine the id of the page to display and the filtering criteria.

like image 118
Rich Seller Avatar answered May 06 '23 09:05

Rich Seller