Skip to main content



      Home
Home » Eclipse Projects » JFace » How can I programmatically expand items in a TreeViewer?
How can I programmatically expand items in a TreeViewer? [message #1200466] Thu, 21 November 2013 03:54
Eclipse UserFriend
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..
Previous Topic:pre-submit validation of controls
Next Topic:[Databinding] Bind a bean with observable values as properties to table
Goto Forum:
  


Current Time: Sat Jul 05 14:10:04 EDT 2025

Powered by FUDForum. Page generated in 0.44152 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top