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
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 Summary
ConstructorDescriptionTmfCommonProjectElement
(String name, org.eclipse.core.resources.IResource resource, TmfProjectModelElement parent) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Close open editors associated with this experiment.org.eclipse.core.resources.IResource
copy
(boolean copySuppFiles, boolean copyAsLink, org.eclipse.core.runtime.IPath destinationPath) Copy this model element to the destinationPathorg.eclipse.core.resources.IResource
Copy this model elementorg.eclipse.core.resources.IResource
Copy this model element at the same place as this element (ex./Traces/thisElementPath).void
copySupplementaryFolder
(String newElementPath) Copies the element specific supplementary folder to the new element name or path.void
copySupplementaryFolder
(org.eclipse.core.resources.IFolder destination) Copies the element specific supplementary folder a new folder.org.eclipse.core.resources.IFile
createBookmarksFile
(org.eclipse.core.runtime.IProgressMonitor monitor) Returns the file resource used to store bookmarks after creating it if necessary.void
Deletes this element specific supplementary folder.void
Deletes all supplementary resources in the supplementary directoryvoid
deleteSupplementaryResources
(org.eclipse.core.resources.IResource[] resources) Deletes the given resources.void
dispose()
Recursively dispose of the element and its children.List<@NonNull TmfAnalysisElement>
Get the list of analysis elementsorg.eclipse.core.resources.IFile
Returns the file resource used to store bookmarks.Get the child element "Reports".@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).abstract String
Returns the optional editor ID from the trace type extension.@NonNull String
Return the element path relative to its common element (traces folder, experiments folder or experiment element).org.eclipse.swt.graphics.Image
getIcon()
Returns the icon of this element.org.eclipse.core.resources.IResource[]
Returns the supplementary resources under the trace supplementary folder.getTrace()
Get the instantiated trace associated with this element.Returns a list of TmfTraceElements contained in project element.Returns the trace type ID.abstract String
Get a friendly name for the type of element this common project element is, to be displayed in UI messages.boolean
Checks if supplementary resource exist or not.abstract ITmfTrace
Instantiate aITmfTrace
object based on the trace type and the corresponding extension.org.eclipse.core.resources.IFolder
prepareSupplementaryFolder
(org.eclipse.core.runtime.IProgressMonitor monitor) Returns the trace specific supplementary folder under the project's supplementary folder.void
Refreshes the element specific supplementary folder information.void
refreshSupplementaryFolder
(org.eclipse.core.runtime.IProgressMonitor monitor) Refreshes the element specific supplementary folder information.void
Refreshes the trace type field by reading the trace type persistent property of the resource.void
renameSupplementaryFolder
(String newElementPath) Renames the element specific supplementary folder according to the new element name or path.Methods inherited from class org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectModelElement
equals, getAdapter, getChildren, getLocation, getName, getParent, getPath, getProject, getResource, getTraceSupplementaryFolder, hashCode, prepareTraceSupplementaryFolder, prepareTraceSupplementaryFolder, refresh, refreshViewer, toString
Methods inherited from interface org.eclipse.tracecompass.tmf.ui.project.model.ITmfProjectModelElement
getChild, getLabelText, hasChildren
-
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 elementresource
- 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
Get the child element "Reports".- Returns:
- The Reports child element
- Since:
- 2.0
-
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
Instantiate aITmfTrace
object based on the trace type and the corresponding extension.- Returns:
- the
ITmfTrace
ornull
for an error
-
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
Returns a list of TmfTraceElements contained in project element.- Returns:
- a list of TmfTraceElements, empty list if none
-
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 createdorg.eclipse.core.runtime.OperationCanceledException
- if the operation was canceled- Since:
- 4.0
-
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
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
Copy this model element- Parameters:
newName
- The name of the new elementcopySuppFiles
- 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 elementcopySuppFiles
- Whether to copy supplementary files or notcopyAsLink
- 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 notcopyAsLink
- Whether to copy as a link or notdestinationPath
- The path where the element will be copied- Returns:
- the new Resource object
- Since:
- 3.3
-
getAvailableAnalysis
Get the list of analysis elements- Returns:
- Array of analysis elements
-
getAvailableChildrenAnalyses
- Returns:
- list of children analysis elements
- Since:
- 3.0
-
deleteSupplementaryFolder
public void deleteSupplementaryFolder()Deletes this element specific supplementary folder. -
renameSupplementaryFolder
Renames the element specific supplementary folder according to the new element name or path.- Parameters:
newElementPath
- The new element name or path
-
copySupplementaryFolder
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
-