Search in sources :

Example 1 with ITmfTraceEditor

use of org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor in project tracecompass by tracecompass.

the class TmfUml2SDSyncLoader method setViewer.

@Override
public void setViewer(SDView viewer) {
    fLock.lock();
    try {
        fView = viewer;
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
        fView.setSDFindProvider(this);
        fView.setSDPagingProvider(this);
        fView.setSDFilterProvider(this);
        resetLoader();
        IEditorPart editor = fView.getSite().getPage().getActiveEditor();
        if (editor instanceof ITmfTraceEditor) {
            ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
            if (trace != null) {
                traceSelected(new TmfTraceSelectedSignal(this, trace));
            }
        }
    } finally {
        fLock.unlock();
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal) IEditorPart(org.eclipse.ui.IEditorPart) ITmfTraceEditor(org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor)

Example 2 with ITmfTraceEditor

use of org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor in project tracecompass by tracecompass.

the class RefreshTraceContentHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IEditorPart activeEditor = HandlerUtil.getActiveEditorChecked(event);
    if (activeEditor instanceof ITmfTraceEditor) {
        ITmfTrace trace = ((ITmfTraceEditor) activeEditor).getTrace();
        refreshTrace(trace);
    }
    return null;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IEditorPart(org.eclipse.ui.IEditorPart) ITmfTraceEditor(org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor)

Example 3 with ITmfTraceEditor

use of org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor in project tracecompass by tracecompass.

the class FlameChartView method createPartControl.

// ------------------------------------------------------------------------
// ViewPart
// ------------------------------------------------------------------------
@Override
public void createPartControl(@Nullable Composite parent) {
    super.createPartControl(parent);
    getTimeGraphViewer().addTimeListener(event -> synchingToTime(event.getBeginTime()));
    getTimeGraphViewer().getTimeGraphControl().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(@Nullable MouseEvent event) {
            ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
            if (!(selection instanceof TimeGraphEntry)) {
                // also null checks
                return;
            }
            ITimeGraphState function = fFunctions.get(((TimeGraphEntry) selection).getEntryModel().getId());
            if (function != null) {
                long entryTime = function.getStartTime();
                long exitTime = entryTime + function.getDuration();
                TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(entryTime), TmfTimestamp.fromNanos(exitTime));
                broadcast(new TmfWindowRangeUpdatedSignal(FlameChartView.this, range, getTrace()));
                getTimeGraphViewer().setStartFinishTime(entryTime, exitTime);
                startZoomThread(entryTime, exitTime);
            }
        }
    });
    getTimeGraphViewer().getTimeGraphControl().addMouseListener(new MouseAdapter() {

        @Override
        public void mouseDoubleClick(@Nullable MouseEvent e) {
            TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl();
            ISelection selection = timeGraphControl.getSelection();
            if (selection instanceof IStructuredSelection) {
                for (Object object : ((IStructuredSelection) selection).toList()) {
                    if (object instanceof NamedTimeEvent) {
                        NamedTimeEvent event = (NamedTimeEvent) object;
                        long startTime = event.getTime();
                        long endTime = startTime + event.getDuration();
                        TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(startTime), TmfTimestamp.fromNanos(endTime));
                        broadcast(new TmfWindowRangeUpdatedSignal(FlameChartView.this, range, getTrace()));
                        getTimeGraphViewer().setStartFinishTime(startTime, endTime);
                        startZoomThread(startTime, endTime);
                        break;
                    }
                }
            }
        }
    });
    IEditorPart editor = getSite().getPage().getActiveEditor();
    if (editor instanceof ITmfTraceEditor) {
        ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
        if (trace != null) {
            traceSelected(new TmfTraceSelectedSignal(this, trace));
        }
    }
}
Also used : MouseEvent(org.eclipse.swt.events.MouseEvent) MouseAdapter(org.eclipse.swt.events.MouseAdapter) TmfWindowRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) TimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.TimeGraphEntry) TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) ITimeGraphState(org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState) NamedTimeEvent(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.NamedTimeEvent) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) ITimeGraphEntry(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model.ITimeGraphEntry) ISelection(org.eclipse.jface.viewers.ISelection) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal) TimeGraphControl(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl) ITmfTraceEditor(org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor)

Aggregations

ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 ITmfTraceEditor (org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor)3 IEditorPart (org.eclipse.ui.IEditorPart)3 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)2 ISelection (org.eclipse.jface.viewers.ISelection)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 MouseAdapter (org.eclipse.swt.events.MouseAdapter)1 MouseEvent (org.eclipse.swt.events.MouseEvent)1 ITimeGraphState (org.eclipse.tracecompass.tmf.core.model.timegraph.ITimeGraphState)1 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)1 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)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 TimeGraphControl (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl)1