Search in sources :

Example 1 with HeapNode

use of com.android.tools.idea.editors.hprof.views.nodedata.HeapNode in project android by JetBrains.

the class ClassesTreeView method getTargetFiles.

@Nullable
private PsiClassNavigation[] getTargetFiles() {
    TreePath path = myTree.getSelectionPath();
    if (path.getPathCount() < 2) {
        return null;
    }
    assert path.getLastPathComponent() instanceof HeapNode;
    HeapNode node = (HeapNode) path.getLastPathComponent();
    if (node instanceof HeapClassObjNode) {
        ClassObj classObj = ((HeapClassObjNode) node).getClassObj();
        String className = classObj.getClassName();
        int arrayIndex = className.indexOf("[");
        if (arrayIndex >= 0) {
            className = className.substring(0, arrayIndex);
        }
        return PsiClassNavigation.getNavigationForClass(myProject, className);
    }
    return null;
}
Also used : ClassObj(com.android.tools.perflib.heap.ClassObj) HeapNode(com.android.tools.idea.editors.hprof.views.nodedata.HeapNode) TreePath(javax.swing.tree.TreePath) HeapClassObjNode(com.android.tools.idea.editors.hprof.views.nodedata.HeapClassObjNode) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with HeapNode

use of com.android.tools.idea.editors.hprof.views.nodedata.HeapNode in project android by JetBrains.

the class ClassesTreeView method sortTree.

private void sortTree(@NotNull HeapPackageNode parent) {
    if (parent.isLeaf() || myComparator == null) {
        return;
    }
    List<HeapNode> children = parent.getChildren();
    Collections.sort(children, myComparator);
    for (HeapNode child : children) {
        if (child instanceof HeapPackageNode) {
            sortTree((HeapPackageNode) child);
        }
    }
}
Also used : HeapNode(com.android.tools.idea.editors.hprof.views.nodedata.HeapNode) HeapPackageNode(com.android.tools.idea.editors.hprof.views.nodedata.HeapPackageNode)

Aggregations

HeapNode (com.android.tools.idea.editors.hprof.views.nodedata.HeapNode)2 HeapClassObjNode (com.android.tools.idea.editors.hprof.views.nodedata.HeapClassObjNode)1 HeapPackageNode (com.android.tools.idea.editors.hprof.views.nodedata.HeapPackageNode)1 ClassObj (com.android.tools.perflib.heap.ClassObj)1 TreePath (javax.swing.tree.TreePath)1 Nullable (org.jetbrains.annotations.Nullable)1