Adding/removing nodes to tree under TreeViewer
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);
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?