final TreeSelectionModel selModel = treePanel.getSelectionModel();
if (selModel instanceof DefaultSelectionModel) {
((DefaultSelectionModel) selModel).addSelectionModelListener(new DefaultSelectionModelListenerAdapter() {
@Override
public void onSelectionChange(final DefaultSelectionModel sm, final TreeNode node) {
notifySelectionListeners(new SelectionEvent(ClassTreePortlet.this));
}
});
}
else if (selModel instanceof MultiSelectionModel) {
((MultiSelectionModel) selModel).addSelectionModelListener(new MultiSelectionModelListener() {
public void onSelectionChange(final MultiSelectionModel sm, final TreeNode[] nodes) {
notifySelectionListeners(new SelectionEvent(ClassTreePortlet.this));
}
});
}
else {
GWT.log("Unknown tree selection model for class tree: " + selModel, null);