Search in sources :

Example 26 with DebuggerTreeNodeImpl

use of com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl in project android by JetBrains.

the class InstancesTreeView method sortTree.

private void sortTree(@NotNull DebuggerTreeNodeImpl node) {
    if (myComparator == null) {
        return;
    }
    // We don't want to accidentally build children, so we have to get the raw children instead.
    Enumeration e = node.rawChildren();
    if (e.hasMoreElements()) {
        //noinspection unchecked
        ArrayList<DebuggerTreeNodeImpl> builtChildren = Collections.list(e);
        // First check if there's an expansion node. Remove if there is, and add it back at the end.
        DebuggerTreeNodeImpl expansionNode = builtChildren.get(builtChildren.size() - 1);
        if (expansionNode.getDescriptor() instanceof ExpansionDescriptorImpl) {
            builtChildren.remove(builtChildren.size() - 1);
        } else {
            expansionNode = null;
        }
        Collections.sort(builtChildren, myComparator);
        // Remove children after sorting, since the sort may depend on the parent information.
        node.removeAllChildren();
        for (DebuggerTreeNodeImpl childNode : builtChildren) {
            node.add(childNode);
            sortTree(childNode);
        }
        if (expansionNode != null) {
            node.add(expansionNode);
        }
    }
}
Also used : DebuggerTreeNodeImpl(com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)

Aggregations

DebuggerTreeNodeImpl (com.intellij.debugger.ui.impl.watch.DebuggerTreeNodeImpl)26 DebuggerContextImpl (com.intellij.debugger.impl.DebuggerContextImpl)11 NodeDescriptorImpl (com.intellij.debugger.ui.impl.watch.NodeDescriptorImpl)10 DebugProcessImpl (com.intellij.debugger.engine.DebugProcessImpl)9 ThreadDescriptorImpl (com.intellij.debugger.ui.impl.watch.ThreadDescriptorImpl)7 ValueDescriptor (com.intellij.debugger.ui.tree.ValueDescriptor)6 Nullable (org.jetbrains.annotations.Nullable)6 DebuggerContextCommandImpl (com.intellij.debugger.engine.events.DebuggerContextCommandImpl)5 Project (com.intellij.openapi.project.Project)5 SourcePosition (com.intellij.debugger.SourcePosition)4 DebuggerTree (com.intellij.debugger.ui.impl.watch.DebuggerTree)4 DebuggerCommandImpl (com.intellij.debugger.engine.events.DebuggerCommandImpl)3 ThreadReferenceProxyImpl (com.intellij.debugger.jdi.ThreadReferenceProxyImpl)3 Presentation (com.intellij.openapi.actionSystem.Presentation)3 SuspendContextImpl (com.intellij.debugger.engine.SuspendContextImpl)2 DebuggerSession (com.intellij.debugger.impl.DebuggerSession)2 FieldDescriptorImpl (com.intellij.debugger.ui.impl.watch.FieldDescriptorImpl)2 ValueDescriptorImpl (com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl)2 NodeDescriptor (com.intellij.debugger.ui.tree.NodeDescriptor)2 Document (com.intellij.openapi.editor.Document)2