我有TreeViewer
ILazyTreeContentProvider
。我想控制顶级树项的扩展:最初它们是未展开的,但是当选择Action“Expand”时,该项应该被扩展。
我目前正在action.run()
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);
但是节点没有扩展。它应该至少改变它的图标,以表明它有孩子......