I have this listener that I want to display the name of the object selected from the treeviewer and display it on the status line. It keeps saying
The method addSelectionChangedListener(ISelectionChangedListe ner) in the type Viewer is not applicable for the arguments (new SelectionAdapater(){})
and gives me the option to change the method to addPostSelectionChangedListener.
If I change it to that I get the same error except for type StructuredListener instead of Viewer. Eventually I'm going to have it display an attribute of the deepest object within the tree if it's selected and not display anything for higher tiered objects but if I can get this working I don't see a problem with doing that.
How can I get this code(or new code if this is wrong) to register my selection and display it?
|
Code:
|
treeViewer.addSelectionChangedListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
IActionBars bars = getViewSite().getActionBars();
bars.getStatusLineManager().setMessage(treeViewer.getSelection().toString());
}
}); |