tmf : Add latency table view for the pattern analysis
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / tracecompass / internal / tmf / analysis / xml / ui / views / latency / PatternLatencyTableViewer.java
1 /*******************************************************************************
2 * Copyright (c) 2016 Ericsson
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 package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
10
11 import org.eclipse.jdt.annotation.NonNull;
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.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer;
16 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis;
17 import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
18 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
19 import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
20
21 /**
22 * Displays the latency analysis data in a column table
23 *
24 * @author Jean-Christian Kouame
25 */
26 public class PatternLatencyTableViewer extends AbstractSegmentStoreTableViewer {
27
28 private String fAnalysisId;
29
30 /**
31 * Constructor
32 *
33 * @param tableViewer
34 * The table viewer
35 */
36 public PatternLatencyTableViewer(@NonNull TableViewer tableViewer) {
37 super(tableViewer);
38 }
39
40 @Override
41 protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) {
42 return fAnalysisId != null ? TmfTraceUtils.getAnalysisModuleOfClass(trace, XmlPatternAnalysis.class, fAnalysisId) : null;
43 }
44
45 /**
46 * Set the analysis ID and update the view
47 *
48 * @param analysisId
49 * The analysis ID
50 */
51 public void updateViewer(String analysisId) {
52 if (analysisId != null) {
53 fAnalysisId = analysisId;
54 final ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
55 if (trace != null) {
56 setData(getSegmentStoreProvider(trace));
57 }
58 }
59 }
60
61 }
This page took 0.03278 seconds and 5 git commands to generate.