}
if (dest==null) dest = ((SceneGraphModel)sceneTree.getModel()).getRoot();
if (!(dest instanceof ActiveNode)) return;
ActiveNode node = (ActiveNode)dest;
JPopupMenu menu = pluginManager.getChildMenu(node, this);
List actions = node.getActions();
if ((menu==null) && ((actions==null) || (actions.size()==0)))
return; // this component does not have any declared potential children, and no actions
// If there are actions, but no children, new menu
if (menu==null) menu = new JPopupMenu();
// Otherwise, add separator if needed
else if ((actions!=null) && (actions.size()>0)) menu.add(new JPopupMenu.Separator(), 0);
// Now add actions on top of menu, keeping order
if (actions!=null)
for (int i=actions.size()-1; i>=0; --i) {
Object a = actions.get(i);
if (a!=null) menu.add(new ActionMenuItem(node, a), 0);
}
// Finally popup the result
menu.show((JComponent)e.getSource(), e.getX(), e.getY());
} else if (e.getClickCount()==2 && (e.getModifiers()&MouseEvent.BUTTON1_MASK)==MouseEvent.BUTTON1_MASK){
Object dest = null;
TreePath path = sceneTree.getPathForLocation(e.getX(), e.getY());
if (path != null) sceneTree.setSelectionPath(path);
if (sceneTree.getSelectionPath() != null) {
dest = sceneTree.getSelectionPath().getLastPathComponent();
}
if (dest==null) dest = ((SceneGraphModel)sceneTree.getModel()).getRoot();
if (!(dest instanceof ActiveNode)) return;
ActiveNode node = (ActiveNode)dest;
pluginManager.showProperties(node, this);
}
}