timing.ui: move logic of segment stats logic to abstract class
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / tracecompass / internal / tmf / analysis / xml / ui / views / latency / PatternStatisticsViewer.java
index a0a6f16f4d0ce6d1e12f4541b753113033561a07..916a788fdd01f4171ad77397da98a14f9d4fde3d 100644 (file)
@@ -8,21 +8,12 @@
  *******************************************************************************/
 package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
 
-import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.tracecompass.analysis.timing.core.segmentstore.statistics.SegmentStoreStatistics;
 import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.statistics.AbstractSegmentStoreStatisticsViewer;
 import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternLatencyStatisticsAnalysis;
 import org.eclipse.tracecompass.tmf.core.analysis.TmfAbstractAnalysisModule;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.ITmfTreeViewerEntry;
-import org.eclipse.tracecompass.tmf.ui.viewers.tree.TmfTreeViewerEntry;
 
 /**
  * A tree viewer implementation for displaying pattern latency statistics
@@ -51,40 +42,8 @@ public class PatternStatisticsViewer extends AbstractSegmentStoreStatisticsViewe
     }
 
     @Override
-    protected ITmfTreeViewerEntry updateElements(long start, long end, boolean isSelection) {
-        if (isSelection || (start == end)) {
-            return null;
-        }
-
-        TmfAbstractAnalysisModule analysisModule = getStatisticsAnalysisModule();
-
-        if (getTrace() == null || !(analysisModule instanceof XmlPatternLatencyStatisticsAnalysis)) {
-            return null;
-        }
-
-        XmlPatternLatencyStatisticsAnalysis module = (XmlPatternLatencyStatisticsAnalysis) analysisModule;
-
-        module.waitForCompletion();
-
-        TmfTreeViewerEntry root = new TmfTreeViewerEntry(""); //$NON-NLS-1$
-        final SegmentStoreStatistics entry = module.getTotalStats();
-        if (entry != null) {
-
-            List<ITmfTreeViewerEntry> entryList = root.getChildren();
-
-            TmfTreeViewerEntry child = new SegmentStoreStatisticsEntry(checkNotNull("Total"), entry); //$NON-NLS-1$
-            entryList.add(child);
-            HiddenTreeViewerEntry segments = new HiddenTreeViewerEntry(PATTERN_SEGMENTS_LEVEL);
-            child.addChild(segments);
-
-            final Map<@NonNull String, @NonNull SegmentStoreStatistics> perTypeStats = module.getPerSegmentTypeStats();
-            if (perTypeStats != null) {
-                for (Entry<@NonNull String, @NonNull SegmentStoreStatistics> statsEntry : perTypeStats.entrySet()) {
-                    segments.addChild(new SegmentStoreStatisticsEntry(statsEntry.getKey(), statsEntry.getValue()));
-                }
-            }
-        }
-        return root;
+    protected @NonNull String getTypeLabel() {
+        return PATTERN_SEGMENTS_LEVEL;
     }
 
     /**
This page took 0.024753 seconds and 5 git commands to generate.