diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java index 4275ac6427da..b79531c65f28 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java @@ -8,6 +8,7 @@ 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.Conditions; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.openapi.wm.WindowManager; @@ -293,7 +294,7 @@ public class XDebuggerEvaluationDialog extends DialogWrapper { final XDebuggerTree tree = myTreePanel.getTree(); tree.markNodesObsolete(); tree.setRoot(new EvaluatingExpressionRootNode(this, tree), false); - tree.selectNodeOnLoad(XDebuggerEvaluationDialog::isFirstChild); + tree.selectNodeOnLoad(XDebuggerEvaluationDialog::isFirstChild, Conditions.alwaysFalse()); myResultPanel.invalidate(); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerInstanceTreeCreator.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerInstanceTreeCreator.java index 496e8ea983db..b775b71cecec 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerInstanceTreeCreator.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/quick/XDebuggerInstanceTreeCreator.java @@ -1,23 +1,10 @@ -/* - * Copyright 2000-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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.quick; import com.intellij.concurrency.ResultConsumer; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Condition; +import com.intellij.openapi.util.Conditions; import com.intellij.openapi.util.Pair; import com.intellij.ui.treeStructure.Tree; import com.intellij.xdebugger.XDebugSession; @@ -60,7 +47,7 @@ public class XDebuggerInstanceTreeCreator implements DebuggerTreeCreator visibleRootCondition = node -> node.getParent() == root; tree.expandNodesOnLoad(visibleRootCondition); - tree.selectNodeOnLoad(visibleRootCondition); + tree.selectNodeOnLoad(visibleRootCondition, Conditions.alwaysFalse()); return tree; } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java index 2e3030df4a96..9ae88a8a1adb 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java @@ -259,18 +259,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa if (node.isEllipsis()) { TreeNode parent = node.getParent(); if (parent instanceof XValueContainerNode) { - addTreeListener(new XDebuggerTreeListener() { - @Override - public void nodeLoaded(@NotNull RestorableStateNode node, String name) { - if (((XValueContainerNode)parent).isObsolete()) { - removeTreeListener(this); - } - if (node.getParent() == parent) { - setSelectionPath(node.getPath()); - removeTreeListener(this); // remove the listener on first match - } - } - }); + selectNodeOnLoad(n -> n.getParent() == parent, n -> ((XValueContainerNode)parent).isObsolete()); ((XValueContainerNode)parent).startComputingChildren(); return true; } @@ -413,10 +402,13 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa return myLaterInvocator; } - public void selectNodeOnLoad(final Condition nodeFilter) { + public void selectNodeOnLoad(Condition nodeFilter, Condition obsoleteChecker) { addTreeListener(new XDebuggerTreeListener() { @Override public void nodeLoaded(@NotNull RestorableStateNode node, String name) { + if (obsoleteChecker.value(node)) { + removeTreeListener(this); + } if (nodeFilter.value(node)) { setSelectionPath(node.getPath()); removeTreeListener(this); // remove the listener on first match