Project: Eclipse_Platform_UI
Bug 133378 [FilteredTree] provide API to control expansion-state of FilteredTree on PreferencePage
Reported: 2006-03-27 10:52:54 | Status: resolved fixed

In my RCP app I have created a small set of prefs-pages, which are neatly displayed in the little "FilteredTree" to the left. But a user-request is to have that tree expanded by default on opening the Prefs-page; this is reasonable, as there are notvery many elements in the tree. As far as I can tell from the extension-point, the interface of FieldEditorPreferencePage, and the interface of IPreferencePageContainer, there is no way to do this. For example, the API to FilteredTree could have methods like the following, with some forwarding methods from PreferencePage to the implementation of IPreferencePageContainer, or the connection could be made in other ways: public void expandAll() { treeViewer.expandAll(); final ISelection sel = treeViewer.getSelection(); if (!sel.isEmpty()) { final IStructuredSelection iss = (IStructuredSelection) sel; treeViewer.reveal(iss.getFirstElement()); } } public void setExpandedElements(Object[] elements) { treeViewer.setExpandedElements(elements); }

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java