Reputation: 490
I have a custom outline in my Eclipse plug-in, implemented using class TreeViewer
and I created this outline using this code:
public class MyOutlinePage extends ContentOutlinePage
(...)
Object[] data = (...)
TreeViewer treeViewer = getTreeViewer();
treeViewer.setInput(data);
And after set input I need to select one specific element in outline.
For example, I need to select the element data[2]
in the outline.
It must be the same that I click in the element using mouse.
Upvotes: 0
Views: 1041
Reputation: 21025
The tree viewer has a setSelection
method to programmatically change its selection. If you wrap you domain object into a StructuredSeletion
the corresponding TreeItem
will be selected.
treeViewer.setSelection( new StructuredSelection( data[2] ) );
Upvotes: 2