Search in sources :

Example 46 with TmfSignalHandler

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

the class XmlDataProviderManager method traceClosed.

/**
 * Signal handler for the traceClosed signal.
 *
 * @param signal
 *            The incoming signal
 */
@TmfSignalHandler
public synchronized void traceClosed(final TmfTraceClosedSignal signal) {
    for (ITmfTrace trace : TmfTraceManager.getTraceSetWithExperiment(signal.getTrace())) {
        fXyProviders.row(trace).clear();
        fTimeGraphProviders.row(trace).clear();
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 47 with TmfSignalHandler

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

the class TimeChartView method traceSelected.

/**
 * Handler for the Trace Selected signal
 *
 * @param signal
 *            The incoming signal
 */
@TmfSignalHandler
public void traceSelected(TmfTraceSelectedSignal signal) {
    if (signal.getSource() != this) {
        ITmfTrace trace = signal.getTrace();
        for (int i = 0; i < fTimeAnalysisEntries.size(); i++) {
            if (fTimeAnalysisEntries.get(i).getTrace().equals(trace)) {
                fViewer.setSelection(fTimeAnalysisEntries.get(i), true);
                break;
            }
        }
        TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
        long beginTime = ctx.getSelectionRange().getStartTime().toNanos();
        long endTime = ctx.getSelectionRange().getEndTime().toNanos();
        fViewer.setSelectionRange(beginTime, endTime, false);
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfTraceContext(org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 48 with TmfSignalHandler

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

the class AbstractTimeGraphView method windowRangeUpdated.

/**
 * Handler for the window range signal.
 *
 * @param signal
 *            The signal that's received
 * @since 1.0
 */
@TmfSignalHandler
public void windowRangeUpdated(final TmfWindowRangeUpdatedSignal signal) {
    if (signal.getSource() == this || fTrace == null) {
        return;
    }
    TmfTraceContext ctx = TmfTraceManager.getInstance().getTraceContext(checkNotNull(fTrace));
    final long startTime = ctx.getWindowRange().getStartTime().toNanos();
    final long endTime = ctx.getWindowRange().getEndTime().toNanos();
    Display.getDefault().asyncExec(() -> {
        if (fTimeGraphViewer.getControl().isDisposed()) {
            return;
        }
        if (startTime == fTimeGraphViewer.getTime0() && endTime == fTimeGraphViewer.getTime1()) {
            return;
        }
        fTimeGraphViewer.setStartFinishTime(startTime, endTime);
        startZoomThread(startTime, endTime);
    });
}
Also used : TmfTraceContext(org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 49 with TmfSignalHandler

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

the class HistogramView method windowRangeUpdated.

/**
 * Updates the current window time range in the time range histogram and
 * full range histogram.
 *
 * @param signal
 *            the signal to process
 * @since 1.0
 */
@TmfSignalHandler
public void windowRangeUpdated(final TmfWindowRangeUpdatedSignal signal) {
    if (Display.getCurrent() == null) {
        // Make sure the signal is handled in the UI thread
        Display.getDefault().asyncExec(() -> {
            if (getParentComposite().isDisposed()) {
                return;
            }
            windowRangeUpdated(signal);
        });
        return;
    }
    if (fTrace != null) {
        // Validate the time range
        TmfTimeRange range = signal.getCurrentRange().getIntersection(fTrace.getTimeRange());
        if (range == null) {
            return;
        }
        updateDisplayedTimeRange(range.getStartTime().toNanos(), range.getEndTime().toNanos());
        // Send the event request to populate the small histogram
        sendTimeRangeRequest(fWindowStartTime, fWindowEndTime);
        fTimeSpanControl.setValue(fWindowSpan);
    }
}
Also used : TmfTimeRange(org.eclipse.tracecompass.tmf.core.timestamp.TmfTimeRange) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 50 with TmfSignalHandler

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

the class HistogramView method traceClosed.

/**
 * Handles trace closed signal. Clears the view and data model and cancels requests.
 * @param signal the trace closed signal
 */
@TmfSignalHandler
public void traceClosed(TmfTraceClosedSignal signal) {
    if (signal.getTrace() != fTrace) {
        return;
    }
    // Kill any running request
    if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) {
        fTimeRangeRequest.cancel();
    }
    if ((fFullTraceRequest != null) && !fFullTraceRequest.isCompleted()) {
        fFullTraceRequest.cancel();
    }
    // Initialize the internal data
    fTrace = null;
    fTraceStartTime = 0L;
    fTraceEndTime = 0L;
    fWindowStartTime = 0L;
    fWindowEndTime = 0L;
    fWindowSpan = 0L;
    fSelectionBeginTime = 0L;
    fSelectionEndTime = 0L;
    // Clear the UI widgets
    fFullTraceHistogram.clear();
    fFullTraceHistogram.fDataModel.setTrace(null);
    fTimeRangeHistogram.clear();
    fTimeRangeHistogram.fDataModel.setTrace(null);
    fSelectionStartControl.setValue(Long.MIN_VALUE);
    fSelectionEndControl.setValue(Long.MIN_VALUE);
    fTimeSpanControl.setValue(Long.MIN_VALUE);
    for (Control c : fLegendArea.getChildren()) {
        c.dispose();
    }
    disposeLegendImages();
    fLegendArea.layout();
    fLegendArea.getParent().layout();
}
Also used : Control(org.eclipse.swt.widgets.Control) 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