Commit | Line | Data |
---|---|---|
ce8319b6 | 1 | /******************************************************************************* |
658401c8 | 2 | * Copyright (c) 2015, 2016 Ericsson |
ce8319b6 BH |
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 | *******************************************************************************/ | |
658401c8 | 12 | package org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.statistics; |
ce8319b6 BH |
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 | /** | |
3507ca88 | 22 | * Abstract view to to be extended to display segment store statistics. |
ce8319b6 BH |
23 | * |
24 | * @author Bernd Hufmann | |
25 | * | |
26 | */ | |
3507ca88 | 27 | public abstract class AbstractSegmentStoreStatisticsView extends TmfView { |
ce8319b6 | 28 | |
3507ca88 | 29 | @Nullable private AbstractSegmentStoreStatisticsViewer fStatsViewer = null; |
ce8319b6 BH |
30 | |
31 | /** | |
32 | * Constructor | |
33 | */ | |
3507ca88 | 34 | public AbstractSegmentStoreStatisticsView() { |
ce8319b6 BH |
35 | super("StatisticsView"); //$NON-NLS-1$ |
36 | } | |
37 | ||
38 | @Override | |
39 | public void createPartControl(@Nullable Composite parent) { | |
40 | super.createPartControl(parent); | |
3507ca88 | 41 | AbstractSegmentStoreStatisticsViewer statsViewer = createSegmentStoreStatisticsViewer(NonNullUtils.checkNotNull(parent)); |
ce8319b6 BH |
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() { | |
3507ca88 | 51 | AbstractSegmentStoreStatisticsViewer statsViewer = fStatsViewer; |
ce8319b6 BH |
52 | if (statsViewer != null) { |
53 | statsViewer.getControl().setFocus(); | |
54 | } | |
55 | } | |
56 | ||
57 | @Override | |
58 | public void dispose() { | |
59 | super.dispose(); | |
3507ca88 | 60 | AbstractSegmentStoreStatisticsViewer statsViewer = fStatsViewer; |
ce8319b6 BH |
61 | if (statsViewer != null) { |
62 | statsViewer.dispose(); | |
63 | } | |
64 | } | |
65 | ||
66 | /** | |
3507ca88 | 67 | * Creates a segment store statistics viewer instance. |
ce8319b6 BH |
68 | * |
69 | * @param parent | |
70 | * the parent composite to create the viewer in. | |
71 | * @return the latency statistics viewer implementation | |
72 | */ | |
3507ca88 | 73 | protected abstract AbstractSegmentStoreStatisticsViewer createSegmentStoreStatisticsViewer(Composite parent); |
ce8319b6 BH |
74 | |
75 | } |