mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup
This commit is contained in:
+2
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -58,12 +58,7 @@ public class XDebuggerInstanceTreeCreator implements DebuggerTreeCreator<Pair<XI
|
||||
final XValueNodeImpl root = new XValueNodeImpl(tree, null, descriptor.getSecond(),
|
||||
new InstanceEvaluatorTreeRootValue(descriptor.getFirst(), descriptor.getSecond()));
|
||||
tree.setRoot(root, false);
|
||||
Condition<TreeNode> visibleRootCondition = new Condition<TreeNode>() {
|
||||
@Override
|
||||
public boolean value(TreeNode node) {
|
||||
return node.getParent() == root;
|
||||
}
|
||||
};
|
||||
Condition<TreeNode> visibleRootCondition = node -> node.getParent() == root;
|
||||
tree.expandNodesOnLoad(visibleRootCondition);
|
||||
tree.selectNodeOnLoad(visibleRootCondition);
|
||||
|
||||
|
||||
+2
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -17,7 +17,6 @@ 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.Pair;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
@@ -30,8 +29,6 @@ import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.tree.TreeNode;
|
||||
|
||||
public class XDebuggerTreeCreator implements DebuggerTreeCreator<Pair<XValue,String>> {
|
||||
@NotNull private final Project myProject;
|
||||
private final XDebuggerEditorsProvider myProvider;
|
||||
@@ -54,12 +51,7 @@ public class XDebuggerTreeCreator implements DebuggerTreeCreator<Pair<XValue,Str
|
||||
tree.setRoot(root, true);
|
||||
tree.setSelectionRow(0);
|
||||
// expand root on load
|
||||
tree.expandNodesOnLoad(new Condition<TreeNode>() {
|
||||
@Override
|
||||
public boolean value(TreeNode node) {
|
||||
return node == root;
|
||||
}
|
||||
});
|
||||
tree.expandNodesOnLoad(node -> node == root);
|
||||
return tree;
|
||||
}
|
||||
|
||||
|
||||
+10
-12
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -386,22 +386,20 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget,
|
||||
public void removeWatches(List<? extends XDebuggerTreeNode> nodes) {
|
||||
List<? extends WatchNode> children = myRootNode.getWatchChildren();
|
||||
int minIndex = Integer.MAX_VALUE;
|
||||
List<XDebuggerTreeNode> toRemove = new ArrayList<XDebuggerTreeNode>();
|
||||
if (children != null) {
|
||||
for (XDebuggerTreeNode node : nodes) {
|
||||
@SuppressWarnings("SuspiciousMethodCalls")
|
||||
int index = children.indexOf(node);
|
||||
if (index != -1) {
|
||||
toRemove.add(node);
|
||||
minIndex = Math.min(minIndex, index);
|
||||
}
|
||||
List<XDebuggerTreeNode> toRemove = new ArrayList<>();
|
||||
for (XDebuggerTreeNode node : nodes) {
|
||||
@SuppressWarnings("SuspiciousMethodCalls")
|
||||
int index = children.indexOf(node);
|
||||
if (index != -1) {
|
||||
toRemove.add(node);
|
||||
minIndex = Math.min(minIndex, index);
|
||||
}
|
||||
}
|
||||
myRootNode.removeChildren(toRemove);
|
||||
|
||||
List<? extends WatchNode> newChildren = myRootNode.getWatchChildren();
|
||||
if (newChildren != null && !newChildren.isEmpty()) {
|
||||
WatchNode node = minIndex < newChildren.size() ? newChildren.get(minIndex) : newChildren.get(newChildren.size() - 1);
|
||||
if (!newChildren.isEmpty()) {
|
||||
WatchNode node = newChildren.get(Math.min(minIndex, newChildren.size() - 1));
|
||||
TreeUtil.selectNode(getTree(), node);
|
||||
}
|
||||
updateSessionData();
|
||||
|
||||
@@ -364,12 +364,7 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa
|
||||
|
||||
private static void markNodesObsolete(final XValueContainerNode<?> node) {
|
||||
node.setObsolete();
|
||||
List<? extends XValueContainerNode<?>> loadedChildren = node.getLoadedChildren();
|
||||
if (loadedChildren != null) {
|
||||
for (XValueContainerNode<?> child : loadedChildren) {
|
||||
markNodesObsolete(child);
|
||||
}
|
||||
}
|
||||
node.getLoadedChildren().forEach(XDebuggerTree::markNodesObsolete);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+3
-8
@@ -36,8 +36,8 @@ import java.util.Map;
|
||||
public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelectionListener {
|
||||
private final XDebuggerTree myTree;
|
||||
private final Rectangle myLastVisibleNodeRect;
|
||||
private final Map<XDebuggerTreeNode, XDebuggerTreeState.NodeInfo> myNode2State = new HashMap<XDebuggerTreeNode, XDebuggerTreeState.NodeInfo>();
|
||||
private final Map<RestorableStateNode, XDebuggerTreeState.NodeInfo> myNode2ParentState = new HashMap<RestorableStateNode, XDebuggerTreeState.NodeInfo>();
|
||||
private final Map<XDebuggerTreeNode, XDebuggerTreeState.NodeInfo> myNode2State = new HashMap<>();
|
||||
private final Map<RestorableStateNode, XDebuggerTreeState.NodeInfo> myNode2ParentState = new HashMap<>();
|
||||
private boolean myStopRestoringSelection;
|
||||
private boolean myInsideRestoring;
|
||||
|
||||
@@ -51,12 +51,7 @@ public class XDebuggerTreeRestorer implements XDebuggerTreeListener, TreeSelecti
|
||||
private void restoreChildren(final XDebuggerTreeNode treeNode, final XDebuggerTreeState.NodeInfo nodeInfo) {
|
||||
if (nodeInfo.isExpanded()) {
|
||||
myTree.expandPath(treeNode.getPath());
|
||||
List<? extends XDebuggerTreeNode> children = treeNode.getLoadedChildren();
|
||||
if (children != null) {
|
||||
for (XDebuggerTreeNode child : children) {
|
||||
restoreNode(child, nodeInfo);
|
||||
}
|
||||
}
|
||||
treeNode.getLoadedChildren().forEach(child -> restoreNode(child, nodeInfo));
|
||||
myNode2State.put(treeNode, nodeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
+15
-17
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -61,24 +61,22 @@ public class XDebuggerTreeState {
|
||||
private void addChildren(final XDebuggerTree tree, final NodeInfo nodeInfo, final XDebuggerTreeNode treeNode) {
|
||||
if (tree.isExpanded(treeNode.getPath())) {
|
||||
List<? extends XDebuggerTreeNode> children = treeNode.getLoadedChildren();
|
||||
if (children != null) {
|
||||
nodeInfo.myExpanded = true;
|
||||
for (XDebuggerTreeNode child : children) {
|
||||
final TreePath path = child.getPath();
|
||||
final Rectangle bounds = tree.getPathBounds(path);
|
||||
if (bounds != null) {
|
||||
Rectangle treeVisibleRect =
|
||||
tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewRect() : tree.getVisibleRect();
|
||||
if (treeVisibleRect.contains(bounds)) {
|
||||
myLastVisibleNodeRect = bounds;
|
||||
}
|
||||
}
|
||||
NodeInfo childInfo = createNode(child, tree.isPathSelected(path));
|
||||
if (childInfo != null) {
|
||||
nodeInfo.addChild(childInfo);
|
||||
addChildren(tree, childInfo, child);
|
||||
nodeInfo.myExpanded = true;
|
||||
for (XDebuggerTreeNode child : children) {
|
||||
TreePath path = child.getPath();
|
||||
Rectangle bounds = tree.getPathBounds(path);
|
||||
if (bounds != null) {
|
||||
Rectangle treeVisibleRect =
|
||||
tree.getParent() instanceof JViewport ? ((JViewport)tree.getParent()).getViewRect() : tree.getVisibleRect();
|
||||
if (treeVisibleRect.contains(bounds)) {
|
||||
myLastVisibleNodeRect = bounds;
|
||||
}
|
||||
}
|
||||
NodeInfo childInfo = createNode(child, tree.isPathSelected(path));
|
||||
if (childInfo != null) {
|
||||
nodeInfo.addChild(childInfo);
|
||||
addChildren(tree, childInfo, child);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -84,9 +84,10 @@ public class MessageTreeNode extends XDebuggerTreeNode {
|
||||
return myLink;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends XDebuggerTreeNode> getLoadedChildren() {
|
||||
return null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+12
-23
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.xdebugger.impl.ui.tree.nodes;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.tree.TreeUtil;
|
||||
import com.intellij.xdebugger.Obsolescent;
|
||||
@@ -91,11 +90,10 @@ public class WatchesRootNode extends XValueContainerNode<XValueContainer> {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends XValueContainerNode<?>> getLoadedChildren() {
|
||||
List<? extends XValueContainerNode<?>> empty = Collections.<XValueGroupNodeImpl>emptyList();
|
||||
return ContainerUtil.concat(myChildren, ObjectUtils.notNull(super.getLoadedChildren(), empty));
|
||||
return ContainerUtil.concat(myChildren, super.getLoadedChildren());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -232,33 +230,24 @@ public class WatchesRootNode extends XValueContainerNode<XValueContainer> {
|
||||
|
||||
@Override
|
||||
public void evaluated(@NotNull final XValue result) {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WatchesRootNode root = (WatchesRootNode)myResultPlace.getParent();
|
||||
root.replaceNode(myResultPlace, new WatchNodeImpl(root.myTree, root, result, myResultPlace.getExpression()));
|
||||
}
|
||||
DebuggerUIUtil.invokeLater(() -> {
|
||||
WatchesRootNode root = (WatchesRootNode)myResultPlace.getParent();
|
||||
root.replaceNode(myResultPlace, new WatchNodeImpl(root.myTree, root, result, myResultPlace.getExpression()));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void errorOccurred(@NotNull final String errorMessage) {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WatchesRootNode root = (WatchesRootNode)myResultPlace.getParent();
|
||||
root.replaceNode(myResultPlace, createErrorNode(root.myTree, root, myResultPlace.getExpression(), errorMessage));
|
||||
}
|
||||
DebuggerUIUtil.invokeLater(() -> {
|
||||
WatchesRootNode root = (WatchesRootNode)myResultPlace.getParent();
|
||||
root.replaceNode(myResultPlace, createErrorNode(root.myTree, root, myResultPlace.getExpression(), errorMessage));
|
||||
});
|
||||
}
|
||||
|
||||
public void noSession() {
|
||||
DebuggerUIUtil.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
WatchesRootNode root = (WatchesRootNode)myResultPlace.getParent();
|
||||
root.replaceNode(myResultPlace, createMessageNode(root.myTree, root, myResultPlace.getExpression()));
|
||||
}
|
||||
DebuggerUIUtil.invokeLater(() -> {
|
||||
WatchesRootNode root = (WatchesRootNode)myResultPlace.getParent();
|
||||
root.replaceNode(myResultPlace, createMessageNode(root.myTree, root, myResultPlace.getExpression()));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -175,7 +175,7 @@ public abstract class XDebuggerTreeNode implements TreeNode, TreeSpeedSearch.Pat
|
||||
return myPath;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public abstract List<? extends XDebuggerTreeNode> getLoadedChildren();
|
||||
|
||||
public abstract void clearChildren();
|
||||
|
||||
+1
-1
@@ -234,7 +234,7 @@ public abstract class XValueContainerNode<ValueContainer extends XValueContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
@NotNull
|
||||
public List<? extends XValueContainerNode<?>> getLoadedChildren() {
|
||||
List<? extends XValueContainerNode<?>> empty = Collections.<XValueGroupNodeImpl>emptyList();
|
||||
return ContainerUtil.concat(ObjectUtils.notNull(myTopGroups, empty),
|
||||
|
||||
Reference in New Issue
Block a user