lttng: Add latency statistics
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.ui / src / org / eclipse / tracecompass / internal / analysis / os / linux / ui / views / latency / statistics / AbstractLatencyStatisticsView.java
CommitLineData
ce8319b6
BH
1/*******************************************************************************
2 * Copyright (c) 2015 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.tracecompass.internal.analysis.os.linux.ui.views.latency.statistics;
14
15import org.eclipse.jdt.annotation.Nullable;
16import org.eclipse.swt.widgets.Composite;
17import org.eclipse.tracecompass.common.core.NonNullUtils;
18import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
19import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
20import org.eclipse.tracecompass.tmf.ui.views.TmfView;
21
22/**
23 * Abstract view to to be extended to display latency statistics.
24 *
25 * @author Bernd Hufmann
26 *
27 */
28public abstract class AbstractLatencyStatisticsView extends TmfView {
29
30 @Nullable private AbstractLatencyStatisticsViewer fStatsViewer = null;
31
32 /**
33 * Constructor
34 */
35 public AbstractLatencyStatisticsView() {
36 super("StatisticsView"); //$NON-NLS-1$
37 }
38
39 @Override
40 public void createPartControl(@Nullable Composite parent) {
41 super.createPartControl(parent);
42 AbstractLatencyStatisticsViewer statsViewer = createLatencyStatisticsViewer(NonNullUtils.checkNotNull(parent));
43 ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
44 if (trace != null) {
45 statsViewer.loadTrace(trace);
46 }
47 fStatsViewer = statsViewer;
48 }
49
50 @Override
51 public void setFocus() {
52 AbstractLatencyStatisticsViewer statsViewer = fStatsViewer;
53 if (statsViewer != null) {
54 statsViewer.getControl().setFocus();
55 }
56 }
57
58 @Override
59 public void dispose() {
60 super.dispose();
61 AbstractLatencyStatisticsViewer statsViewer = fStatsViewer;
62 if (statsViewer != null) {
63 statsViewer.dispose();
64 }
65 }
66
67 /**
68 * Creates a latency statistics viewer instance.
69 *
70 * @param parent
71 * the parent composite to create the viewer in.
72 * @return the latency statistics viewer implementation
73 */
74 protected abstract AbstractLatencyStatisticsViewer createLatencyStatisticsViewer(Composite parent);
75
76}
This page took 0.028213 seconds and 5 git commands to generate.