Class TmfCommonProjectElement

java.lang.Object
org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectModelElement
org.eclipse.tracecompass.tmf.ui.project.model.TmfCommonProjectElement
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, ITmfProjectModelElement
Direct Known Subclasses:
TmfExperimentElement, TmfTraceElement

public abstract class TmfCommonProjectElement extends TmfProjectModelElement
Base class for tracing project elements: it implements the common behavior of all project elements: supplementary files, analysis, types, etc.
Author:
Geneviève Bastien
  • Constructor Details

    • TmfCommonProjectElement

      public TmfCommonProjectElement(String name, org.eclipse.core.resources.IResource resource, TmfProjectModelElement parent)
      Constructor. Creates model element.
      Parameters:
      name - The name of the element
      resource - The resource.
      parent - The parent element
  • Method Details

    • dispose

      public void dispose()
      Description copied from interface: ITmfProjectModelElement
      Recursively dispose of the element and its children.
      Since:
      2.3
    • getIcon

      public org.eclipse.swt.graphics.Image getIcon()
      Description copied from interface: ITmfProjectModelElement
      Returns the icon of this element.
      Returns:
      The icon
      Since:
      2.0
    • getChildElementReports

      public TmfReportsElement getChildElementReports()
      Get the child element "Reports".
      Returns:
      The Reports child element
      Since:
      2.0
    • getTraceType

      public String getTraceType()
      Returns the trace type ID.
      Returns:
      trace type ID.
    • refreshTraceType

      public void refreshTraceType()
      Refreshes the trace type field by reading the trace type persistent property of the resource.
    • instantiateTrace

      public abstract ITmfTrace instantiateTrace()
      Instantiate a ITmfTrace object based on the trace type and the corresponding extension.
      Returns:
      the ITmfTrace or null for an error
    • getElementPath

      public @NonNull String getElementPath()
      Return the element path relative to its common element (traces folder, experiments folder or experiment element).
      Returns:
      The element path
    • getDestinationPathRelativeToParent

      public @NonNull String getDestinationPathRelativeToParent(org.eclipse.core.runtime.IPath destinationPath)
      Return the element destination path relative to its common element (traces folder, experiments folder or experiment element).
      Parameters:
      destinationPath - Full destination path
      Returns:
      The element destination path
      Since:
      3.3
    • getTraces

      public List<TmfTraceElement> getTraces()
      Returns a list of TmfTraceElements contained in project element.
      Returns:
      a list of TmfTraceElements, empty list if none
    • getTrace

      public ITmfTrace getTrace()
      Get the instantiated trace associated with this element.
      Returns:
      The instantiated trace or null if trace is not (yet) available
    • createBookmarksFile

      public org.eclipse.core.resources.IFile createBookmarksFile(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, org.eclipse.core.runtime.OperationCanceledException
      Returns the file resource used to store bookmarks after creating it if necessary. If the trace resource is a file, it is returned directly. If the trace resource is a folder, a linked file is returned. The file will be created if it does not exist.
      Parameters:
      monitor - the progress monitor
      Returns:
      the bookmarks file
      Throws:
      org.eclipse.core.runtime.CoreException - if the bookmarks file cannot be created
      org.eclipse.core.runtime.OperationCanceledException - if the operation was canceled
      Since:
      4.0
    • getEditorId

      public abstract String getEditorId()
      Returns the optional editor ID from the trace type extension.
      Returns:
      the editor ID or null if not defined.
    • getBookmarksFile

      public org.eclipse.core.resources.IFile getBookmarksFile()
      Returns the file resource used to store bookmarks. The file may not exist.
      Returns:
      the bookmarks file
    • closeEditors

      public void closeEditors()
      Close open editors associated with this experiment.
    • getTypeName

      public abstract String getTypeName()
      Get a friendly name for the type of element this common project element is, to be displayed in UI messages.
      Returns:
      A string for the type of project element this object is, for example "trace" or "experiment"
    • copy

      public org.eclipse.core.resources.IResource copy(String newName, boolean copySuppFiles)
      Copy this model element
      Parameters:
      newName - The name of the new element
      copySuppFiles - Whether to copy supplementary files or not
      Returns:
      the new Resource object
    • copy

      public org.eclipse.core.resources.IResource copy(String newName, boolean copySuppFiles, boolean copyAsLink)
      Copy this model element at the same place as this element (ex./Traces/thisElementPath).
      Parameters:
      newName - The name of the new element
      copySuppFiles - Whether to copy supplementary files or not
      copyAsLink - Whether to copy as a link or not
      Returns:
      the new Resource object
      Since:
      3.3
    • copy

      public org.eclipse.core.resources.IResource copy(boolean copySuppFiles, boolean copyAsLink, org.eclipse.core.runtime.IPath destinationPath)
      Copy this model element to the destinationPath
      Parameters:
      copySuppFiles - Whether to copy supplementary files or not
      copyAsLink - Whether to copy as a link or not
      destinationPath - The path where the element will be copied
      Returns:
      the new Resource object
      Since:
      3.3
    • getAvailableAnalysis

      public List<@NonNull TmfAnalysisElement> getAvailableAnalysis()
      Get the list of analysis elements
      Returns:
      Array of analysis elements
    • getAvailableChildrenAnalyses

      public List<TmfAnalysisElement> getAvailableChildrenAnalyses()
      Returns:
      list of children analysis elements
      Since:
      3.0
    • deleteSupplementaryFolder

      public void deleteSupplementaryFolder()
      Deletes this element specific supplementary folder.
    • renameSupplementaryFolder

      public void renameSupplementaryFolder(String newElementPath)
      Renames the element specific supplementary folder according to the new element name or path.
      Parameters:
      newElementPath - The new element name or path
    • copySupplementaryFolder

      public void copySupplementaryFolder(String newElementPath)
      Copies the element specific supplementary folder to the new element name or path.
      Parameters:
      newElementPath - The new element name or path
    • copySupplementaryFolder

      public void copySupplementaryFolder(org.eclipse.core.resources.IFolder destination)
      Copies the element specific supplementary folder a new folder.
      Parameters:
      destination - The destination folder to copy to.
    • refreshSupplementaryFolder

      public void refreshSupplementaryFolder(org.eclipse.core.runtime.IProgressMonitor monitor)
      Refreshes the element specific supplementary folder information. It creates the folder if not exists. It sets the persistence property of the trace resource
      Parameters:
      monitor - the progress monitor
      Since:
      4.0
    • refreshSupplementaryFolder

      public void refreshSupplementaryFolder()
      Refreshes the element specific supplementary folder information. It creates the folder if not exists. It sets the persistence property of the trace resource
    • hasSupplementaryResources

      public boolean hasSupplementaryResources()
      Checks if supplementary resource exist or not.
      Returns:
      true if one or more files are under the element supplementary folder
    • getSupplementaryResources

      public org.eclipse.core.resources.IResource[] getSupplementaryResources()
      Returns the supplementary resources under the trace supplementary folder.
      Returns:
      array of resources under the trace supplementary folder.
    • deleteSupplementaryResources

      public void deleteSupplementaryResources(org.eclipse.core.resources.IResource[] resources)
      Deletes the given resources.
      Parameters:
      resources - array of resources to delete.
    • deleteSupplementaryResources

      public void deleteSupplementaryResources()
      Deletes all supplementary resources in the supplementary directory
    • prepareSupplementaryFolder

      public org.eclipse.core.resources.IFolder prepareSupplementaryFolder(org.eclipse.core.runtime.IProgressMonitor monitor)
      Returns the trace specific supplementary folder under the project's supplementary folder. The folder and its parent folders will be created if they don't exist.
      Parameters:
      monitor - the progress monitor
      Returns:
      the trace specific supplementary folder
      Since:
      4.0