use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class TmfChartView method loadTrace.
/**
* Load the trace into view.
*/
protected void loadTrace() {
// Initialize the tree viewer with the currently selected trace
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
if (trace != null) {
TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
TmfViewer leftViewer = getLeftChildViewer();
if (leftViewer instanceof TmfTimeViewer) {
((TmfTimeViewer) leftViewer).traceSelected(signal);
}
TmfXYChartViewer chartViewer = getChartViewer();
if (chartViewer != null) {
chartViewer.traceSelected(signal);
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class AbstractSegmentStoreDensityView method createPartControl.
@Override
public void createPartControl(@Nullable Composite parent) {
super.createPartControl(parent);
final SashForm sashForm = new SashForm(parent, SWT.NONE);
fTableViewer = createSegmentStoreTableViewer(sashForm);
fDensityViewer = createSegmentStoreDensityViewer(sashForm);
fDensityViewer.addDataListener(new DataChangedListener());
sashForm.setWeights(DEFAULT_WEIGHTS);
Action zoomOut = new ZoomOutAction(this);
IToolBarManager toolBar = getViewSite().getActionBars().getToolBarManager();
toolBar.add(zoomOut);
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
if (trace != null) {
TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
if (fDensityViewer != null) {
fDensityViewer.traceSelected(signal);
}
if (fTableViewer != null) {
fTableViewer.traceSelected(signal);
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class AbstractSegmentStoreTableView method createPartControl.
// ------------------------------------------------------------------------
// ViewPart
// ------------------------------------------------------------------------
@Override
public void createPartControl(@Nullable Composite parent) {
super.createPartControl(parent);
SashForm sf = new SashForm(parent, SWT.NONE);
TableViewer tableViewer = new TableViewer(sf, SWT.FULL_SELECTION | SWT.VIRTUAL);
AbstractSegmentStoreTableViewer segmentStoreViewer = createSegmentStoreViewer(tableViewer);
fSegmentStoreViewer = segmentStoreViewer;
getViewSite().getActionBars().getMenuManager().add(fExportAction);
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
if (trace != null) {
TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
if (fSegmentStoreViewer != null) {
fSegmentStoreViewer.traceSelected(signal);
}
}
// Add focus lost event
segmentStoreViewer.getControl().addFocusListener(new FocusListener() {
@Override
public void focusLost(@Nullable FocusEvent e) {
deactivateContextService();
}
@Override
public void focusGained(@Nullable FocusEvent e) {
activateContextService();
}
});
Action timeEventFilterAction = new Action() {
@Override
public void run() {
ViewFilterDialog dialog = fFilterDialog;
if (dialog != null) {
fFilterDialog = null;
dialog.close();
}
dialog = new ViewFilterDialog(segmentStoreViewer.getControl().getShell(), AbstractSegmentStoreTableView.this, segmentStoreViewer.getControl());
fFilterDialog = dialog;
dialog.open();
}
};
fFilterAction = timeEventFilterAction;
IWorkbenchPartSite site = getSite();
fContextService = site.getWorkbenchWindow().getService(IContextService.class);
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal 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));
}
}
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class EventDensityView method createLeftChildViewer.
@Override
public TmfViewer createLeftChildViewer(Composite parent) {
EventDensityTreeViewer histogramTreeViewer = new EventDensityTreeViewer(parent);
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
if (trace != null) {
histogramTreeViewer.traceSelected(new TmfTraceSelectedSignal(this, trace));
}
return histogramTreeViewer;
}
Aggregations