mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
extracted general utility method for IDEA-190451
This commit is contained in:
+2
-1
@@ -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();
|
||||
|
||||
|
||||
+3
-16
@@ -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<Pair<XI
|
||||
tree.setRoot(root, false);
|
||||
Condition<TreeNode> visibleRootCondition = node -> node.getParent() == root;
|
||||
tree.expandNodesOnLoad(visibleRootCondition);
|
||||
tree.selectNodeOnLoad(visibleRootCondition);
|
||||
tree.selectNodeOnLoad(visibleRootCondition, Conditions.alwaysFalse());
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
@@ -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<TreeNode> nodeFilter) {
|
||||
public void selectNodeOnLoad(Condition<TreeNode> nodeFilter, Condition<TreeNode> 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
|
||||
|
||||
Reference in New Issue
Block a user