Search in sources :

Example 6 with TmfXYChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer 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 7 with TmfXYChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer in project tracecompass by tracecompass.

the class CounterView method getCumulativeAction.

private Action getCumulativeAction() {
    Action action = new Action(Messages.CounterView_CumulativeAction_Text, IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            boolean isCumulative = isChecked();
            setToolTipText(isCumulative ? Messages.CounterView_CumulativeAction_DifferentialTooltipText : Messages.CounterView_CumulativeAction_CumulativeTooltipText);
            TmfXYChartViewer chart = getChartViewer();
            if (chart instanceof CounterChartViewer) {
                ((CounterChartViewer) chart).toggleCumulative();
            }
        }
    };
    action.setToolTipText(Messages.CounterView_CumulativeAction_CumulativeTooltipText);
    // $NON-NLS-1$ //$NON-NLS-2$
    action.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.tracecompass.tmf.ui", "icons/elcl16/sigma.gif"));
    return action;
}
Also used : TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) IAction(org.eclipse.jface.action.IAction) Action(org.eclipse.jface.action.Action)

Example 8 with TmfXYChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer 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 9 with TmfXYChartViewer

use of org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer in project tracecompass by tracecompass.

the class PatternScatterChartViewTest method getChartViewer.

private TmfXYChartViewer getChartViewer() {
    SWTBotView viewBot = fBot.viewById(VIEW_ID);
    PatternScatterGraphView viewPart = (PatternScatterGraphView) viewBot.getViewReference().getView(true);
    TmfXYChartViewer chartViewer = viewPart.getChartViewer();
    fScatterChart = chartViewer.getSwtChart();
    return chartViewer;
}
Also used : TmfXYChartViewer(org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer) PatternScatterGraphView(org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternScatterGraphView) SWTBotView(org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)

Aggregations

TmfXYChartViewer (org.eclipse.tracecompass.tmf.ui.viewers.xychart.TmfXYChartViewer)9 Action (org.eclipse.jface.action.Action)4 IAction (org.eclipse.jface.action.IAction)4 Chart (org.eclipse.swtchart.Chart)4 TmfViewer (org.eclipse.tracecompass.tmf.ui.viewers.TmfViewer)4 ITmfTrace (org.eclipse.tracecompass.tmf.core.trace.ITmfTrace)3 SWTBotView (org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView)2 TmfSignalHandler (org.eclipse.tracecompass.tmf.core.signal.TmfSignalHandler)2 TmfTraceSelectedSignal (org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal)2 TmfTimeViewer (org.eclipse.tracecompass.tmf.ui.viewers.TmfTimeViewer)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Set (java.util.Set)1 TreeSet (java.util.TreeSet)1 NonNull (org.eclipse.jdt.annotation.NonNull)1 Nullable (org.eclipse.jdt.annotation.Nullable)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 IStatusLineManager (org.eclipse.jface.action.IStatusLineManager)1 IToolBarManager (org.eclipse.jface.action.IToolBarManager)1 Separator (org.eclipse.jface.action.Separator)1