mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-152995 newly marked object is unavailable in any already opened "Evaluate code fragments" window
GitOrigin-RevId: 0a2d5973322451cea73adde2c154df54280c7fc8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c8cba92f81
commit
30cae884aa
+20
-1
@@ -72,6 +72,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
|
||||
private EvaluationMode myMode;
|
||||
private XSourcePosition mySourcePosition;
|
||||
private final SwitchModeAction mySwitchModeAction;
|
||||
private boolean myIsEvaluating = false;
|
||||
|
||||
/**
|
||||
* Use {@link XDebuggerEvaluationDialog#XDebuggerEvaluationDialog(XDebugSessionProxy, XDebuggerEditorsProvider, XExpression, XSourcePosition, boolean)} instead
|
||||
@@ -197,6 +198,22 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
|
||||
public void sessionPaused() {
|
||||
updateSourcePosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void settingsChanged() {
|
||||
if (myIsEvaluating) { // filter out rebuildViews after our own evaluation
|
||||
myIsEvaluating = false;
|
||||
return;
|
||||
}
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
XDebuggerEditorBase inputEditor = getInputEditor();
|
||||
// recreate document to support value marks update
|
||||
inputEditor.setExpression(inputEditor.getExpression());
|
||||
if (myTreePanel.getTree().getRoot() instanceof EvaluatingExpressionRootNode rootNode) {
|
||||
rootNode.rebuild();
|
||||
}
|
||||
});
|
||||
}
|
||||
}, myDisposable);
|
||||
}
|
||||
|
||||
@@ -393,7 +410,9 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
public void evaluationDone() {
|
||||
if (mySession != null) mySession.rebuildViews();
|
||||
if (mySession == null) return;
|
||||
myIsEvaluating = true;
|
||||
mySession.rebuildViews();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -365,6 +365,12 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
|
||||
if (event != SessionEvent.SETTINGS_CHANGED) {
|
||||
myRootNode.removeResultNode();
|
||||
}
|
||||
else {
|
||||
// recreate document to support value marks update
|
||||
if (myEvaluateComboBox != null) {
|
||||
myEvaluateComboBox.setExpression(myEvaluateComboBox.getExpression());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addExpressionResultNode() {
|
||||
|
||||
+27
-3
@@ -10,6 +10,8 @@ import com.intellij.xdebugger.frame.XValueContainer;
|
||||
import com.intellij.xdebugger.impl.evaluate.XDebuggerEvaluationDialog;
|
||||
import com.intellij.xdebugger.impl.evaluate.XEvaluationOrigin;
|
||||
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
|
||||
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTreeState;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class EvaluatingExpressionRootNode extends XValueContainerNode<EvaluatingExpressionRootNode.EvaluatingResultContainer> {
|
||||
@@ -22,8 +24,20 @@ public class EvaluatingExpressionRootNode extends XValueContainerNode<Evaluating
|
||||
return MessageTreeNode.createEvaluatingMessage(myTree, this);
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public void rebuild() {
|
||||
EvaluatingResultContainer valueContainer = getValueContainer();
|
||||
if (valueContainer.myResult != null) {
|
||||
XDebuggerTree tree = getTree();
|
||||
XDebuggerTreeState treeState = XDebuggerTreeState.saveState(tree);
|
||||
clearChildren();
|
||||
treeState.restoreState(tree);
|
||||
}
|
||||
}
|
||||
|
||||
public static class EvaluatingResultContainer extends XValueContainer {
|
||||
private final XDebuggerEvaluationDialog myDialog;
|
||||
private XValue myResult = null;
|
||||
|
||||
public EvaluatingResultContainer(final XDebuggerEvaluationDialog dialog) {
|
||||
myDialog = dialog;
|
||||
@@ -31,7 +45,17 @@ public class EvaluatingExpressionRootNode extends XValueContainerNode<Evaluating
|
||||
|
||||
@Override
|
||||
public void computeChildren(final @NotNull XCompositeNode node) {
|
||||
myDialog.startEvaluation(new MyEvaluationCallback(node));
|
||||
if (myResult != null) {
|
||||
addResult(node, myResult);
|
||||
}
|
||||
else {
|
||||
myDialog.startEvaluation(new MyEvaluationCallback(node));
|
||||
}
|
||||
}
|
||||
|
||||
private static void addResult(@NotNull XCompositeNode node, @NotNull XValue result) {
|
||||
String name = UIUtil.removeMnemonic(XDebuggerBundle.message("xdebugger.evaluate.result"));
|
||||
node.addChildren(XValueChildrenList.singleton(name, result), true);
|
||||
}
|
||||
|
||||
private class MyEvaluationCallback extends XEvaluationCallbackBase implements XEvaluationCallbackWithOrigin {
|
||||
@@ -46,8 +70,8 @@ public class EvaluatingExpressionRootNode extends XValueContainerNode<Evaluating
|
||||
|
||||
@Override
|
||||
public void evaluated(final @NotNull XValue result) {
|
||||
String name = UIUtil.removeMnemonic(XDebuggerBundle.message("xdebugger.evaluate.result"));
|
||||
myNode.addChildren(XValueChildrenList.singleton(name, result), true);
|
||||
myResult = result;
|
||||
addResult(myNode, result);
|
||||
myDialog.evaluationDone();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user