use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.
the class CopyToClipboardOperation method copy.
private IStatus copy(final StringBuilder sb, final IProgressMonitor monitor) {
ITmfEventRequest request = new TmfEventRequest(ITmfEvent.class, TmfTimeRange.ETERNITY, fStartRank, (int) (fEndRank - fStartRank + 1), ExecutionType.FOREGROUND) {
@Override
public void handleData(ITmfEvent event) {
super.handleData(event);
if (monitor.isCanceled()) {
cancel();
return;
}
monitor.worked(1);
if (fFilter == null || fFilter.matches(event)) {
try {
boolean needTab = false;
for (TmfEventTableColumn column : fColumns) {
if (needTab) {
sb.append('\t');
}
sb.append(column.getItemString(event));
needTab = true;
}
sb.append(LINE_SEPARATOR);
} catch (OutOfMemoryError e) {
sb.setLength(0);
sb.trimToSize();
showErrorDialog();
cancel();
}
}
}
};
fTrace.sendRequest(request);
try {
request.waitForCompletion();
} catch (InterruptedException e) {
// $NON-NLS-1$
Activator.getDefault().logError("Wait for completion interrupted for copy to clipboard ", e);
Thread.currentThread().interrupt();
}
return Status.OK_STATUS;
}
use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.
the class StreamListAnalysis method executeAnalysis.
@Override
protected boolean executeAnalysis(@Nullable IProgressMonitor monitor) throws TmfAnalysisException {
IProgressMonitor mon = (monitor == null ? new NullProgressMonitor() : monitor);
ITmfTrace trace = getTrace();
if (trace == null) {
/* This analysis was cancelled in the meantime */
return false;
}
ITmfEventRequest request = fRequest;
if ((request != null) && (!request.isCompleted())) {
request.cancel();
}
request = new TmfEventRequest(PcapEvent.class, TmfTimeRange.ETERNITY, 0L, ITmfEventRequest.ALL_DATA, ITmfEventRequest.ExecutionType.BACKGROUND) {
@Override
public void handleData(ITmfEvent data) {
// Called for each event
super.handleData(data);
if (!(data instanceof PcapEvent)) {
return;
}
PcapEvent event = (PcapEvent) data;
for (Map.Entry<TmfPcapProtocol, TmfPacketStreamBuilder> entry : fBuilders.entrySet()) {
entry.getValue().addEventToStream(event);
}
}
};
trace.sendRequest(request);
fRequest = request;
try {
request.waitForCompletion();
} catch (InterruptedException e) {
// Request was canceled.
return false;
}
return !mon.isCanceled() && !request.isCancelled() && !request.isFailed();
}
use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.
the class TmfSyntheticEventProviderStub method armRequest.
@Override
public ITmfContext armRequest(final ITmfEventRequest request) {
// Get the TmfSyntheticEventStub provider
final ITmfEventProvider[] eventProviders = TmfProviderManager.getProviders(ITmfEvent.class, TmfEventProviderStub.class);
final ITmfEventProvider provider = eventProviders[0];
final TmfTimeRange range = request.getRange();
final TmfEventRequest subRequest = new TmfEventRequest(ITmfEvent.class, range, 0, NB_EVENTS, ExecutionType.FOREGROUND) {
@Override
public void handleData(final ITmfEvent event) {
super.handleData(event);
handleIncomingData(event);
}
};
provider.sendRequest(subRequest);
// Return a dummy context
return new TmfContext();
}
use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.
the class TmfStateSystemAnalysisModule method startRequest.
private void startRequest() {
ITmfStateProvider stateProvider = fStateProvider;
TmfTimeRange timeRange = fTimeRange;
if (stateProvider == null || timeRange == null) {
return;
}
ITmfEventRequest request = createEventRequest(stateProvider, timeRange, fNbRead);
stateProvider.getTrace().sendRequest(request);
fRequest = request;
}
use of org.eclipse.tracecompass.tmf.core.request.ITmfEventRequest in project tracecompass by tracecompass.
the class PartialHistoryBackend method registerCheckpoints.
private void registerCheckpoints() {
ITmfEventRequest request = new CheckpointsRequest(fPartialInput, fCheckpoints);
fPartialInput.getTrace().sendRequest(request);
/* The request will countDown the checkpoints latch once it's finished */
}
Aggregations