Search in sources :

Example 6 with XDebuggerTreeNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode in project intellij-community by JetBrains.

the class IdeFrameFixture method verifyVariablesAtBreakpoint.

public boolean verifyVariablesAtBreakpoint(String[] expectedVariablePatterns, String debugConfigName, long tryUntilMillis) {
    DebugToolWindowFixture debugToolWindowFixture = new DebugToolWindowFixture(this);
    final ExecutionToolWindowFixture.ContentFixture contentFixture = debugToolWindowFixture.findContent(debugConfigName);
    contentFixture.clickDebuggerTreeRoot();
    // Wait for the debugger tree to appear.
    pause(new Condition("Looking for debugger tree.") {

        @Override
        public boolean test() {
            return contentFixture.getDebuggerTreeRoot() != null;
        }
    }, Timeout.timeout(tryUntilMillis));
    // Get the debugger tree and print it.
    XDebuggerTreeNode debuggerTreeRoot = contentFixture.getDebuggerTreeRoot();
    if (debuggerTreeRoot == null) {
        return false;
    }
    List<String> unmatchedPatterns = getUnmatchedTerminalVariableValues(expectedVariablePatterns, debuggerTreeRoot);
    return unmatchedPatterns.isEmpty();
}
Also used : Condition(org.fest.swing.timing.Condition) XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)

Example 7 with XDebuggerTreeNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode in project intellij-community by JetBrains.

the class XDebuggerTreeRestorer method childrenLoaded.

@Override
public void childrenLoaded(@NotNull final XDebuggerTreeNode node, @NotNull final List<XValueContainerNode<?>> children, final boolean last) {
    XDebuggerTreeState.NodeInfo nodeInfo = myNode2State.get(node);
    if (nodeInfo != null) {
        for (XDebuggerTreeNode child : children) {
            restoreNode(child, nodeInfo);
        }
    }
    if (last) {
        myNode2State.remove(node);
        disposeIfFinished();
    }
}
Also used : XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)

Example 8 with XDebuggerTreeNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode in project intellij-community by JetBrains.

the class XDebuggerTreeSpeedSearch method findPath.

private Object findPath(String string, XDebuggerTreeNode node, boolean checkChildren) {
    TreePath path = node.getPath();
    if (isMatchingElement(path, string)) {
        return path;
    }
    XDebuggerTreeNode parent = ObjectUtils.tryCast(node.getParent(), XDebuggerTreeNode.class);
    int nodeIndex;
    List<? extends TreeNode> parentChildren;
    if (parent != null) {
        parentChildren = parent.getChildren();
        nodeIndex = parentChildren.indexOf(node);
        if (nodeIndex != -1) {
            for (int i = nodeIndex + 1; i < parentChildren.size(); i++) {
                TreePath result = match(parentChildren.get(i), string);
                if (result != null) {
                    return result;
                }
            }
            for (int i = nodeIndex - 1; i >= 0; i--) {
                TreePath result = match(parentChildren.get(i), string);
                if (result != null) {
                    return result;
                }
            }
        }
    } else {
        nodeIndex = -1;
        parentChildren = null;
    }
    // check children up to x level
    if (checkChildren && !node.isLeaf()) {
        TreePath result = findInChildren(node, string);
        if (result != null) {
            return result;
        }
    }
    // check siblings children up to x level
    if (parent != null) {
        for (int i = nodeIndex + 1; i < parentChildren.size(); i++) {
            TreePath result = findInChildren(parentChildren.get(i), string);
            if (result != null) {
                return result;
            }
        }
        for (int i = nodeIndex - 1; i >= 0; i--) {
            TreePath result = findInChildren(parentChildren.get(i), string);
            if (result != null) {
                return result;
            }
        }
        return findPath(string, parent, false);
    }
    //myComponent.getSelectionPath()
    return null;
}
Also used : TreePath(javax.swing.tree.TreePath) XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)

Example 9 with XDebuggerTreeNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode in project intellij-community by JetBrains.

the class XDebuggerTreeSpeedSearch method findInChildren.

private TreePath findInChildren(TreeNode node, String string) {
    if (node.isLeaf() || !(node instanceof XDebuggerTreeNode)) {
        return null;
    }
    LinkedList<XDebuggerTreeNode> queue = new LinkedList<>();
    queue.addLast((XDebuggerTreeNode) node);
    int initialLevel = ((XDebuggerTreeNode) node).getPath().getPathCount();
    while (!queue.isEmpty()) {
        XDebuggerTreeNode p = queue.removeFirst();
        if ((p.getPath().getPathCount() - initialLevel) > 3) {
            return null;
        }
        List<? extends TreeNode> children = p.getChildren();
        if (children.isEmpty()) {
            continue;
        }
        for (TreeNode child : children) {
            if (!(child instanceof XDebuggerTreeNode)) {
                continue;
            }
            TreePath result = match(child, string);
            if (result != null) {
                return result;
            }
            if (!child.isLeaf()) {
                queue.addLast((XDebuggerTreeNode) child);
            }
        }
    }
    return null;
}
Also used : TreePath(javax.swing.tree.TreePath) TreeNode(javax.swing.tree.TreeNode) XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode) XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode) LinkedList(java.util.LinkedList)

Example 10 with XDebuggerTreeNode

use of com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode in project intellij-community by JetBrains.

the class XEditWatchAction method perform.

@Override
protected void perform(@NotNull AnActionEvent e, @NotNull XDebuggerTree tree, @NotNull XWatchesView watchesView) {
    List<? extends WatchNodeImpl> watchNodes = getSelectedNodes(tree, WatchNodeImpl.class);
    if (watchNodes.size() != 1)
        return;
    WatchNodeImpl node = watchNodes.get(0);
    XDebuggerTreeNode root = tree.getRoot();
    if (root instanceof WatchesRootNode) {
        ((WatchesRootNode) root).editWatch(node);
    }
}
Also used : WatchNodeImpl(com.intellij.xdebugger.impl.ui.tree.nodes.WatchNodeImpl) WatchesRootNode(com.intellij.xdebugger.impl.ui.tree.nodes.WatchesRootNode) XDebuggerTreeNode(com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)

Aggregations

XDebuggerTreeNode (com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode)14 TreePath (javax.swing.tree.TreePath)4 TreeNode (javax.swing.tree.TreeNode)3 Pair (com.intellij.openapi.util.Pair)2 WatchesRootNode (com.intellij.xdebugger.impl.ui.tree.nodes.WatchesRootNode)2 NotNull (org.jetbrains.annotations.NotNull)2 DebugToolWindowFixture (com.android.tools.idea.tests.gui.framework.fixture.DebugToolWindowFixture)1 ExecutionToolWindowFixture (com.android.tools.idea.tests.gui.framework.fixture.ExecutionToolWindowFixture)1 JavaValue (com.intellij.debugger.engine.JavaValue)1 TextWithImports (com.intellij.debugger.engine.evaluation.TextWithImports)1 ValueDescriptorImpl (com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl)1 WatchNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.WatchNodeImpl)1 XValueNodeImpl (com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl)1 LinkedList (java.util.LinkedList)1 BasicTreeUI (javax.swing.plaf.basic.BasicTreeUI)1 Assert.assertNotNull (junit.framework.Assert.assertNotNull)1 Condition (org.fest.swing.timing.Condition)1 Nullable (org.jetbrains.annotations.Nullable)1