Results 1 to 1 of 1
- 04-20-2009, 01:02 AM #1
Member
- Join Date
- Mar 2008
- Posts
- 6
- Rep Power
- 0
Adding/removing nodes to tree under TreeViewer
Hi,
I am learning how to use JFace and wondering what is the best way to work with modifying a model under TreeViewer (the model could be, for example, a data structure representing a biological taxonomy).
A direct way of doing it would be to have the viewer capture events (say, the key '+'), and to add a node to the tree using the Viewer's 'insert' method, as well as updating the model below.
However, the would require the viewer to know how to manipulate the model. Note that this is not true on getting information from the model, which is managed by the content provider.
Am I missing something, or there isn't in JFace an equivalent to content providers when it comes to modifying the underlying model?
Update: I added the following code to my TreeViewer event listener:
insert(((TreeSelection)getSelection()).getFirstEle ment(), newElement, 0);
refresh();
System.out.println("Added new element");
I know this is being executed because of the println. However, it has no effect on my tree. What am I doing wrong?
Thanks,
RodrigoLast edited by Rodrigo Braz; 04-20-2009 at 01:26 AM.
Similar Threads
-
Images problem in treeviewer
By Gandolf in forum SWT / JFaceReplies: 0Last Post: 04-03-2009, 02:18 PM -
SWT treeviewer
By sushistix in forum SWT / JFaceReplies: 4Last Post: 10-28-2008, 09:25 PM -
TreeViewer Demonstration
By Java Tip in forum SWTReplies: 0Last Post: 07-07-2008, 04:54 PM -
Adding and removing panels dynamically
By kbyrne in forum AWT / SwingReplies: 1Last Post: 04-12-2008, 08:28 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks