Search in sources :

Example 1 with HistFunction

use of org.eclipse.linuxtools.internal.gprof.view.histogram.HistFunction in project linuxtools by eclipse.

the class CallGraphContentProvider method hasChildren.

@Override
public boolean hasChildren(Object parentElement) {
    if (parentElement instanceof HistRoot) {
        HistRoot root = (HistRoot) parentElement;
        LinkedList<? extends TreeElement> ret = getFunctionChildrenList(root);
        return !ret.isEmpty();
    }
    if (parentElement instanceof HistFunction) {
        HistFunction function = (HistFunction) parentElement;
        CGCategory parents = function.getParentsFunctions();
        CGCategory children = function.getChildrenFunctions();
        return (parents != null || children != null);
    }
    if (parentElement instanceof CGCategory) {
        CGCategory cat = (CGCategory) parentElement;
        return !cat.getChildren().isEmpty();
    }
    return false;
}
Also used : CGCategory(org.eclipse.linuxtools.internal.gprof.view.histogram.CGCategory) HistFunction(org.eclipse.linuxtools.internal.gprof.view.histogram.HistFunction) HistRoot(org.eclipse.linuxtools.internal.gprof.view.histogram.HistRoot)

Example 2 with HistFunction

use of org.eclipse.linuxtools.internal.gprof.view.histogram.HistFunction in project linuxtools by eclipse.

the class CallGraphContentProvider method getChildren.

@Override
public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof HistRoot) {
        HistRoot root = (HistRoot) parentElement;
        LinkedList<? extends TreeElement> ret = getFunctionChildrenList(root);
        return ret.toArray();
    }
    if (parentElement instanceof HistFunction) {
        HistFunction function = (HistFunction) parentElement;
        CGCategory parents = function.getParentsFunctions();
        CGCategory children = function.getChildrenFunctions();
        if (parents == null) {
            if (children == null)
                return new Object[0];
            return new Object[] { children };
        } else if (children == null) {
            return new Object[] { parents };
        } else {
            return new Object[] { parents, children };
        }
    }
    if (parentElement instanceof CGCategory) {
        CGCategory cat = (CGCategory) parentElement;
        return cat.getChildren().toArray();
    }
    return null;
}
Also used : CGCategory(org.eclipse.linuxtools.internal.gprof.view.histogram.CGCategory) HistFunction(org.eclipse.linuxtools.internal.gprof.view.histogram.HistFunction) HistRoot(org.eclipse.linuxtools.internal.gprof.view.histogram.HistRoot)

Aggregations

CGCategory (org.eclipse.linuxtools.internal.gprof.view.histogram.CGCategory)2 HistFunction (org.eclipse.linuxtools.internal.gprof.view.histogram.HistFunction)2 HistRoot (org.eclipse.linuxtools.internal.gprof.view.histogram.HistRoot)2