Search in sources :

Example 11 with TmfSignalHandler

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

the class TmfStatisticsViewImpl method traceSelected.

/**
 * Handler called when an trace is selected. Checks if the trace
 * has changed and requests the selected trace if it has not yet been
 * cached.
 *
 * @param signal
 *            Contains the information about the selection.
 */
@TmfSignalHandler
public void traceSelected(TmfTraceSelectedSignal signal) {
    // Does not reload the same trace if already opened
    if (signal.getTrace() != fTrace) {
        /*
             * Dispose the current viewer and adapt the new one to the trace
             * type of the trace selected
             */
        fStatsViewers.clear();
        // Update the current trace
        fTrace = signal.getTrace();
        createStatisticsViewers();
        fStatsViewers.layout();
        TmfTraceRangeUpdatedSignal updateSignal = new TmfTraceRangeUpdatedSignal(this, fTrace, fTrace.getTimeRange());
        for (ITmfViewer viewer : fStatsViewers.getViewers()) {
            TmfStatisticsViewer statsViewer = (TmfStatisticsViewer) viewer;
            statsViewer.sendPartialRequestOnNextUpdate();
            statsViewer.traceRangeUpdated(updateSignal);
        }
    } else {
        /*
             * If the same trace is reselected, sends a notification to
             * the viewers to make sure they reload correctly their partial
             * event count.
             */
        for (ITmfViewer viewer : fStatsViewers.getViewers()) {
            TmfStatisticsViewer statsViewer = (TmfStatisticsViewer) viewer;
            // Will update the partial event count if needed.
            statsViewer.sendPartialRequestOnNextUpdate();
        }
    }
}
Also used : TmfTraceRangeUpdatedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceRangeUpdatedSignal) TmfStatisticsViewer(org.eclipse.tracecompass.internal.tmf.ui.viewers.statistics.TmfStatisticsViewer) ITmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.ITmfViewer) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 12 with TmfSignalHandler

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

the class TmfUml2SDSyncLoader method traceSelected.

/**
 * Signal handler for the trace selected signal.
 *
 * Spawns a request to index the trace (checkpoints creation) as well as it
 * fills the first page.
 *
 * @param signal
 *            The trace selected signal
 */
@TmfSignalHandler
public void traceSelected(TmfTraceSelectedSignal signal) {
    // Update the trace reference
    ITmfTrace trace = signal.getTrace();
    if (!trace.equals(fTrace)) {
        fTrace = trace;
    }
    loadTrace();
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 13 with TmfSignalHandler

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

the class TmfTimeViewer method traceRangeUpdated.

/**
 * Signal handler for handling of the trace range updated signal.
 *
 * @param signal
 *            The trace range signal {@link TmfTraceRangeUpdatedSignal}
 */
@TmfSignalHandler
public void traceRangeUpdated(@Nullable TmfTraceRangeUpdatedSignal signal) {
    if (signal == null || signal.getTrace() != fTrace) {
        return;
    }
    TmfTimeRange fullRange = signal.getRange();
    long traceStartTime = fullRange.getStartTime().toNanos();
    long traceEndTime = fullRange.getEndTime().toNanos();
    setStartTime(traceStartTime);
    setEndTime(traceEndTime);
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 14 with TmfSignalHandler

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

the class TmfTimeViewer method traceUpdated.

/**
 * Signal handler for handling of the trace updated signal.
 *
 * @param signal
 *            The trace updated signal {@link TmfTraceUpdatedSignal}
 */
@TmfSignalHandler
public void traceUpdated(@Nullable TmfTraceUpdatedSignal signal) {
    if (signal == null || signal.getTrace() != fTrace) {
        return;
    }
    TmfTimeRange fullRange = signal.getTrace().getTimeRange();
    long traceStartTime = fullRange.getStartTime().toNanos();
    long traceEndTime = fullRange.getEndTime().toNanos();
    setStartTime(traceStartTime);
    setEndTime(traceEndTime);
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 15 with TmfSignalHandler

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

the class TmfEventsTable method eventFilterApplied.

/**
 * Receive a signal to apply a filter. This will apply the filter if the
 * source is not this viewer already
 *
 * @param signal
 *            The signal
 * @since 4.2
 */
@TmfSignalHandler
public void eventFilterApplied(TmfFilterAppliedSignal signal) {
    if (signal.getSource() == this) {
        // This view is the source of the signal, ignore
        return;
    }
    Runnable runnable = () -> {
        if (fTable.isDisposed()) {
            return;
        }
        ITmfFilter eventFilter = signal.getFilter().getEventFilter();
        if (eventFilter == null) {
            fTable.setData(Key.SEARCH_OBJ, null);
            fTable.refresh();
        } else {
            fTable.setData(Key.SEARCH_OBJ, eventFilter);
            fTable.refresh();
            searchNext();
        }
    };
    Display display = PlatformUI.getWorkbench().getDisplay();
    if (display == Display.getCurrent()) {
        runnable.run();
    } else {
        Display.getDefault().asyncExec(runnable);
    }
}
Also used : ITmfFilter(org.eclipse.tracecompass.tmf.core.filter.ITmfFilter) SafeRunnable(org.eclipse.jface.util.SafeRunnable) IWorkspaceRunnable(org.eclipse.core.resources.IWorkspaceRunnable) Display(org.eclipse.swt.widgets.Display) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Aggregations

TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)53 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)22 TmfTimeRange (org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange)19 ITmfTimestamp (org.eclipse.tracecompass.tmf.core.timestamp.ITmfTimestamp)6 TmfTraceContext (org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext)6 Job (org.eclipse.core.runtime.jobs.Job)4 IFile (org.eclipse.core.resources.IFile)3 IAnalysisModule (org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule)3 TmfTraceElement (org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement)3 Collection (java.util.Collection)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 Set (java.util.Set)2 IResource (org.eclipse.core.resources.IResource)2 IStatus (org.eclipse.core.runtime.IStatus)2 ITmfEvent (org.eclipse.tracecompass.tmf.core.event.ITmfEvent)2 TmfEventRequest (org.eclipse.tracecompass.tmf.core.request.TmfEventRequest)2 TmfSelectionRangeUpdatedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfSelectionRangeUpdatedSignal)2 TmfTraceStub (org.eclipse.tracecompass.tmf.tests.stubs.trace.TmfTraceStub)2 HashMultiset (com.google.common.collect.HashMultiset)1