svm svm - 4 months ago 18
Java Question

Programmatically selecting a node from the Project properties dialog in Eclipse

I am developing an Eclipse plug-in which adds 2 property pages to the project.

The second property page is a subpage to property page 1. Basically, if a person expands property page 1 node, then property page 2 is shown.

In property page 1, there is a button called "Advanced settings" which, when clicked, should open and set focus to property page 2.

How can I do the same programmatically?

enter image description here

enter image description here

Answer

There is no designated way to select another property page from within a property page.

Your only chance is to cast the container to FilteredPreferenceDialog. This class has a public method to change the currently shown page. For example:

IPreferencePageContainer container = getContainer();
FilteredPreferenceDialog dialog = ( FilteredPreferenceDialog )container;
dialog.setCurrentPageId( "page-id" );

The downside of this workaround is that FilteredPreferenceDialog is an internal class.