Search in sources :

Example 1 with UnfollowThreadAction

use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowThreadAction in project tracecompass by tracecompass.

the class ResourcesView method fillTimeEventContextMenu.

@Override
protected void fillTimeEventContextMenu(@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 (sSel.toArray()[1] instanceof NamedTimeEvent && ((ResourcesEntryModel) model).getType() == Type.CURRENT_THREAD) {
                ITmfTrace trace = getTrace(resourcesEntry);
                NamedTimeEvent event = (NamedTimeEvent) sSel.toArray()[1];
                TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
                HostThread data = (HostThread) ctx.getData(HostThread.SELECTED_HOST_THREAD_KEY);
                if (data != null) {
                    menuManager.add(new UnfollowThreadAction(ResourcesView.this));
                } else {
                    menuManager.add(new FollowThreadAction(ResourcesView.this, null, event.getValue(), trace));
                }
            }
        }
    }
    super.fillTimeEventContextMenu(menuManager);
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) HostThread(org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread) ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) TmfTraceContext(org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext) FollowThreadAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction) ISelection(org.eclipse.jface.viewers.ISelection) UnfollowThreadAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowThreadAction) ResourcesEntryModel(org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) NamedTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent)

Aggregations

ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 HostThread (org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread)1 ResourcesEntryModel (org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel)1 FollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction)1 UnfollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowThreadAction)1 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)1 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)1 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)1 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)1 NamedTimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent)1 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)1