use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext in project tracecompass by tracecompass.
the class TmfXYChartViewer method isDirty.
/**
* Returns whether or not this chart viewer is dirty. The viewer 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.
*
* @return true if the time graph view has yet to completely update its model,
* false otherwise
*/
@VisibleForTesting
public boolean isDirty() {
if (getTrace() == 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.
return (getWindowStartTime() != startTime || getWindowEndTime() != endTime);
}
use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext in project tracecompass by tracecompass.
the class ControlFlowCheckActiveProvider method isActive.
@Override
public boolean isActive(ITimeGraphEntry element) {
ThreadEntryModel model = ControlFlowView.getThreadEntryModel(element);
if (model != null) {
TmfTraceManager traceManager = TmfTraceManager.getInstance();
TmfTraceContext traceContext = traceManager.getCurrentTraceContext();
TmfTimeRange range = traceContext.getSelectionRange();
/* Take precedence of selection over window range. */
if (Objects.equals(range.getStartTime(), range.getEndTime())) {
range = traceContext.getWindowRange();
}
Set<Long> ids = getActiveIds((TimeGraphEntry) element, range);
return ids.contains(model.getId());
}
return false;
}
use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext in project tracecompass by tracecompass.
the class ResourcesView method fillTimeEventContextMenu.
@Override
protected void fillTimeEventContextMenu(@NonNull IMenuManager menuManager) {
ISelection selection = getSite().getSelectionProvider().getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection sSel = (IStructuredSelection) selection;
if (sSel.getFirstElement() instanceof TimeGraphEntry) {
TimeGraphEntry resourcesEntry = (TimeGraphEntry) sSel.getFirstElement();
ITmfTreeDataModel model = resourcesEntry.getEntryModel();
if (sSel.toArray()[1] instanceof NamedTimeEvent && ((ResourcesEntryModel) model).getType() == Type.CURRENT_THREAD) {
ITmfTrace trace = getTrace(resourcesEntry);
NamedTimeEvent event = (NamedTimeEvent) sSel.toArray()[1];
TmfTraceContext ctx = TmfTraceManager.getInstance().getCurrentTraceContext();
HostThread data = (HostThread) ctx.getData(HostThread.SELECTED_HOST_THREAD_KEY);
if (data != null) {
menuManager.add(new UnfollowThreadAction(ResourcesView.this));
} else {
menuManager.add(new FollowThreadAction(ResourcesView.this, null, event.getValue(), trace));
}
}
}
}
super.fillTimeEventContextMenu(menuManager);
}
use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext in project tracecompass by tracecompass.
the class ResourcesView method fillTimeGraphEntryContextMenu.
/**
* @since 2.0
*/
@Override
protected void fillTimeGraphEntryContextMenu(@NonNull IMenuManager menuManager) {
ISelection selection = getSite().getSelectionProvider().getSelection();
if (selection instanceof IStructuredSelection) {
IStructuredSelection sSel = (IStructuredSelection) selection;
if (sSel.getFirstElement() instanceof TimeGraphEntry) {
TimeGraphEntry resourcesEntry = (TimeGraphEntry) sSel.getFirstElement();
ITmfTreeDataModel model = resourcesEntry.getEntryModel();
if (model instanceof ResourcesEntryModel) {
ResourcesEntryModel resourcesModel = (ResourcesEntryModel) model;
Type type = resourcesModel.getType();
if (type == Type.CPU || type == Type.CURRENT_THREAD) {
ITmfTrace trace = getTrace(resourcesEntry);
TmfTraceContext ctx = TmfTraceManager.getInstance().getTraceContext(trace);
Integer data = (Integer) ctx.getData(RESOURCES_FOLLOW_CPU);
int cpu = data != null ? data.intValue() : -1;
if (cpu >= 0) {
menuManager.add(new UnfollowCpuAction(ResourcesView.this, resourcesModel.getResourceId(), trace));
} else {
menuManager.add(new FollowCpuAction(ResourcesView.this, resourcesModel.getResourceId(), trace));
}
}
}
}
}
}
use of org.eclipse.tracecompass.tmf.core.trace.TmfTraceContext 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);
}
}
Aggregations