use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TmfTraceManager method selectionRangeUpdated.
/**
* Signal handler for the selection range signal.
*
* If the signal trace is null, the time selection of *all* traces whose
* range contains the requested new selection time range will be updated. If
* the signal contains a trace, the signal trace and time-synchronized
* traces will be updated, but not other instances of the signal trace.
*
* @param signal
* The incoming signal
* @since 1.0
*/
@TmfSignalHandler
public synchronized void selectionRangeUpdated(final TmfSelectionRangeUpdatedSignal signal) {
final ITmfTimestamp beginTs = signal.getBeginTime();
final ITmfTimestamp endTs = signal.getEndTime();
final ITmfTrace signalTrace = signal.getTrace();
for (ITmfTrace trace : fTraces.keySet()) {
if ((beginTs.intersects(getValidTimeRange(trace)) || endTs.intersects(getValidTimeRange(trace))) && (signalTrace == null || isSynchronized(trace, signalTrace))) {
updateTraceContext(trace, builder -> builder.setSelection(new TmfTimeRange(beginTs, endTs)));
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TmfTraceManager method traceClosed.
/**
* Signal handler for the traceClosed signal.
*
* @param signal
* The incoming signal
*/
@TmfSignalHandler
public synchronized void traceClosed(final TmfTraceClosedSignal signal) {
fTraces.remove(signal.getTrace());
IResource resource = signal.getTrace().getResource();
if (resource != null && fTraces.keySet().stream().noneMatch(trace -> resource.equals(trace.getResource()))) {
/* Reset the instance count only when no other instance remains */
fInstanceCounts.setCount(resource, 0);
}
if (fTraces.size() == 0) {
fCurrentTrace = null;
/*
* In other cases, we should receive a traceSelected signal that
* will indicate which trace is the new one.
*/
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TmfExperiment method traceOpened.
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
@Override
@TmfSignalHandler
public void traceOpened(TmfTraceOpenedSignal signal) {
if (signal.getTrace() == this) {
initializeStreamingMonitor();
/* Initialize the analysis */
MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null);
status.add(executeAnalysis());
if (!status.isOK()) {
Activator.log(status);
}
/* Refresh supplementary files in separate thread to prevent deadlock */
new // $NON-NLS-1$
Thread(// $NON-NLS-1$
"Refresh supplementary files") {
@Override
public void run() {
TmfTraceManager.refreshSupplementaryFiles(TmfExperiment.this);
}
}.start();
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TmfStatisticsViewer method traceRangeUpdated.
// ------------------------------------------------------------------------
// Signal handlers
// ------------------------------------------------------------------------
/**
* Handles the signal about new trace range.
*
* @param signal
* The trace range updated signal
*/
@TmfSignalHandler
public void traceRangeUpdated(TmfTraceRangeUpdatedSignal signal) {
ITmfTrace trace = signal.getTrace();
// validate
if (!isListeningTo(trace)) {
return;
}
synchronized (fStatisticsRangeUpdateSyncObj) {
// Sends the time range request only once from this method.
if (fSendRangeRequest) {
fSendRangeRequest = false;
TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
TmfTimeRange timeRange = ctx.getSelectionRange();
requestTimeRangeData(trace, timeRange);
}
}
requestData(trace, signal.getRange());
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler in project tracecompass by tracecompass.
the class TmfStatisticsViewer method timeSynchUpdated.
/**
* Handles the time synch updated signal. It updates the time range
* statistics.
*
* @param signal
* Contains the information about the new selected time range.
* @since 1.0
*/
@TmfSignalHandler
public void timeSynchUpdated(TmfSelectionRangeUpdatedSignal signal) {
if (fTrace == null) {
return;
}
ITmfTimestamp begin = signal.getBeginTime();
ITmfTimestamp end = signal.getEndTime();
TmfTimeRange timeRange;
if (begin.compareTo(end) <= 0) {
timeRange = new TmfTimeRange(begin, end);
} else {
timeRange = new TmfTimeRange(end, begin);
}
requestTimeRangeData(fTrace, timeRange);
}
Aggregations