mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
show correctly evaluated watches in variables view - initial
This commit is contained in:
@@ -160,6 +160,7 @@ debugger.breakpoint.message.full.trace.description='Log message to console' brea
|
||||
for the thread that hit the breakpoint.
|
||||
debugger.batch.evaluation=false
|
||||
debugger.compiling.evaluator=false
|
||||
debugger.watches.in.variables=false
|
||||
|
||||
analyze.exceptions.on.the.fly=false
|
||||
analyze.exceptions.on.the.fly.description=Automatically analyze clipboard on frame activation,\
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.ui.AppUIUtil;
|
||||
@@ -971,6 +972,9 @@ public class XDebugSessionImpl implements XDebugSession {
|
||||
public void setWatchExpressions(@NotNull XExpression[] watchExpressions) {
|
||||
mySessionData.setWatchExpressions(watchExpressions);
|
||||
myDebuggerManager.getWatchesManager().setWatches(getWatchesKey(), watchExpressions);
|
||||
if (Registry.is("debugger.watches.in.variables")) {
|
||||
rebuildViews();
|
||||
}
|
||||
}
|
||||
|
||||
XExpression[] getWatchExpressions() {
|
||||
|
||||
+37
@@ -15,7 +15,16 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.ui.tree.nodes;
|
||||
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XExpression;
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import com.intellij.xdebugger.frame.XValue;
|
||||
import com.intellij.xdebugger.frame.XValueChildrenList;
|
||||
import com.intellij.xdebugger.impl.XDebugSessionImpl;
|
||||
import com.intellij.xdebugger.impl.frame.XDebugView;
|
||||
import com.intellij.xdebugger.impl.ui.XDebugSessionData;
|
||||
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -27,4 +36,32 @@ public class XStackFrameNode extends XValueContainerNode<XStackFrame> {
|
||||
super(tree, null, xStackFrame);
|
||||
setLeaf(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startComputingChildren() {
|
||||
if (Registry.is("debugger.watches.in.variables")) {
|
||||
XDebugSession session = XDebugView.getSession(getTree());
|
||||
XDebuggerEvaluator evaluator = getValueContainer().getEvaluator();
|
||||
if (session != null && evaluator != null) {
|
||||
XDebugSessionData data = ((XDebugSessionImpl)session).getSessionData();
|
||||
XExpression[] expressions = data.getWatchExpressions();
|
||||
for (final XExpression expression : expressions) {
|
||||
evaluator.evaluate(expression, new XDebuggerEvaluator.XEvaluationCallback() {
|
||||
@Override
|
||||
public void evaluated(@NotNull XValue result) {
|
||||
XValueChildrenList watches = new XValueChildrenList();
|
||||
watches.add(expression.getExpression(), result);
|
||||
addChildren(watches, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void errorOccurred(@NotNull String errorMessage) {
|
||||
// do not add anything
|
||||
}
|
||||
}, getValueContainer().getSourcePosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
super.startComputingChildren();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user