--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density.AbstractSegmentStoreDensityView;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density.AbstractSegmentStoreDensityViewer;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.AbstractSegmentStoreTableViewer;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlLatencyViewInfo;
+
+/**
+ * Displays the latency density view for pattern analysis
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternDensityView extends AbstractSegmentStoreDensityView {
+
+ /** The view's ID */
+ public static final @NonNull String ID = "org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.density"; //$NON-NLS-1$
+
+ private final XmlLatencyViewInfo fViewInfo = new XmlLatencyViewInfo(ID);
+
+ private PatternDensityViewer fDensityViewer;
+ private PatternLatencyTableViewer fTableViewer;
+
+ /**
+ * Constructor
+ */
+ public PatternDensityView() {
+ super(ID);
+ this.addPartPropertyListener(new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equals(TmfXmlUiStrings.XML_LATENCY_OUTPUT_DATA)) {
+ Object newValue = event.getNewValue();
+ if (newValue instanceof String) {
+ String data = (String) newValue;
+ fViewInfo.setViewData(data);
+ loadTableViewer();
+ loadDensityViewer();
+ }
+ }
+ }
+ });
+ }
+
+ private void loadTableViewer() {
+ if (fTableViewer != null) {
+ fTableViewer.updateViewer(fViewInfo.getViewAnalysisId());
+ }
+ }
+
+ private void loadDensityViewer() {
+ if (fDensityViewer != null) {
+ fDensityViewer.updateViewer(fViewInfo.getViewAnalysisId());
+ }
+ }
+
+ @Override
+ protected @NonNull AbstractSegmentStoreTableViewer createSegmentStoreTableViewer(@NonNull Composite parent) {
+ PatternLatencyTableViewer tableViewer = new PatternLatencyTableViewer(new TableViewer(parent, SWT.FULL_SELECTION | SWT.VIRTUAL)) {
+ @Override
+ protected void createProviderColumns() {
+ super.createProviderColumns();
+ Table t = (Table) getControl();
+ t.setColumnOrder(new int[] { 0, 1, 2, 3, 4});
+ }
+ };
+ fTableViewer = tableViewer;
+ loadTableViewer();
+ return tableViewer;
+ }
+
+ @Override
+ protected @NonNull AbstractSegmentStoreDensityViewer createSegmentStoreDensityViewer(@NonNull Composite parent) {
+ PatternDensityViewer densityViewer = new PatternDensityViewer(NonNullUtils.checkNotNull(parent));
+ fDensityViewer = densityViewer;
+ loadDensityViewer();
+ return densityViewer;
+ }
+}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2016 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency;
+
+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.ISegmentStoreProvider;
+import org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.density.AbstractSegmentStoreDensityViewer;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.pattern.stateprovider.XmlPatternAnalysis;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
+
+/**
+ * Displays the latency analysis data in a density chart
+ *
+ * @author Jean-Christian Kouame
+ */
+public class PatternDensityViewer extends AbstractSegmentStoreDensityViewer {
+
+ private String fAnalysisId;
+
+ /**
+ * Contructor
+ *
+ * @param parent
+ * The parent composite
+ */
+ public PatternDensityViewer(@NonNull Composite parent) {
+ super(parent);
+ }
+
+ @Override
+ protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(@NonNull ITmfTrace trace) {
+ return fAnalysisId != null ? TmfTraceUtils.getAnalysisModuleOfClass(trace, XmlPatternAnalysis.class, fAnalysisId) : null;
+ }
+
+ /**
+ * Set the analysis ID and update the view
+ *
+ * @param analysisId
+ * The analysis ID
+ */
+ public void updateViewer(String analysisId) {
+ if (analysisId != null) {
+ fAnalysisId = analysisId;
+ final ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
+ if (trace != null) {
+ loadTrace(trace);
+ }
+ }
+ }
+}
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.TmfXmlUiStrings;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.module.Messages;
+import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternDensityView;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternLatencyTableView;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.latency.PatternScatterGraphView;
import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.xychart.XmlXYView;
/**
* Latency Scatter View type
*/
- SCATTER_GRAPH(PatternScatterGraphView.ID, Messages.TmfXmlAnalysisOutputSource_ScatterGraphTitle);
+ SCATTER_GRAPH(PatternScatterGraphView.ID, Messages.TmfXmlAnalysisOutputSource_ScatterGraphTitle),
+
+ /**
+ * Latency Density View type
+ */
+ DENSITY_VIEW(PatternDensityView.ID, Messages.TmfXmlAnalysisOutputSource_DensityChartTitle);
private @NonNull String fLatencyViewId;
private String fLatencyViewLabel;