mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-204807 "Add to Watches" action shouldn't create duplicates
This commit is contained in:
+2
-1
@@ -10,6 +10,7 @@ import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl;
|
||||
import com.intellij.xdebugger.impl.frame.XWatchesViewImpl;
|
||||
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.concurrency.Promise;
|
||||
@@ -69,7 +70,7 @@ public class XAddToWatchesFromEditorActionHandler extends XDebuggerActionHandler
|
||||
UIUtil.invokeLaterIfNeeded(() -> {
|
||||
XDebugSessionTab tab = ((XDebugSessionImpl)session).getSessionTab();
|
||||
if (tab != null) {
|
||||
tab.getWatchesView().addWatchExpression(XExpressionImpl.fromText(text), -1, true);
|
||||
((XWatchesViewImpl)tab.getWatchesView()).addWatchExpression(XExpressionImpl.fromText(text), -1, true, true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+17
-2
@@ -207,10 +207,25 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
|
||||
|
||||
@Override
|
||||
public void addWatchExpression(@NotNull XExpression expression, int index, final boolean navigateToWatchNode) {
|
||||
addWatchExpression(expression, index, navigateToWatchNode, false);
|
||||
}
|
||||
|
||||
public void addWatchExpression(@NotNull XExpression expression, int index, final boolean navigateToWatchNode, boolean noDuplicates) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
XDebugSession session = getSession(getTree());
|
||||
myRootNode.addWatchExpression(session != null ? session.getCurrentStackFrame() : null, expression, index, navigateToWatchNode);
|
||||
updateSessionData();
|
||||
boolean found = false;
|
||||
if (noDuplicates) {
|
||||
for (WatchNode child : myRootNode.getWatchChildren()) {
|
||||
if (child.getExpression().equals(expression)) {
|
||||
TreeUtil.selectNode(getTree(), child);
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
myRootNode.addWatchExpression(session != null ? session.getCurrentStackFrame() : null, expression, index, navigateToWatchNode);
|
||||
updateSessionData();
|
||||
}
|
||||
if (navigateToWatchNode && session != null) {
|
||||
XDebugSessionTab.showWatchesView((XDebugSessionImpl)session);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user