@Override public void update(final AnActionEvent e) { XDebuggerTree tree = XDebuggerTree.getTree(e); e.getPresentation() .setVisible(tree != null && getSelectedNodes(tree, WatchNode.class).size() == 1); super.update(e); }
@Nullable public static XValueNodeImpl getSelectedNode(final DataContext dataContext) { XDebuggerTree tree = XDebuggerTree.getTree(dataContext); if (tree == null) return null; TreePath path = tree.getSelectionPath(); if (path == null) return null; Object node = path.getLastPathComponent(); return node instanceof XValueNodeImpl ? (XValueNodeImpl) node : null; }
public void actionPerformed(final AnActionEvent e) { XDebuggerTree tree = XDebuggerTree.getTree(e); if (tree == null) return; List<? extends WatchNode> watchNodes = getSelectedNodes(tree, WatchNode.class); if (watchNodes.size() != 1) return; WatchNode node = watchNodes.get(0); XDebuggerTreeNode root = tree.getRoot(); if (root instanceof WatchesRootNode) { ((WatchesRootNode) root).editWatch(node); } }