}
// add a separator
menu.add(new Separator());
final AddNodeMenuFactory factory = new AddNodeMenuFactory();
final MenuManager subMenu = new MenuManager("Add", factory.getImageDescriptor("add.png"), "org.fusesource.ide.actions.add");
menu.add(subMenu);
subMenu.setRemoveAllWhenShown(true);
subMenu.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager manager) {
AbstractNode node = nodeViewer.getSelectedNode();
if (node == null) {
// lets choose the root container
node = editor.getModel();
}
boolean enabled = node != null;
subMenu.setVisible(enabled);
factory.fillMenu(editor, subMenu, node);
}
});
// add the delete item
if (node != null && node instanceof Route == false) {
DeleteNodeAction deleteNodeAction = new DeleteNodeAction();