- void refreshNodeMenuItems() {
- connectMenu.removeAll();
- for (Action nodeConnectAction: swingInterface.getNodeConnectActions()) {
- connectMenu.add(nodeConnectAction);
- }
- if (connectMenu.getMenuComponentCount() == 0) {
- JMenuItem noNodeAvailableItem = new JMenuItem(I18n.get("mainWindow.menu.connectNoNodeAvailable.name"));
- noNodeAvailableItem.setEnabled(false);
- connectMenu.add(noNodeAvailableItem);
- }
- disconnectMenu.removeAll();
- for (Action nodeDisconnectAction: swingInterface.getNodeDisconnectActions()) {
- disconnectMenu.add(nodeDisconnectAction);
+ void addNode(Node node) {
+ JMenu newNodeMenu = new JMenu(node.getName());
+ nodeMenus.put(node, newNodeMenu);
+ newNodeMenu.add(swingInterface.getNodeConnectAction(node));
+ newNodeMenu.add(swingInterface.getNodeDisconnectAction(node));
+ newNodeMenu.addSeparator();
+ newNodeMenu.add(swingInterface.getNodeEditAction(node));
+ newNodeMenu.add(swingInterface.getNodeDeleteAction(node));
+ nodeMenu.add(newNodeMenu);
+ NodeLabel nodeLabel = new NodeLabel(swingInterface, node, onlineIcon, offlineIcon, errorIcon);
+ nodeLabels.put(node, nodeLabel);
+ statusBar.addSideComponent(nodeLabel);
+ for (int tabIndex = 0, tabCount = projectPane.getTabCount(); tabIndex < tabCount; tabIndex++) {
+ Component tabComponent = projectPane.getComponentAt(tabIndex);
+ if (!(tabComponent instanceof ProjectPanel)) {
+ continue;
+ }
+ ((ProjectPanel) tabComponent).addNode(node);