Bug 133378 [FilteredTree] provide API to control expansion-state of FilteredTree on PreferencePage
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); }
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
}
	/**
	 * Save the last known tree width.
	 * 
	 * @param width
	 *            the width.
	 */
	private void setLastTreeWidth(int width) {
		lastTreeWidth = width;
	}
	/**
	 * Set the message text. If the message line currently displays an error,
	 * the message is stored and will be shown after a call to clearErrorMessage
	 * <p>
	 * Shortcut for <code>setMessage(newMessage, NONE)</code>
	 * </p>
	 * 
	 * @param newMessage
	 *            the message, or <code>null</code> to clear the message
	 */
	public void setMessage(String newMessage) {
		setMessage(newMessage, IMessageProvider.NONE);
	}
	/**
	 * Sets the message for this dialog with an indication of what type of
	 * message it is.
	 * <p>
	 * The valid message types are one of <code>NONE</code>,
	 * <code>INFORMATION</code>,<code>WARNING</code>, or
	 * <code>ERROR</code>.