Skip to content

Commit 613c704

Browse files
committed
Prevent Watch Expression creation for empty snippets
Avoid adding Watch Expressions when the input snippet is empty. This prevents unnecessary entries from appearing in the Expressions view and improves overall usability.
1 parent 77be489 commit 613c704

File tree

1 file changed

+4
-1
lines changed
  • org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions

1 file changed

+4
-1
lines changed

org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/WatchAction.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2012 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -54,6 +54,9 @@ public void run() {
5454
}
5555

5656
private void createWatchExpression(String snippet) {
57+
if (snippet.isEmpty()) {
58+
return;
59+
}
5760
IWatchExpression expression= DebugPlugin.getDefault().getExpressionManager().newWatchExpression(snippet);
5861
DebugPlugin.getDefault().getExpressionManager().addExpression(expression);
5962
IAdaptable object = DebugUITools.getDebugContext();

0 commit comments

Comments
 (0)