tmf: Introduce "External Analyses" and "Reports" project elements
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Fri, 18 Mar 2016 23:41:38 +0000 (19:41 -0400)
committerAlexandre Montplaisir <alexmonthy@efficios.com>
Tue, 3 May 2016 17:22:39 +0000 (13:22 -0400)
These will contain the upcoming LTTng-Analyses wrappers, along
with the reports they will produce.

"External Analyses" will be refered to as "on-demand analyses" in
the code, as this is what this sub-tree will eventually become.
We can use this name for now to better differentiate with the
"standard" analyses, which are still shown in the Project View.

Change-Id: I9ef5296f22a121a7b8bc85c4681a43e7a5ee5054
Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Reviewed-on: https://git.eclipse.org/r/70717
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/arraypartition_obj.gif [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/debugt_obj.gif [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOnDemandAnalysesElement.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfProjectModelIcons.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfReportsElement.java [new file with mode: 0644]
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties

diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/arraypartition_obj.gif b/tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/arraypartition_obj.gif
new file mode 100644 (file)
index 0000000..052915a
Binary files /dev/null and b/tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/arraypartition_obj.gif differ
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/debugt_obj.gif b/tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/debugt_obj.gif
new file mode 100644 (file)
index 0000000..c1e4ee3
Binary files /dev/null and b/tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/debugt_obj.gif differ
index 77b8e534236d3855d4eecc53d1de3103c9aacb70..863d79d9774991f562b85dcc99ec875239885c43 100644 (file)
@@ -106,6 +106,14 @@ public class Messages extends NLS {
      * @since 2.0*/
     public static String TmfViewsElement_Name;
 
+    /** Name of the element "On-demand Analyses"
+     * @since 2.0*/
+    public static String TmfOnDemandAnalysesElement_Name;
+
+    /** Name of the element "Reports"
+     * @since 2.0*/
+    public static String TmfReportsElement_Name;
+
     /**
      * The title for the select trace type dialog */
     public static String TmfTraceType_SelectTraceType;
index fa86e7a705b3bb38d2ca422a6e29de4f6f3b47ac..b73c9e33f7e44a3291a93b5ab2c4e28e988bfaed 100644 (file)
@@ -28,6 +28,7 @@ import org.eclipse.core.resources.IContainer;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IFolder;
 import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
@@ -71,7 +72,10 @@ public abstract class TmfCommonProjectElement extends TmfProjectModelElement {
 
     private static final String BOOKMARKS_HIDDEN_FILE = ".bookmarks"; //$NON-NLS-1$
 
+    /* Direct child elements */
     private TmfViewsElement fViewsElement = null;
+    private TmfOnDemandAnalysesElement fOnDemandAnalysesElement = null;
+    private TmfReportsElement fReportsElement = null;
 
     /** This trace type ID as defined in plugin.xml */
     private String fTraceTypeId = null;
@@ -107,14 +111,31 @@ public abstract class TmfCommonProjectElement extends TmfProjectModelElement {
     protected void refreshChildren() {
         /* Get the base path to put the resource to */
         IPath tracePath = getResource().getFullPath();
+        IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
 
         if (fViewsElement == null) {
             /* Add the "Views" node */
-            IFolder viewsNodeRes = ResourcesPlugin.getWorkspace().getRoot().getFolder(tracePath.append(TmfViewsElement.PATH_ELEMENT));
+            IFolder viewsNodeRes = root.getFolder(tracePath.append(TmfViewsElement.PATH_ELEMENT));
             fViewsElement = new TmfViewsElement(viewsNodeRes, this);
             addChild(fViewsElement);
         }
         fViewsElement.refreshChildren();
+
+        if (fOnDemandAnalysesElement == null) {
+            /* Add the "On-demand Analyses" node */
+            IFolder analysesNodeRes = root.getFolder(tracePath.append(TmfOnDemandAnalysesElement.PATH_ELEMENT));
+            fOnDemandAnalysesElement = new TmfOnDemandAnalysesElement(analysesNodeRes, this);
+            addChild(fOnDemandAnalysesElement);
+        }
+        fOnDemandAnalysesElement.refreshChildren();
+
+        if (fReportsElement == null) {
+            /* Add the "Reports" node */
+            IFolder reportsNodeRes = root.getFolder(tracePath.append(TmfReportsElement.PATH_ELEMENT));
+            fReportsElement = new TmfReportsElement(reportsNodeRes, this);
+            addChild(fReportsElement);
+        }
+        fReportsElement.refreshChildren();
     }
 
     /**
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOnDemandAnalysesElement.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOnDemandAnalysesElement.java
new file mode 100644 (file)
index 0000000..be59273
--- /dev/null
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
+ *
+ * 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.tmf.ui.project.model;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Project model element for the "On-Demand Analyses" element, which goes under
+ * individual trace and experiment elements.
+ *
+ * It will list the available implementations of IOnDemandAnalysis that can be
+ * executed on this particular trace.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public class TmfOnDemandAnalysesElement extends TmfProjectModelElement {
+
+    /**
+     * Element of the resource path
+     */
+    public static final String PATH_ELEMENT = ".ondemand-analyses"; //$NON-NLS-1$
+
+    private static final String ELEMENT_NAME = Messages.TmfOnDemandAnalysesElement_Name;
+
+    /**
+     * Constructor
+     *
+     * @param resource
+     *            The resource to be associated with this element
+     * @param parent
+     *            The parent element
+     */
+    protected TmfOnDemandAnalysesElement(IResource resource, TmfCommonProjectElement parent) {
+        super(ELEMENT_NAME, resource, parent);
+    }
+
+    @Override
+    public TmfCommonProjectElement getParent() {
+        /* Type enforced at constructor */
+        return (TmfCommonProjectElement) super.getParent();
+    }
+
+    @Override
+    public Image getIcon() {
+        return TmfProjectModelIcons.ONDEMAND_ANALYSES_ICON;
+    }
+
+    @Override
+    protected void refreshChildren() {
+        /* No children at the moment */
+    }
+
+}
index 09acdda3bfc0babf16d1ed51d92a762f4adcb3fe..14b18cd6379946b3a885e4e9fa56bf5faff6caab 100644 (file)
@@ -40,6 +40,8 @@ final class TmfProjectModelIcons {
 
     public static final @NonNull Image FOLDER_ICON;
     public static final @NonNull Image VIEWS_ICON;
+    public static final @NonNull Image ONDEMAND_ANALYSES_ICON;
+    public static final @NonNull Image REPORTS_ICON;
 
     public static final WorkbenchLabelProvider WORKSPACE_LABEL_PROVIDER = new WorkbenchLabelProvider();
 
@@ -47,6 +49,8 @@ final class TmfProjectModelIcons {
     private static final String EXPERIMENT_ICON_FILE = "icons/elcl16/experiment.gif"; //$NON-NLS-1$
     private static final String ANALYSIS_ICON_FILE = "icons/ovr16/experiment_folder_ovr.png"; //$NON-NLS-1$
     private static final String VIEW_ICON_FILE = "icons/obj16/node_obj.gif"; //$NON-NLS-1$
+    private static final String ONDEMAND_ANALYSES_ICON_FILE = "icons/obj16/debugt_obj.gif"; //$NON-NLS-1$
+    private static final String REPORTS_ICON_FILE = "icons/obj16/arraypartition_obj.gif"; //$NON-NLS-1$
 
     // ------------------------------------------------------------------------
     // Initialization
@@ -54,10 +58,13 @@ final class TmfProjectModelIcons {
 
     static {
         ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
+        Bundle bundle = Activator.getDefault().getBundle();
+
         FOLDER_ICON = checkNotNull(sharedImages.getImage(ISharedImages.IMG_OBJ_FOLDER));
         VIEWS_ICON = checkNotNull(sharedImages.getImage(ISharedImages.IMG_OBJ_ELEMENT));
+        ONDEMAND_ANALYSES_ICON = checkNotNull(loadIcon(bundle, ONDEMAND_ANALYSES_ICON_FILE));
+        REPORTS_ICON = checkNotNull(loadIcon(bundle, REPORTS_ICON_FILE));
 
-        Bundle bundle = Activator.getDefault().getBundle();
         DEFAULT_TRACE_ICON = checkNotNull(loadIcon(bundle, TRACE_ICON_FILE));
         DEFAULT_EXPERIMENT_ICON = checkNotNull(loadIcon(bundle, EXPERIMENT_ICON_FILE));
         DEFAULT_ANALYSIS_ICON = checkNotNull(loadIcon(bundle, ANALYSIS_ICON_FILE));
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfReportsElement.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfReportsElement.java
new file mode 100644 (file)
index 0000000..a5b1879
--- /dev/null
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir
+ *
+ * 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.tmf.ui.project.model;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Project model element for the "Reports" element, which lists the analysis
+ * reports that were generated for this trace.
+ *
+ * It acts like a directory for the reports, where each one can be opened or
+ * deleted.
+ *
+ * @author Alexandre Montplaisir
+ * @since 2.0
+ */
+public class TmfReportsElement extends TmfProjectModelElement {
+
+    /**
+     * Element of the resource path
+     */
+    public static final String PATH_ELEMENT = ".reports"; //$NON-NLS-1$
+
+    private static final String ELEMENT_NAME = Messages.TmfReportsElement_Name;
+
+    /**
+     * Constructor
+     *
+     * @param resource
+     *            The resource to be associated with this element
+     * @param parent
+     *            The parent element
+     */
+    protected TmfReportsElement(IResource resource, TmfCommonProjectElement parent) {
+        super(ELEMENT_NAME, resource, parent);
+    }
+
+    @Override
+    public TmfCommonProjectElement getParent() {
+        /* Type enforced at constructor */
+        return (TmfCommonProjectElement) super.getParent();
+    }
+
+    @Override
+    public Image getIcon() {
+        return TmfProjectModelIcons.REPORTS_ICON;
+    }
+
+    @Override
+    protected void refreshChildren() {
+        /* No children at the moment */
+    }
+
+}
index c332c0d7ca2d8720f2fb5f678e796e401f97cd6a..36950d5ec013b149c8684ec1087f17a2a4d22bd6 100644 (file)
@@ -38,6 +38,8 @@ TmfTraceElement_FolderSizeOverflowString=At least {0} bytes in more than {1} fil
 TmfTraceElement_TypeName=Trace
 TmfTraceType_SelectTraceType=Select Trace Type
 TmfViewsElement_Name=Views
+TmfOnDemandAnalysesElement_Name=External Analyses
+TmfReportsElement_Name=Reports
 
 # Open trace error messages
 TmfOpenTraceHelper_ErrorOpeningElement=Error opening {0}
This page took 0.02928 seconds and 5 git commands to generate.