timing: Add a generic table view for any segment provider
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.timing.ui / src / org / eclipse / tracecompass / analysis / timing / ui / views / segmentstore / table / SegmentStoreTableViewer.java
1 /*******************************************************************************
2 * Copyright (c) 2016 École Polytechnique de Montréal
3 *
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
8 *******************************************************************************/
9
10 package org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table;
11
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.eclipse.jface.viewers.TableViewer;
14 import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider;
15 import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
16 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
17
18 /**
19 * Displays the segment store provider data in a column table
20 *
21 * @author Geneviève Bastien
22 * @since 1.2
23 */
24 public class SegmentStoreTableViewer extends AbstractSegmentStoreTableViewer {
25
26 private final String fAnalysisId;
27
28 // ------------------------------------------------------------------------
29 // Constructor
30 // ------------------------------------------------------------------------
31
32 /**
33 * Constructor
34 *
35 * @param tableViewer
36 * Table viewer of the view
37 * @param analysisId
38 * The ID of the analysis this viewer is for
39 */
40 public SegmentStoreTableViewer(TableViewer tableViewer, String analysisId) {
41 super(tableViewer);
42 fAnalysisId = analysisId;
43 }
44
45 @Override
46 protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(ITmfTrace trace) {
47 IAnalysisModule module = trace.getAnalysisModule(fAnalysisId);
48 if (!(module instanceof ISegmentStoreProvider)) {
49 return null;
50 }
51 return (ISegmentStoreProvider) module;
52 }
53
54 }
This page took 0.032522 seconds and 5 git commands to generate.