treeviewer.add(treeviewer.getInput(), element)
should work. The getInput()
value is the root element of the tree.
From the AbstractTreeViewer
comments:
This method should be called (by the content provider) when a single element has been added to the model, in order to cause the viewer to accurately reflect the model. This method only affects the viewer, not the model.
So be sure to update your model!