public void run() { if (getTree().isExpanded(t)) { expandedNodes.add(t.getLastPathComponent()); } else { expandedNodes.remove(t.getLastPathComponent()); } }
public void actionPerformed(ActionEvent event) { JTree tree = getTree(); TreePath path = tree.getSelectionPath(); if (path == null) { sheet.getLogger().warning("Warning: User must select a node to attach a new config to"); // XXX add a message telling users to select a node } else { createAttrConfigForNode((Node) path.getLastPathComponent()); } }
public void actionPerformed(ActionEvent event) { JTree tree = getTree(); TreePath path = tree.getSelectionPath(); if (path == null) { sheet.getLogger().warning("Warning: User must select a node to delete"); // XXX add message telling users to select a node } else { Node selected = (Node) path.getLastPathComponent(); try { Node parent = selected.getParent(); if (parent != null) { parent.removeChild(selected); select(parent); } } catch (UnsupportedOperationException uox) { sheet.getLogger().warning("Cannot delete node: " + selected); } } }
/** * Creates a new check for the Config in the path. * * @param t The path to the descriptor config to check. */ public CheckIfExpanded(TreePath t) { assert t.getLastPathComponent() instanceof Config; this.t = t; }