From: Alexandre Montplaisir Date: Fri, 18 Mar 2016 23:41:38 +0000 (-0400) Subject: tmf: Introduce "External Analyses" and "Reports" project elements X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;ds=sidebyside;h=ddfa2689d7153b78f0067538076a442314b65867;p=deliverable%2Ftracecompass.git tmf: Introduce "External Analyses" and "Reports" project elements 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 Reviewed-on: https://git.eclipse.org/r/70717 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- 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 index 0000000000..052915a19b 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 index 0000000000..c1e4ee3a59 Binary files /dev/null and b/tmf/org.eclipse.tracecompass.tmf.ui/icons/obj16/debugt_obj.gif differ diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java index 77b8e53423..863d79d977 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java @@ -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; diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java index fa86e7a705..b73c9e33f7 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfCommonProjectElement.java @@ -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 index 0000000000..be592736ae --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfOnDemandAnalysesElement.java @@ -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 */ + } + +} diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfProjectModelIcons.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfProjectModelIcons.java index 09acdda3bf..14b18cd637 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfProjectModelIcons.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfProjectModelIcons.java @@ -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 index 0000000000..a5b187989a --- /dev/null +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfReportsElement.java @@ -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 */ + } + +} diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties index c332c0d7ca..36950d5ec0 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties @@ -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}