069c67442f6e4409eaec089777dea4e56a784ef9
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.timing.ui / src / org / eclipse / tracecompass / analysis / timing / ui / views / segmentstore / statistics / AbstractSegmentStoreStatisticsView.java
1 /*******************************************************************************
2 * Copyright (c) 2015, 2016 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 package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics;
13
14 import org.eclipse.jdt.annotation.Nullable;
15 import org.eclipse.swt.widgets.Composite;
16 import org.eclipse.tracecompass.common.core.NonNullUtils;
17 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
18 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
19 import org.eclipse.tracecompass.tmf.ui.views.TmfView;
20
21 /**
22 * Abstract view to to be extended to display segment store statistics.
23 *
24 * @author Bernd Hufmann
25 *
26 */
27 public abstract class AbstractSegmentStoreStatisticsView extends TmfView {
28
29 @Nullable private AbstractSegmentStoreStatisticsViewer fStatsViewer = null;
30
31 /**
32 * Constructor
33 */
34 public AbstractSegmentStoreStatisticsView() {
35 super("StatisticsView"); //$NON-NLS-1$
36 }
37
38 @Override
39 public void createPartControl(@Nullable Composite parent) {
40 super.createPartControl(parent);
41 AbstractSegmentStoreStatisticsViewer statsViewer = createSegmentStoreStatisticsViewer(NonNullUtils.checkNotNull(parent));
42 ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
43 if (trace != null) {
44 statsViewer.loadTrace(trace);
45 }
46 fStatsViewer = statsViewer;
47 }
48
49 @Override
50 public void setFocus() {
51 AbstractSegmentStoreStatisticsViewer statsViewer = fStatsViewer;
52 if (statsViewer != null) {
53 statsViewer.getControl().setFocus();
54 }
55 }
56
57 @Override
58 public void dispose() {
59 super.dispose();
60 AbstractSegmentStoreStatisticsViewer statsViewer = fStatsViewer;
61 if (statsViewer != null) {
62 statsViewer.dispose();
63 }
64 }
65
66 /**
67 * Creates a segment store statistics viewer instance.
68 *
69 * @param parent
70 * the parent composite to create the viewer in.
71 * @return the latency statistics viewer implementation
72 */
73 protected abstract AbstractSegmentStoreStatisticsViewer createSegmentStoreStatisticsViewer(Composite parent);
74
75 }
This page took 0.038247 seconds and 4 git commands to generate.