I have a TreeViewer
with an ILazyTreeContentProvider
. I want to control the expansion of the top-level tree items: Initially they are unexpanded, but when an Action "Expand" is selected, the item should be expanded.
In the action.run()
I currently do
final EntityTreeNode projectNode = (EntityTreeNode) ((ITreeSelection)
viewer.getSelection()).getFirstElement();
// notify the content provider that the node should be expanded; it creates child nodes
// and updates the child count and calls viewer.setChildCount
((LazyEntityModelViewContentProvider) viewer.getContentProvider()).expandProject(projectNode);
viewer.expandToLevel(projectNode, 2);
viewer.refresh(projectNode);
But the node is not expanded. It should at least change it's icon to show that it has children...