Search in sources :

Example 11 with TmfTraceSelectedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.

the class TmfChartView method loadTrace.

/**
 * Load the trace into view.
 */
protected void loadTrace() {
    // Initialize the tree viewer with the currently selected trace
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
        TmfViewer leftViewer = getLeftChildViewer();
        if (leftViewer instanceof TmfTimeViewer) {
            ((TmfTimeViewer) leftViewer).traceSelected(signal);
        }
        TmfXYChartViewer chartViewer = getChartViewer();
        if (chartViewer != null) {
            chartViewer.traceSelected(signal);
        }
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) TmfTimeViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer) TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)

Example 12 with TmfTraceSelectedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.

the class AbstractSegmentStoreDensityView method createPartControl.

@Override
public void createPartControl(@Nullable Composite parent) {
    super.createPartControl(parent);
    final SashForm sashForm = new SashForm(parent, SWT.NONE);
    fTableViewer = createSegmentStoreTableViewer(sashForm);
    fDensityViewer = createSegmentStoreDensityViewer(sashForm);
    fDensityViewer.addDataListener(new DataChangedListener());
    sashForm.setWeights(DEFAULT_WEIGHTS);
    Action zoomOut = new ZoomOutAction(this);
    IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
    toolBar.add(zoomOut);
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
        if (fDensityViewer != null) {
            fDensityViewer.traceSelected(signal);
        }
        if (fTableViewer != null) {
            fTableViewer.traceSelected(signal);
        }
    }
}
Also used : SashForm(org.eclipse.swt.custom.SashForm) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) IToolBarManager(org.eclipse.jface.action.IToolBarManager) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)

Example 13 with TmfTraceSelectedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.

the class AbstractSegmentStoreTableView method createPartControl.

// ------------------------------------------------------------------------
// ViewPart
// ------------------------------------------------------------------------
@Override
public void createPartControl(@Nullable Composite parent) {
    super.createPartControl(parent);
    SashForm sf = new SashForm(parent, SWT.NONE);
    TableViewer tableViewer = new TableViewer(sf, SWT.FULL_SELECTION | SWT.VIRTUAL);
    AbstractSegmentStoreTableViewer segmentStoreViewer = createSegmentStoreViewer(tableViewer);
    fSegmentStoreViewer = segmentStoreViewer;
    getViewSite().getActionBars().getMenuManager().add(fExportAction);
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
        if (fSegmentStoreViewer != null) {
            fSegmentStoreViewer.traceSelected(signal);
        }
    }
    // Add focus lost event
    segmentStoreViewer.getControl().addFocusListener(new FocusListener() {

        @Override
        public void focusLost(@Nullable FocusEvent e) {
            deactivateContextService();
        }

        @Override
        public void focusGained(@Nullable FocusEvent e) {
            activateContextService();
        }
    });
    Action timeEventFilterAction = new Action() {

        @Override
        public void run() {
            ViewFilterDialog dialog = fFilterDialog;
            if (dialog != null) {
                fFilterDialog = null;
                dialog.close();
            }
            dialog = new ViewFilterDialog(segmentStoreViewer.getControl().getShell(), AbstractSegmentStoreTableView.this, segmentStoreViewer.getControl());
            fFilterDialog = dialog;
            dialog.open();
        }
    };
    fFilterAction = timeEventFilterAction;
    IWorkbenchPartSite site = getSite();
    fContextService = site.getWorkbenchWindow().getService(IContextService.class);
}
Also used : IWorkbenchPartSite(org.eclipse.ui.IWorkbenchPartSite) SashForm(org.eclipse.swt.custom.SashForm) ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) Action(org.eclipse.jface.action.Action) ExportToTsvAction(org.eclipse.tracecompass.internal.tmf.ui.commands.ExportToTsvAction) ViewFilterDialog(org.eclipse.tracecompass.internal.provisional.tmf.ui.widgets.ViewFilterDialog) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal) IContextService(org.eclipse.ui.contexts.IContextService) TableViewer(org.eclipse.jface.viewers.TableViewer) FocusListener(org.eclipse.swt.events.FocusListener) FocusEvent(org.eclipse.swt.events.FocusEvent)

Example 14 with TmfTraceSelectedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal 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)

Example 15 with TmfTraceSelectedSignal

use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.

the class EventDensityView method createLeftChildViewer.

@Override
public TmfViewer createLeftChildViewer(Composite parent) {
    EventDensityTreeViewer histogramTreeViewer = new EventDensityTreeViewer(parent);
    ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
    if (trace != null) {
        histogramTreeViewer.traceSelected(new TmfTraceSelectedSignal(this, trace));
    }
    return histogramTreeViewer;
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) EventDensityTreeViewer(org.eclipse.tracecompass.internal.tmf.ui.viewers.eventdensity.EventDensityTreeViewer) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)

Aggregations

TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)16 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)13 Action (org.eclipse.jface.action.Action)4 TmfTraceOpenedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal)4 IAction (org.eclipse.jface.action.IAction)3 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)3 SashForm (org.eclipse.swt.custom.SashForm)3 MouseAdapter (org.eclipse.swt.events.MouseAdapter)3 MouseEvent (org.eclipse.swt.events.MouseEvent)3 TmfWindowRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfWindowRangeUpdatedSignal)3 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)3 TimeGraphControl (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets.TimeGraphControl)3 NonNull (org.eclipse.jdt.annotation.NonNull)2 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 FocusEvent (org.eclipse.swt.events.FocusEvent)2 PaintEvent (org.eclipse.swt.events.PaintEvent)2 PaintListener (org.eclipse.swt.events.PaintListener)2 Point (org.eclipse.swt.graphics.Point)2 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)2