use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowCpuAction in project tracecompass by tracecompass.
the class ResourcesView method fillTimeGraphEntryContextMenu.
/**
* @since 2.0
*/
@Override
protected void fillTimeGraphEntryContextMenu(@NonNull IMenuManager menuManager) {
ISelection selection = getSite().getSelectionProvider().getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection sSel = (IStructuredSelection) selection;
if (sSel.getFirstElement() instanceof TimeGraphEntry) {
TimeGraphEntry resourcesEntry = (TimeGraphEntry) sSel.getFirstElement();
ITmfTreeDataModel model = resourcesEntry.getEntryModel();
if (model instanceof ResourcesEntryModel) {
ResourcesEntryModel resourcesModel = (ResourcesEntryModel) model;
Type type = resourcesModel.getType();
if (type == Type.CPU || type == Type.CURRENT_THREAD) {
ITmfTrace trace = getTrace(resourcesEntry);
TmfTraceContext ctx = TmfTraceManager.getInstance().getTraceContext(trace);
Integer data = (Integer) ctx.getData(RESOURCES_FOLLOW_CPU);
int cpu = data != null ? data.intValue() : -1;
if (cpu >= 0) {
menuManager.add(new UnfollowCpuAction(ResourcesView.this, resourcesModel.getResourceId(), trace));
} else {
menuManager.add(new FollowCpuAction(ResourcesView.this, resourcesModel.getResourceId(), trace));
}
}
}
}
}
}
Aggregations