timing: Add a generic table view for any segment provider
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Thu, 22 Sep 2016 01:04:53 +0000 (21:04 -0400)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 25 Oct 2016 17:44:51 +0000 (13:44 -0400)
It uses the analysis ID as the secondary ID of the view, it is thus not
necessary anymore to implement a concrete view for each segment store
analysis.

Change-Id: I9a596ac8217a1ba9233a345ec917d1488f170737
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/78803
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/latency.png [new file with mode: 0644]
analysis/org.eclipse.tracecompass.analysis.timing.ui/plugin.properties
analysis/org.eclipse.tracecompass.analysis.timing.ui/plugin.xml
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableView.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/SegmentStoreTableView.java [new file with mode: 0644]
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/SegmentStoreTableViewer.java [new file with mode: 0644]
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/Messages.java
analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/messages.properties

diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/latency.png b/analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/latency.png
new file mode 100644 (file)
index 0000000..723b8da
Binary files /dev/null and b/analysis/org.eclipse.tracecompass.analysis.timing.ui/icons/eview16/latency.png differ
index 149a20ff5a26a7572f206d17f17159614f94bae5..f7eaa3bfff791cb0d8a7ccb110c57d4654b6d758 100644 (file)
@@ -14,5 +14,6 @@ view.criticalpath = Critical Flow View
 view.execgraph = Execution Graph View
 view.callgraphDensity= Function Durations Distribution
 view.flameGraph= Flame Graph
+view.segstore.table = Segment Store Table
 
-callgraph.analysis = Call Graph Analysis
\ No newline at end of file
+callgraph.analysis = Call Graph Analysis
index 613ab07459404d6f0014206b820e185910edca40..5b9c9c838588bf3232b75bb64c8ce3b50f47a053 100644 (file)
             name="%view.flameGraph"
             restorable="true">
       </view>
+      <view
+            category="org.eclipse.linuxtools.tmf.ui.views.category"
+            class="org.eclipse.tracecompass.analysis.timing.ui.views.segmentstore.table.SegmentStoreTableView"
+            icon="icons/eview16/latency.png"
+            id="org.eclipse.tracecompass.analysis.timing.ui.segstore.table"
+            name="%view.segstore.table"
+            restorable="true">
+      </view>
    </extension>
 </plugin>
index 8b6fd47875c71696f85bee50d1d0c1282890a978..9e2ba8f5c054262e26c56f6921884d4cfd37771e 100644 (file)
@@ -29,6 +29,9 @@ import org.eclipse.swt.widgets.Table;
 import org.eclipse.swt.widgets.TableColumn;
 import org.eclipse.swt.widgets.TableItem;
 import org.eclipse.tracecompass.internal.analysis.timing.ui.views.segmentstore.ExportToTsvAction;
