View Full Version : How to use SelectionChangedEvent of tree in beta3?

28 May 2008, 12:11 AM

I just upgraded from beta2 to beta3 and wonder how to use the SelectionChangedEvent with a tree. Before I added it to the viewer like this:

viewer.addSelectionListener(new SelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent se) {
});With this I got my custom TreeModel with all the additional data.

How do I do this in beta3?

I build my tree like this:

TreeBuilder.buildTree(tree, rootFolder);

tree.addListener(Events.SelectionChange, new Listener<TreeEvent>() {
public void handleEvent(TreeEvent ce) {
});where rootFolder is a custom BaseTreeModel. Now how do I get the model out of the event so I have access to its values?

Or is there another way to do this?


28 May 2008, 1:07 PM
You will want to use a TreeBinder which is a SelectionProvider. You will be able to add you selection change listener just as you did with the TreeViewer. Take a look at the explorer demo tree pages that will show you how to use a TreeStore and TreeBinder.