use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class UstKernelSyncTest method setup.
/**
* Test setup
*/
@Before
public void setup() {
ITmfTrace ustTrace = CtfTmfTestTraceUtils.getTrace(UST_TRACE);
ITmfTrace kernelTrace = LttngKernelTestTraceUtils.getTrace(KERNEL_TRACE);
TmfExperiment experiment = new TmfExperiment(CtfTmfEvent.class, "test-exp", new ITmfTrace[] { ustTrace, kernelTrace }, TmfExperiment.DEFAULT_INDEX_PAGE_SIZE, null);
/* Simulate experiment being opened */
TmfSignalManager.dispatchSignal(new TmfTraceOpenedSignal(this, experiment, null));
TmfSignalManager.dispatchSignal(new TmfTraceSelectedSignal(this, experiment));
KernelAnalysisModule module = TmfTraceUtils.getAnalysisModuleOfClass(experiment, KernelAnalysisModule.class, KernelAnalysisModule.ID);
assertNotNull(module);
module.waitForCompletion();
fExperiment = experiment;
fUstTrace = ustTrace;
fKernelModule = module;
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal 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.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class TmfStatisticsViewImpl method createPartControl.
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
fStatsViewers.setParent(parent);
createStatisticsViewers();
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
if (trace != null) {
traceSelected(new TmfTraceSelectedSignal(this, trace));
}
getViewSite().getActionBars().getMenuManager().add(fExportAction);
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class TmfEventsEditor method createAndInitializeTable.
private void createAndInitializeTable() {
if (fTrace != null) {
fEventsTable = createEventsTable(fParent, fTrace.getCacheSize());
fEventsTable.registerContextMenus(getSite());
fEventsTable.addSelectionChangedListener(this);
fEventsTable.setTrace(fTrace, true);
fEventsTable.refreshBookmarks(fFile);
loadState();
/* ensure start time is set */
final ITmfContext context = fTrace.seekEvent(0);
fTrace.getNext(context);
context.dispose();
broadcast(new TmfTraceOpenedSignal(this, fTrace, fFile));
if (fTraceSelected) {
broadcast(new TmfTraceSelectedSignal(this, fTrace));
}
/* update part name only after trace manager notified */
setPartName(TmfTraceManager.getInstance().getTraceUniqueName(fTrace));
/* go to marker after trace opened */
if (fPendingGotoMarker != null) {
fEventsTable.gotoMarker(fPendingGotoMarker);
fPendingGotoMarker = null;
}
} else {
fEventsTable = new TmfEventsTable(fParent, 0);
fEventsTable.addSelectionChangedListener(this);
}
IStatusLineManager statusLineManager = getEditorSite().getActionBars().getStatusLineManager();
fEventsTable.setStatusLineManager(statusLineManager);
}
use of org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal in project tracecompass by tracecompass.
the class HistogramView method createPartControl.
// ------------------------------------------------------------------------
// TmfView
// ------------------------------------------------------------------------
@Override
public void createPartControl(Composite parent) {
super.createPartControl(parent);
// Control labels
final String selectionStartLabel = Messages.HistogramView_selectionStartLabel;
final String selectionEndLabel = Messages.HistogramView_selectionEndLabel;
final String windowSpanLabel = Messages.HistogramView_windowSpanLabel;
// --------------------------------------------------------------------
// Set the HistogramView layout
// --------------------------------------------------------------------
Composite viewComposite = new Composite(getParentComposite(), SWT.FILL);
GridLayout gridLayout = new GridLayout(1, false);
gridLayout.verticalSpacing = 0;
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
viewComposite.setLayout(gridLayout);
// --------------------------------------------------------------------
// Add a sash for time controls and time range histogram
// --------------------------------------------------------------------
/*
* The ScrolledComposite preferred size can be larger than its visible
* width. This affects the preferred width of the SashForm. Set the
* preferred width to 1 to prevent it from affecting the preferred width
* of the view composite.
*/
fSashForm = new SashForm(viewComposite, SWT.NONE) {
@Override
public Point computeSize(int wHint, int hHint) {
Point computedSize = super.computeSize(wHint, hHint);
if (wHint == SWT.DEFAULT) {
return new Point(1, computedSize.y);
}
return computedSize;
}
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
Point computedSize = super.computeSize(wHint, hHint, changed);
if (wHint == SWT.DEFAULT) {
return new Point(1, computedSize.y);
}
return computedSize;
}
};
GridData gridData = new GridData(GridData.FILL, GridData.FILL, false, true);
fSashForm.setLayoutData(gridData);
// --------------------------------------------------------------------
// Time controls
// --------------------------------------------------------------------
fScrollComposite = new PackedScrolledComposite(fSashForm, SWT.H_SCROLL | SWT.V_SCROLL);
fTimeControlsComposite = new Composite(fScrollComposite, SWT.NONE);
fScrollComposite.setContent(fTimeControlsComposite);
gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
fScrollComposite.setLayout(gridLayout);
fScrollComposite.setExpandHorizontal(true);
fScrollComposite.setExpandVertical(true);
gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
fTimeControlsComposite.setLayout(gridLayout);
gridData = new GridData(GridData.FILL, GridData.CENTER, false, true);
fTimeControlsComposite.setLayoutData(gridData);
Composite innerComp = new Composite(fTimeControlsComposite, SWT.NONE);
gridLayout = new GridLayout(2, false);
innerComp.setLayout(gridLayout);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
gridLayout.horizontalSpacing = 5;
gridLayout.verticalSpacing = 1;
gridData = new GridData(GridData.FILL, GridData.CENTER, false, true);
innerComp.setLayoutData(gridData);
Composite selectionGroup = new Composite(innerComp, SWT.BORDER);
gridLayout = new GridLayout(1, false);
gridLayout.marginHeight = 0;
gridLayout.marginWidth = 0;
selectionGroup.setLayout(gridLayout);
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
selectionGroup.setLayoutData(gridData);
// Selection start control
gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
fSelectionStartControl = new HistogramSelectionStartControl(this, selectionGroup, selectionStartLabel, 0L);
fSelectionStartControl.setLayoutData(gridData);
fSelectionStartControl.setValue(Long.MIN_VALUE);
// Selection end control
gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
fSelectionEndControl = new HistogramSelectionEndControl(this, selectionGroup, selectionEndLabel, 0L);
fSelectionEndControl.setLayoutData(gridData);
fSelectionEndControl.setValue(Long.MIN_VALUE);
// Link button
gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
fLinkButton = new Label(innerComp, SWT.NONE);
fLinkButton.setImage(LINK_IMG);
fLinkButton.setLayoutData(gridData);
addLinkButtonListeners();
// Window span time control
gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
fTimeSpanControl = new HistogramTimeRangeControl(this, innerComp, windowSpanLabel, 0L);
fTimeSpanControl.setLayoutData(gridData);
fTimeSpanControl.setValue(Long.MIN_VALUE);
IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
// --------------------------------------------------------------------
// Time range histogram
// --------------------------------------------------------------------
fTimeRangeComposite = new Composite(fSashForm, SWT.NONE);
gridLayout = new GridLayout(1, true);
gridLayout.marginTop = 0;
gridLayout.marginWidth = 0;
fTimeRangeComposite.setLayout(gridLayout);
// Use remaining horizontal space
gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
fTimeRangeComposite.setLayoutData(gridData);
// Histogram
fTimeRangeHistogram = new TimeRangeHistogram(this, fTimeRangeComposite, true);
fTimeRangeHistogram.setStatusLineManager(statusLineManager);
// --------------------------------------------------------------------
// Full range histogram
// --------------------------------------------------------------------
final Composite fullRangeComposite = new Composite(viewComposite, SWT.FILL);
gridLayout = new GridLayout(1, true);
fullRangeComposite.setLayout(gridLayout);
// Use remaining horizontal space
gridData = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);
fullRangeComposite.setLayoutData(gridData);
// Histogram
fFullTraceHistogram = new FullTraceHistogram(this, fullRangeComposite);
fFullTraceHistogram.setStatusLineManager(statusLineManager);
fLegendArea = new Composite(viewComposite, SWT.FILL);
fLegendArea.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false, 2, 1));
fLegendArea.setLayout(new RowLayout());
// Add mouse wheel listener to time span control
MouseWheelListener listener = fFullTraceHistogram.getZoom();
fTimeSpanControl.addMouseWheelListener(listener);
// View Action Handling
contributeToActionBars();
ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
if (trace != null) {
traceSelected(new TmfTraceSelectedSignal(this, trace));
}
fSashForm.setVisible(true);
fSashForm.setWeights(DEFAULT_WEIGHTS);
fTimeControlsComposite.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
// drag listener here
if (fSashDragListener == null) {
for (Control control : fSashForm.getChildren()) {
if (control instanceof Sash) {
fSashDragListener = event -> TmfSignalManager.dispatchSignal(new TmfTimeViewAlignmentSignal(fSashForm, getTimeViewAlignmentInfo()));
control.removePaintListener(this);
control.addListener(SWT.Selection, fSashDragListener);
// There should be only one sash
break;
}
}
}
}
});
}
Aggregations