Search in sources :

Example 1 with FollowThreadAction

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

the class ControlFlowView method fillTimeGraphEntryContextMenu.

/**
 * @since 2.0
 */
@Override
protected void fillTimeGraphEntryContextMenu(@NonNull IMenuManager menuManager) {
    ISelection selection = getSite().getSelectionProvider().getSelection();
    if (selection instanceof StructuredSelection) {
        StructuredSelection sSel = (StructuredSelection) selection;
        if (sSel.getFirstElement() instanceof TimeGraphEntry) {
            TimeGraphEntry entry = (TimeGraphEntry) sSel.getFirstElement();
            ITmfTreeDataModel entryModel = entry.getEntryModel();
            if (entryModel instanceof ThreadEntryModel) {
                menuManager.add(new FollowThreadAction(ControlFlowView.this, entry.getName(), ((ThreadEntryModel) entryModel).getThreadId(), getTrace(entry)));
            }
        }
    }
}
Also used : ITmfTreeDataModel(org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel) FollowThreadAction(org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction) ISelection(org.eclipse.jface.viewers.ISelection) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) ThreadEntryModel(org.eclipse.tracecompass.internal.analysis.os.linux.core.threadstatus.ThreadEntryModel) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)

Example 2 with FollowThreadAction

use of org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction 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)2 FollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.FollowThreadAction)2 ITmfTreeDataModel (org.eclipse.tracecompass.tmf.core.model.tree.ITmfTreeDataModel)2 ITimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry)2 TimeGraphEntry (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)1 HostThread (org.eclipse.tracecompass.analysis.os.linux.core.model.HostThread)1 ResourcesEntryModel (org.eclipse.tracecompass.internal.analysis.os.linux.core.resourcesstatus.ResourcesEntryModel)1 ThreadEntryModel (org.eclipse.tracecompass.internal.analysis.os.linux.core.threadstatus.ThreadEntryModel)1 UnfollowThreadAction (org.eclipse.tracecompass.internal.analysis.os.linux.ui.actions.UnfollowThreadAction)1 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)1 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)1 NamedTimeEvent (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent)1