+import org.eclipse.tracecompass.tmf.core.signal.TmfTraceSelectedSignal;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+import org.eclipse.tracecompass.tmf.core.trace.TmfTraceManager;
 import org.eclipse.tracecompass.tmf.ui.views.TmfView;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -78,10 +81,18 @@ public abstract class AbstractSegmentStoreTableView extends TmfView {
 
     @Override
     public void createPartControl(@Nullable Composite parent) {
+        super.createPartControl(parent);
         SashForm sf = new SashForm(parent, SWT.NONE);
         TableViewer tableViewer = new TableViewer(sf, SWT.FULL_SELECTION | SWT.VIRTUAL);
         fSegmentStoreViewer = createSegmentStoreViewer(tableViewer);
         getViewSite().getActionBars().getMenuManager().add(fExportAction);
+        ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
+        if (trace != null) {
+            TmfTraceSelectedSignal signal = new TmfTraceSelectedSignal(this, trace);
+            if (fSegmentStoreViewer != null) {
+                fSegmentStoreViewer.traceSelected(signal);
+            }
+        }
         setInitialData();
     }
 
index b9994191e96fb4885b3fac20066d77b13ebfd1c4..a3484bbcdef16d04463b57978e9df979d74e7b34 100644 (file)
@@ -144,10 +144,6 @@ public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableView
         super(tableViewer);
         // Sort order of the content provider is by start time by default
         getTableViewer().setContentProvider(new SegmentStoreContentProvider());
-        ITmfTrace trace = TmfTraceManager.getInstance().getActiveTrace();
-        if (trace != null) {
-            fSegmentProvider = getSegmentStoreProvider(trace);
-        }
         createColumns();
         getTableViewer().getTable().addSelectionListener(new TableSelectionListener());
         addPackListener();
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/SegmentStoreTableView.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/SegmentStoreTableView.java
new file mode 100644 (file)
index 0000000..2c248c6
--- /dev/null
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2016 École Polytechnique de Montréal
+ *
+ * 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.analysis.timing.ui.views.segmentstore.table;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.tracecompass.common.core.NonNullUtils;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * View for displaying a segment store analysis in a table.
+ *
+ * @author Geneviève Bastien
+ * @since 1.2
+ */
+public class SegmentStoreTableView extends AbstractSegmentStoreTableView {
+
+    /**
+     * ID of this view
+     */
+    public static final String ID = "org.eclipse.tracecompass.analysis.timing.ui.segstore.table"; //$NON-NLS-1$
+
+    @Override
+    public void createPartControl(@Nullable Composite parent) {
+        super.createPartControl(parent);
+        setPartName(PlatformUI.getWorkbench().getViewRegistry().find(getViewId()).getLabel());
+    }
+
+    @Override
+    protected @NonNull AbstractSegmentStoreTableViewer createSegmentStoreViewer(@NonNull TableViewer tableViewer) {
+        // Set the title of this view
+        String analysisId = NonNullUtils.nullToEmptyString(getViewSite().getSecondaryId());
+        return new SegmentStoreTableViewer(tableViewer, analysisId);
+    }
+}
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/SegmentStoreTableViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/SegmentStoreTableViewer.java
new file mode 100644 (file)
index 0000000..fd8e093
--- /dev/null
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2016 École Polytechnique de Montréal
+ *
+ * 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.analysis.timing.ui.views.segmentstore.table;
+
+import org.eclipse.jdt.annotation.Nullable;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.tracecompass.analysis.timing.core.segmentstore.ISegmentStoreProvider;
+import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
+import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
+
+/**
+ * Displays the segment store provider data in a column table
+ *
+ * @author Geneviève Bastien
+ * @since 1.2
+ */
+public class SegmentStoreTableViewer extends AbstractSegmentStoreTableViewer {
+
+    private final String fAnalysisId;
+
+    // ------------------------------------------------------------------------
+    // Constructor
+    // ------------------------------------------------------------------------
+
+    /**
+     * Constructor
+     *
+     * @param tableViewer
+     *            Table viewer of the view
+     * @param analysisId
+     *            The ID of the analysis this viewer is for
+     */
+    public SegmentStoreTableViewer(TableViewer tableViewer, String analysisId) {
+        super(tableViewer);
+        fAnalysisId = analysisId;
+    }
+
+    @Override
+    protected @Nullable ISegmentStoreProvider getSegmentStoreProvider(ITmfTrace trace) {
+        IAnalysisModule module = trace.getAnalysisModule(fAnalysisId);
+        if (!(module instanceof ISegmentStoreProvider)) {
+            return null;
+        }
+        return (ISegmentStoreProvider) module;
+    }
+
+}
index d986224cf8a7b3ab7b6f4ac743f18f700d5413b5..c7e8d8a8279fb15fd49e3255fb0718bf42a2a7d6 100644 (file)
@@ -47,6 +47,9 @@ public class Messages extends NLS {
      */
     public static String SegmentStoreTableViewer_goToEndEvent;
 
+    /** Title of the table, to be appended to the analysis name for the title of the view */
+    public static String SegmentStoreTableViewer_genericTitle;
+
     static {
         // initialize resource bundle
         NLS.initializeMessages(BUNDLE_NAME, Messages.class);
This page took 0.028838 seconds and 5 git commands to generate.