1 /*******************************************************************************
2 * Copyright (c) 2015, 2016 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made 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
10 * France Lapointe Nguyen - Initial API and implementation
11 * Bernd Hufmann - Move abstract class to TMF
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.analysis
.timing
.ui
.views
.segmentstore
.table
;
16 import org
.eclipse
.jdt
.annotation
.Nullable
;
17 import org
.eclipse
.jface
.viewers
.TableViewer
;
18 import org
.eclipse
.swt
.SWT
;
19 import org
.eclipse
.swt
.custom
.SashForm
;
20 import org
.eclipse
.swt
.widgets
.Composite
;
21 import org
.eclipse
.tracecompass
.tmf
.ui
.views
.TmfView
;
24 * View for displaying a segment store analysis in a table.
26 * @author France Lapointe Nguyen
29 public abstract class AbstractSegmentStoreTableView
extends TmfView
{
31 // ------------------------------------------------------------------------
33 // ------------------------------------------------------------------------
35 private @Nullable AbstractSegmentStoreTableViewer fSegmentStoreViewer
;
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
44 public AbstractSegmentStoreTableView() {
45 super(""); //$NON-NLS-1$
48 // ------------------------------------------------------------------------
50 // ------------------------------------------------------------------------
53 public void createPartControl(@Nullable Composite parent
) {
54 SashForm sf
= new SashForm(parent
, SWT
.NONE
);
55 TableViewer tableViewer
= new TableViewer(sf
, SWT
.FULL_SELECTION
| SWT
.VIRTUAL
);
56 fSegmentStoreViewer
= createSegmentStoreViewer(tableViewer
);
60 // ------------------------------------------------------------------------
62 // ------------------------------------------------------------------------
65 public void setFocus() {
66 if (fSegmentStoreViewer
!= null) {
67 fSegmentStoreViewer
.getTableViewer().getControl().setFocus();
72 public void dispose() {
74 if (fSegmentStoreViewer
!= null) {
75 fSegmentStoreViewer
.dispose();
80 * Returns the latency analysis table viewer instance
83 * the table viewer to use
84 * @return the latency analysis table viewer instance
86 protected abstract AbstractSegmentStoreTableViewer
createSegmentStoreViewer(TableViewer tableViewer
);
89 * Get the table viewer
91 * @return the table viewer, useful for testing
94 public AbstractSegmentStoreTableViewer
getSegmentStoreViewer() {
95 return fSegmentStoreViewer
;
99 * Set initial data into the viewer
101 private void setInitialData() {
102 if (fSegmentStoreViewer
!= null) {
103 fSegmentStoreViewer
.setData(fSegmentStoreViewer
.getAnalysisModule());