use of org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor in project tracecompass by tracecompass.
the class TmfUml2SDSyncLoader method setViewer.
@Override
public void setViewer(SDView viewer) {
fLock.lock();
try {
fView = viewer;
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(this);
fView.setSDFindProvider(this);
fView.setSDPagingProvider(this);
fView.setSDFilterProvider(this);
resetLoader();
IEditorPart editor = fView.getSite().getPage().getActiveEditor();
if (editor instanceof ITmfTraceEditor) {
ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
if (trace != null) {
traceSelected(new TmfTraceSelectedSignal(this, trace));
}
}
} finally {
fLock.unlock();
}
}
use of org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor in project tracecompass by tracecompass.
the class RefreshTraceContentHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart activeEditor = HandlerUtil.getActiveEditorChecked(event);
if (activeEditor instanceof ITmfTraceEditor) {
ITmfTrace trace = ((ITmfTraceEditor) activeEditor).getTrace();
refreshTrace(trace);
}
return null;
}
use of org.eclipse.tracecompass.tmf.ui.editors.ITmfTraceEditor in project tracecompass by tracecompass.
the class FlameChartView method createPartControl.
// ------------------------------------------------------------------------
// ViewPart
// ------------------------------------------------------------------------
@Override
public void createPartControl(@Nullable Composite parent) {
super.createPartControl(parent);
getTimeGraphViewer().addTimeListener(event -> synchingToTime(event.getBeginTime()));
getTimeGraphViewer().getTimeGraphControl().addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(@Nullable MouseEvent event) {
ITimeGraphEntry selection = getTimeGraphViewer().getSelection();
if (!(selection instanceof TimeGraphEntry)) {
// also null checks
return;
}
ITimeGraphState function = fFunctions.get(((TimeGraphEntry) selection).getEntryModel().getId());
if (function != null) {
long entryTime = function.getStartTime();
long exitTime = entryTime + function.getDuration();
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(entryTime), TmfTimestamp.fromNanos(exitTime));
broadcast(new TmfWindowRangeUpdatedSignal(FlameChartView.this, range, getTrace()));
getTimeGraphViewer().setStartFinishTime(entryTime, exitTime);
startZoomThread(entryTime, exitTime);
}
}
});
getTimeGraphViewer().getTimeGraphControl().addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(@Nullable MouseEvent e) {
TimeGraphControl timeGraphControl = getTimeGraphViewer().getTimeGraphControl();
ISelection selection = timeGraphControl.getSelection();
if (selection instanceof IStructuredSelection) {
for (Object object : ((IStructuredSelection) selection).toList()) {
if (object instanceof NamedTimeEvent) {
NamedTimeEvent event = (NamedTimeEvent) object;
long startTime = event.getTime();
long endTime = startTime + event.getDuration();
TmfTimeRange range = new TmfTimeRange(TmfTimestamp.fromNanos(startTime), TmfTimestamp.fromNanos(endTime));
broadcast(new TmfWindowRangeUpdatedSignal(FlameChartView.this, range, getTrace()));
getTimeGraphViewer().setStartFinishTime(startTime, endTime);
startZoomThread(startTime, endTime);
break;
}
}
}
}
});
IEditorPart editor = getSite().getPage().getActiveEditor();
if (editor instanceof ITmfTraceEditor) {
ITmfTrace trace = ((ITmfTraceEditor) editor).getTrace();
if (trace != null) {
traceSelected(new TmfTraceSelectedSignal(this, trace));
}
}
}
Aggregations