52c19da524f1b62270c66368929c335b26f8c11c
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / tracecompass / internal / tmf / analysis / xml / ui / views / latency / PatternStatisticsView.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.jface.util.IPropertyChangeListener;
13 import org.eclipse.jface.util.PropertyChangeEvent;
14 import org.eclipse.swt.widgets.Composite;
15 import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentsStatisticsView;
16 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
17 import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlLatencyViewInfo;
18 import org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractTmfTreeViewer;
19
20 /**
21 * The statistic view for pattern latency analysis
22 *
23 * @author Jean-Christian Kouame
24 */
25 public class PatternStatisticsView extends AbstractSegmentsStatisticsView {
26
27 private PatternStatisticsViewer fViewer;
28 /** The view's ID */
29 public static final @NonNull String ID = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.statistics"; //$NON-NLS-1$
30
31 private final XmlLatencyViewInfo fViewInfo = new XmlLatencyViewInfo(ID);
32
33 /**
34 * Constructor
35 */
36 public PatternStatisticsView() {
37 this.addPartPropertyListener(new IPropertyChangeListener() {
38 @Override
39 public void propertyChange(PropertyChangeEvent event) {
40 if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) {
41 Object newValue = event.getNewValue();
42 if (newValue instanceof String) {
43 String data = (String) newValue;
44 fViewInfo.setViewData(data);
45 setPartName(fViewInfo.getLabel());
46 loadStatisticView();
47 }
48 }
49 }
50 });
51 }
52
53 private void loadStatisticView() {
54 if (fViewer != null) {
55 fViewer.updateViewer(fViewInfo.getViewAnalysisId());
56 }
57 }
58
59 @Override
60 protected @NonNull AbstractTmfTreeViewer createSegmentStoreStatisticsViewer(@NonNull Composite parent) {
61 PatternStatisticsViewer viewer = new PatternStatisticsViewer(parent);
62 fViewer = viewer;
63 loadStatisticView();
64 return viewer;
65 }
66 }
This page took 0.033121 seconds and 5 git commands to generate.