use of org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer in project tracecompass by tracecompass.
the class TmfChartView method coupleSelectViewer.
/**
* Method to couple {@link AbstractSelectTreeViewer2} and
* {@link TmfFilteredXYChartViewer} so that they use the same legend and that
* the chart listens to selected items in the tree
*/
private void coupleSelectViewer() {
TmfViewer tree = getLeftChildViewer();
TmfXYChartViewer chart = getChartViewer();
if (tree instanceof AbstractSelectTreeViewer2 && chart instanceof TmfFilteredXYChartViewer) {
ILegendImageProvider2 legendImageProvider = new XYChartLegendImageProvider((TmfCommonXAxisChartViewer) chart);
AbstractSelectTreeViewer2 selectTree = (AbstractSelectTreeViewer2) tree;
selectTree.addTreeListener((TmfFilteredXYChartViewer) chart);
selectTree.setLegendImageProvider(legendImageProvider);
TriStateFilteredCheckboxTree checkboxTree = selectTree.getTriStateFilteredCheckboxTree();
checkboxTree.addPreCheckStateListener(new ManyEntriesSelectedDialogPreCheckedListener(checkboxTree));
}
}
use of org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer in project tracecompass by tracecompass.
the class TmfChartView method setPinned.
@Override
public void setPinned(@Nullable ITmfTrace trace) {
TmfViewer leftViewer = getLeftChildViewer();
if (leftViewer instanceof ITmfPinnable) {
((ITmfPinnable) leftViewer).setPinned(trace);
}
ITmfPinnable chartViewer = getChartViewer();
if (chartViewer != null) {
chartViewer.setPinned(trace);
}
if (trace != null) {
/* Ignore relevant inbound signals */
TmfSignalManager.addIgnoredInboundSignal(this, TmfTraceOpenedSignal.class);
TmfSignalManager.addIgnoredInboundSignal(this, TmfTraceSelectedSignal.class);
// $NON-NLS-1$
setPartName(String.format("%s <%s>", fOriginalTabLabel, TmfTraceManager.getInstance().getTraceUniqueName(trace)));
} else {
/* Handle relevant inbound signals */
TmfSignalManager.removeIgnoredInboundSignal(this, TmfTraceOpenedSignal.class);
TmfSignalManager.removeIgnoredInboundSignal(this, TmfTraceSelectedSignal.class);
setPartName(fOriginalTabLabel);
}
if (fPinAction != null) {
fPinAction.setPinnedTrace(trace);
}
}
use of org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer 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.ui.viewers.TmfViewer in project tracecompass by tracecompass.
the class CpuUsageView method cpuSelect.
/**
* Signal handler for when a cpu is selected
*
* @param signal
* the cpu being selected
* @since 2.0
*/
@TmfSignalHandler
public void cpuSelect(TmfCpuSelectedSignal signal) {
ITmfTrace trace = signal.getTrace();
TmfXYChartViewer xyViewer = getChartViewer();
TmfViewer viewer = getLeftChildViewer();
if (xyViewer instanceof CpuUsageXYViewer && viewer instanceof CpuUsageTreeViewer) {
Set<Integer> data = (Set<Integer>) getData(trace, CPU_USAGE_FOLLOW_CPU);
if (data == null) {
data = new TreeSet<>();
saveData(trace, CPU_USAGE_FOLLOW_CPU, data);
}
int core = signal.getCore();
if (core >= 0) {
data.add(core);
} else {
data.clear();
}
xyViewer.refresh();
((CpuUsageXYViewer) xyViewer).setTitle();
CpuUsageTreeViewer treeViewer = (CpuUsageTreeViewer) viewer;
treeViewer.updateContent(treeViewer.getWindowStartTime(), treeViewer.getWindowEndTime(), false);
}
}
use of org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer in project tracecompass by tracecompass.
the class MemoryUsageView2 method getFilterAction.
private Action getFilterAction() {
Action action = new Action(Messages.MemoryView_FilterAction_Text, IAction.AS_CHECK_BOX) {
// memory view is filtered by default.
private boolean isFiltered = true;
@Override
public void run() {
isFiltered ^= true;
setToolTipText(isFiltered ? Messages.MemoryView_FilterAction_FilteredTooltipText : Messages.MemoryView_FilterAction_UnfilteredTooltipText);
TmfViewer tree = getLeftChildViewer();
if (tree instanceof MemoryUsageTreeViewer2) {
MemoryUsageTreeViewer2 memoryUsageTreeViewer = (MemoryUsageTreeViewer2) tree;
memoryUsageTreeViewer.setFiltered(isFiltered);
}
}
};
action.setToolTipText(Messages.MemoryView_FilterAction_FilteredTooltipText);
// $NON-NLS-1$ //$NON-NLS-2$
action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.tracecompass.tmf.ui", "icons/elcl16/filter_items.gif"));
// filtered by default, to not change the default behavior
action.setChecked(true);
return action;
}
Aggregations