To manage preferences of my swt/jface application, I'm using org.eclipse.jface.preference
I have 3 nodes in the preference window:
//Creation of the nodes
PreferenceNode one = new PreferenceNode("one", new PreferencePage1());
PreferenceNode two = new PreferenceNode("two", new PreferencePage2());
PreferenceNode three = new PreferenceNode("three", new PreferencePage3());
//Creation of the manager
PreferenceManager mgr = new PreferenceManager();
mgr.addToRoot(one);
mgr.addToRoot(two);
two.add(three);
//Show the preference dialog
PreferenceDialog myPreferenceDialog = new PreferenceDialog(null, mgr);
The node three
is a subnode of the node two
.
How can I expand the node two
in the tree of the PreferenceNode
?
If you create a subclass of PreferenceDialog
you can override the createTreeViewer
method and set the auto expand level:
@Override
protected TreeViewer createTreeViewer(final Composite parent)
{
TreeViewer viewer = super.createTreeViewer(parent);
viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
return viewer;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.