Search in sources :

Example 1 with TmfViewer

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));
    }
}
Also used : TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) AbstractSelectTreeViewer2(org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractSelectTreeViewer2) ILegendImageProvider2(org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2) XYChartLegendImageProvider(org.eclipse.tracecompass.tmf.ui.viewers.xychart.XYChartLegendImageProvider) ManyEntriesSelectedDialogPreCheckedListener(org.eclipse.tracecompass.tmf.ui.views.ManyEntriesSelectedDialogPreCheckedListener) TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer) TriStateFilteredCheckboxTree(org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.TriStateFilteredCheckboxTree) TmfFilteredXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer)

Example 2 with TmfViewer

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);
    }
}
Also used : TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer) ITmfPinnable(org.eclipse.tracecompass.tmf.ui.views.ITmfPinnable)

Example 3 with TmfViewer

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);
        }
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) TmfTimeViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer) TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer) TmfTraceSelectedSignal(org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)

Example 4 with TmfViewer

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);
    }
}
Also used : ITmfTrace(org.eclipse.tracecompass.tmf.core.trace.ITmfTrace) TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) Set(java.util.Set) TreeSet(java.util.TreeSet) TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer) TmfSignalHandler(org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)

Example 5 with TmfViewer

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;
}
Also used : IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action) TmfViewer(org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer)

Aggregations

TmfViewer (org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer)5 TmfXYChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer)3 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)2 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 Action (org.eclipse.jface.action.Action)1 IAction (org.eclipse.jface.action.IAction)1 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)1 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)1 ILegendImageProvider2 (org.eclipse.tracecompass.tmf.ui.viewers.ILegendImageProvider2)1 TmfTimeViewer (org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer)1 AbstractSelectTreeViewer2 (org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractSelectTreeViewer2)1 XYChartLegendImageProvider (org.eclipse.tracecompass.tmf.ui.viewers.xychart.XYChartLegendImageProvider)1 TmfFilteredXYChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.linechart.TmfFilteredXYChartViewer)1 ITmfPinnable (org.eclipse.tracecompass.tmf.ui.views.ITmfPinnable)1 ManyEntriesSelectedDialogPreCheckedListener (org.eclipse.tracecompass.tmf.ui.views.ManyEntriesSelectedDialogPreCheckedListener)1 TriStateFilteredCheckboxTree (org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs.TriStateFilteredCheckboxTree)1