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);
}
}
}
Aggregations