Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » refresh TreeViewer
refresh TreeViewer [message #322736] Tue, 27 November 2007 13:50 Go to next message
Eclipse UserFriend
Originally posted by: fca.bergauer.ch

Dear Eclipse users,
I need to refresh a TreeViewer in order to perform adding/removing operations(structural modification) to the tree. Now the problem is that as soon as I call the refresh() method, all the TreeItems are collapsed. To avoid this problem I implemented a method called immediately before the refresh() one. This method saves the actual state of every TreeItem (getExpanded()). Immediately after calling refresh(), I use another method to restore the saved situation. The result is a tree with the correct expanded/collapsed state but the expanded TreeItems don't show any children. If I collapse and expand one of that items, it becomes ok. I found a solution, but the performances are not good enough. In fact if I call ExpandeAll() between the refresh() method and the restore() one and instead of expanding I collapse, it works fine...any idea?

Many Thanks
Francesco
Re: refresh TreeViewer [message #322738 is a reply to message #322736] Tue, 27 November 2007 14:19 Go to previous message
Eclipse UserFriend
francesco wrote:
> Dear Eclipse users,
> I need to refresh a TreeViewer in order to perform adding/removing operations(structural modification) to the tree. Now the problem is that as soon as I call the refresh() method, all the TreeItems are collapsed. To avoid this problem I implemented a method called immediately before the refresh() one. This method saves the actual state of every TreeItem (getExpanded()). Immediately after calling refresh(), I use another method to restore the saved situation. The result is a tree with the correct expanded/collapsed state but the expanded TreeItems don't show any children. If I collapse and expand one of that items, it becomes ok. I found a solution, but the performances are not good enough. In fact if I call ExpandeAll() between the refresh() method and the restore() one and instead of expanding I collapse, it works fine...any idea?
>
> Many Thanks
> Francesco

The content provider is expected to notify the viewer when elements are
added to or removed from the model. Take a look at the insert(),
update(), and refresh() methods. In particular one of the refresh()
methods accepts an element or tree path, effectively telling the tree to
refresh that one node.

If you need further help please let me know.

Matthew
Previous Topic:Adding Filters and ContentProviders to WizardNewFileCreationPage
Next Topic:Creating a fragment for a plugin.properties file
Goto Forum:
  


Current Time: Wed Nov 05 10:51:37 EST 2025

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

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

Back to the top