tmf : Add latency density 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 / PatternDensityViewer.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.swt.widgets.Composite;
14 import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider;
15 import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density.AbstractSegmentStoreDensityViewer;
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 density chart
23 *
24 * @author Jean-Christian Kouame
25 */
26 public class PatternDensityViewer extends AbstractSegmentStoreDensityViewer {
27
28 private String fAnalysisId;
29
30 /**
31 * Contructor
32 *
33 * @param parent
34 * The parent composite
35 */
36 public PatternDensityViewer(@NonNull Composite parent) {
37 super(parent);
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 loadTrace(trace);
57 }
58 }
59 }
60 }
This page took 0.032475 seconds and 5 git commands to generate.