always select the result node on evaluate - fix for IDEA-CR-28582

This commit is contained in:
Egor Ushakov
2018-01-18 12:11:15 +03:00
parent ad34f98b9c
commit 25eddf9011
@@ -1,6 +1,4 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.xdebugger.impl.evaluate;
import com.intellij.codeInsight.lookup.LookupManager;
@@ -10,7 +8,6 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.WindowManager;
@@ -137,7 +134,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_DOWN_MASK)), getRootPane(),
myDisposable);
myTreePanel.getTree().expandNodesOnLoad(getFirstChildCondition());
myTreePanel.getTree().expandNodesOnLoad(XDebuggerEvaluationDialog::isFirstChild);
EvaluationMode mode = XDebuggerSettingManagerImpl.getInstanceImpl().getGeneralSettings().getEvaluationDialogMode();
if (mode == EvaluationMode.CODE_FRAGMENT && !myIsCodeFragmentEvaluationSupported) {
@@ -305,7 +302,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
final XDebuggerTree tree = myTreePanel.getTree();
tree.markNodesObsolete();
tree.setRoot(new EvaluatingExpressionRootNode(this, tree), false);
tree.selectNodeOnLoad(getFirstChildCondition());
tree.selectNodeOnLoad(XDebuggerEvaluationDialog::isFirstChild);
myResultPanel.invalidate();
@@ -322,8 +319,8 @@ public class XDebuggerEvaluationDialog extends DialogWrapper {
}
}
private static Condition<TreeNode> getFirstChildCondition() {
return node -> node.getParent() instanceof EvaluatingExpressionRootNode;
private static boolean isFirstChild(TreeNode node) {
return node.getParent() instanceof EvaluatingExpressionRootNode;
}
@Override