use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext in project tracecompass by tracecompass.
the class AbstractTimeGraphView method isDirty.
/**
* Returns whether or not the time graph view is dirty. The time graph view is
* considered dirty if it has yet to completely update its model.
*
* This method is meant to be used by tests in order to know when it is safe to
* proceed.
*
* Note: If a trace is smaller than the initial window range (see
* {@link ITmfTrace#getInitialRangeOffset}) this method will return true
* forever.
*
* @return true if the time graph view has yet to completely update its model,
* false otherwise
* @since 2.0
*/
public boolean isDirty() {
if (fTrace == null) {
return false;
}
TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
long startTime = ctx.getWindowRange().getStartTime().toNanos();
long endTime = ctx.getWindowRange().getEndTime().toNanos();
// the window range then it's dirty. A refresh should happen later.
if (fTimeGraphViewer.getTime0() != startTime || fTimeGraphViewer.getTime1() != endTime) {
return true;
}
if (fZoomThread == null) {
// (refresh called).
return fDirty.get() != 0;
}
// be a subsequent zoom thread that will be triggered.
return fDirty.get() != 0 || fZoomThread.getZoomStartTime() != startTime || fZoomThread.getZoomEndTime() != endTime;
}
use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext 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);
});
}
use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext in project tracecompass by tracecompass.
the class HistogramView method initializeHistograms.
// ------------------------------------------------------------------------
// Helper functions
// ------------------------------------------------------------------------
private void initializeHistograms() {
TmfTimeRange fullRange = updateTraceTimeRange();
TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
long selectionBeginTime = ctx.getSelectionRange().getStartTime().toNanos();
long selectionEndTime = ctx.getSelectionRange().getEndTime().toNanos();
long startTime = ctx.getWindowRange().getStartTime().toNanos();
long duration = ctx.getWindowRange().getEndTime().toNanos() - startTime;
if ((fTimeRangeRequest != null) && !fTimeRangeRequest.isCompleted()) {
fTimeRangeRequest.cancel();
}
fTimeRangeHistogram.clear();
fTimeRangeHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
fTimeRangeHistogram.setTimeRange(startTime, duration);
fTimeRangeHistogram.setSelection(selectionBeginTime, selectionEndTime);
fTimeRangeHistogram.fDataModel.setTrace(fTrace);
if ((fFullTraceRequest != null) && !fFullTraceRequest.isCompleted()) {
fFullTraceRequest.cancel();
}
fFullTraceHistogram.clear();
fFullTraceHistogram.setFullRange(fTraceStartTime, fTraceEndTime);
fFullTraceHistogram.setTimeRange(startTime, duration);
fFullTraceHistogram.setSelection(selectionBeginTime, selectionEndTime);
fFullTraceHistogram.fDataModel.setTrace(fTrace);
fWindowStartTime = startTime;
fWindowSpan = duration;
fWindowEndTime = startTime + duration;
fSelectionBeginTime = selectionBeginTime;
fSelectionEndTime = selectionEndTime;
fSelectionStartControl.setValue(fSelectionBeginTime);
fSelectionEndControl.setValue(fSelectionEndTime);
// make sure that the scrollbar is setup properly
fScrollComposite.setMinSize(fTimeControlsComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
fTimeSpanControl.setValue(duration);
Collection<ITmfTrace> traces = TmfTraceManager.getTraceSet(fTrace);
if (!traces.isEmpty()) {
this.showTraceAction.setEnabled(traces.size() < fFullTraceHistogram.getMaxNbTraces());
}
updateLegendArea();
if (!fullRange.equals(TmfTimeRange.NULL_RANGE)) {
sendTimeRangeRequest(startTime, startTime + duration);
sendFullRangeRequest(fullRange);
}
}
use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext in project tracecompass by tracecompass.
the class AbstractTimeGraphView method selectionRangeUpdated.
/**
* Handler for the selection range signal.
*
* @param signal
* The signal that's received
* @since 1.0
*/
@TmfSignalHandler
public void selectionRangeUpdated(final TmfSelectionRangeUpdatedSignal signal) {
final ITmfTrace trace = fTrace;
if (signal.getSource() == this || trace == null) {
return;
}
ITmfTrace signalTrace = signal.getTrace();
if (signalTrace != null && !TmfTraceManager.getInstance().isSynchronized(trace, signalTrace)) {
return;
}
TmfTraceContext ctx = TmfTraceManager.getInstance().getTraceContext(trace);
long beginTime = ctx.getSelectionRange().getStartTime().toNanos();
long endTime = ctx.getSelectionRange().getEndTime().toNanos();
Display.getDefault().asyncExec(() -> {
if (fTimeGraphViewer.getControl().isDisposed()) {
return;
}
if (beginTime == endTime) {
fTimeGraphViewer.setSelectedTime(beginTime, true);
} else {
fTimeGraphViewer.setSelectionRange(beginTime, endTime, true);
}
synchingToTime(fTimeGraphViewer.getSelectionBegin());
});
}
Aggregations