void (@NotNull AnActionEvent e, @NotNull XDebuggerTree tree, @NotNull XWatchesView watchesView) { XDebuggerTreeNode root = tree.getRoot(); for (XValueNodeImpl node : getSelectedNodes(tree, XValueNodeImpl.class)) { int index = node instanceof WatchNode ? root.getIndex(node) + 1 : -1; node.calculateEvaluationExpression().onSuccess(expr -> { XExpression watchExpression = expr != null ? expr : XExpressionImpl.fromText(node.getName()); if (watchExpression != null) { DebuggerUIUtil.invokeLater(() -> watchesView.addWatchExpression(watchExpression, index, true)); } }); } }