| refresh TreeViewer [message #322736] |
Tue, 27 November 2007 13:50  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03530 seconds