use of org.eclipse.linuxtools.internal.gprof.view.histogram.CGCategory 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;
}
use of org.eclipse.linuxtools.internal.gprof.view.histogram.CGCategory in project linuxtools by eclipse.
the class GmonView method getBackground.
/*
* I do not know where to put this static method. It is used by all ProfFields
*/
public static Color getBackground(Object element) {
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
// FIXME: Not sure if color1-color4 are ever used...picked colors found in JFacesResources ColorRegistry
// not tied to any particular language (e.g. didn't choose CDT or Java colors)
// Color5 seems to work ok as bg in the one dark theme I tried (Nissl-Adwaita-dark-4) and as well
// in default light adwaita, but it is much simpler to just return null and let the table color default
// appropriately.
// $NON-NLS-1$
Color color1 = colorRegistry.get("org.eclipse.ui.editors.currentLineColor");
// $NON-NLS-1$
Color color2 = colorRegistry.get("org.eclipse.ui.workbench.INACTIVE_TAB_BG_START");
// $NON-NLS-1$
Color color3 = colorRegistry.get("org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END");
// $NON-NLS-1$
Color color4 = colorRegistry.get("org.eclipse.ui.workbench.ACTIVE_TAB_BG_END");
if (element instanceof CGCategory) {
CGCategory cat = (CGCategory) element;
if (CGCategory.CHILDREN.equals(cat.category)) {
return color1 == null ? BLUE1 : color1;
} else {
return color2 == null ? GREEN1 : color2;
}
} else if (element instanceof CGArc) {
CGArc arc = (CGArc) element;
CGCategory cat = (CGCategory) arc.getParent();
if (CGCategory.CHILDREN.equals(cat.category)) {
return color3 == null ? BLUE2 : color3;
} else {
return color4 == null ? GREEN2 : color4;
}
}
// default background
return null;
// return color5 == null ? DEFAULT_BG : color5;
}
use of org.eclipse.linuxtools.internal.gprof.view.histogram.CGCategory 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;
}
Aggregations