Commit | Line | Data |
---|---|---|
5b901f94 JCK |
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; | |
fb042960 | 15 | import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentsStatisticsView; |
5b901f94 JCK |
16 | import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings; |
17 | import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlLatencyViewInfo; | |
fb042960 | 18 | import org.eclipse.tracecompass.tmf.ui.viewers.tree.AbstractTmfTreeViewer; |
5b901f94 JCK |
19 | |
20 | /** | |
21 | * The statistic view for pattern latency analysis | |
22 | * | |
23 | * @author Jean-Christian Kouame | |
24 | */ | |
fb042960 | 25 | public class PatternStatisticsView extends AbstractSegmentsStatisticsView { |
5b901f94 JCK |
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 | loadStatisticView(); | |
46 | } | |
47 | } | |
48 | } | |
49 | }); | |
50 | } | |
51 | ||
52 | private void loadStatisticView() { | |
53 | if (fViewer != null) { | |
54 | fViewer.updateViewer(fViewInfo.getViewAnalysisId()); | |
55 | } | |
56 | } | |
57 | ||
58 | @Override | |
fb042960 | 59 | protected @NonNull AbstractTmfTreeViewer createSegmentStoreStatisticsViewer(@NonNull Composite parent) { |
5b901f94 JCK |
60 | PatternStatisticsViewer viewer = new PatternStatisticsViewer(parent); |
61 | fViewer = viewer; | |
62 | loadStatisticView(); | |
63 | return viewer; | |
64 | } | |
65 | } |