Class TmfTraceElement
java.lang.Object
org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectModelElement
org.eclipse.tracecompass.tmf.ui.project.model.TmfCommonProjectElement
org.eclipse.tracecompass.tmf.ui.project.model.TmfTraceElement
- All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable,ITmfProjectModelElement,org.eclipse.ui.IActionFilter,org.eclipse.ui.views.properties.IPropertySource,org.eclipse.ui.views.properties.IPropertySource2
public class TmfTraceElement
extends TmfCommonProjectElement
implements org.eclipse.ui.IActionFilter, org.eclipse.ui.views.properties.IPropertySource2
Implementation of trace model element representing a trace. It provides
methods to instantiate
ITmfTrace and ITmfEvent as
well as editor ID from the trace type extension definition.- Version:
- 1.0
- Author:
- Francois Chouinard
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionTmfTraceElement(String name, org.eclipse.core.resources.IResource trace, TmfExperimentElement parent) Constructor.TmfTraceElement(String name, org.eclipse.core.resources.IResource trace, TmfTraceFolder parent) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidClose opened editors associated with this trace.Copy this trace in the trace folder.voiddelete(org.eclipse.core.runtime.IProgressMonitor progressMonitor) Delete the trace resource, remove it from experiments and delete its supplementary filesvoiddelete(org.eclipse.core.runtime.IProgressMonitor progressMonitor, boolean overwriting) Delete the trace resource, and optionally remove it from experiments and delete its supplementary files.voiddelete(org.eclipse.core.runtime.IProgressMonitor progressMonitor, boolean overwriting, boolean closeEditors) Delete the trace resource, and optionally remove it from experiments and delete its supplementary files.voidDeletes all supplementary resources in the supplementary directory.voiddeleteSupplementaryResources(org.eclipse.core.resources.IResource[] resources) Deletes the given resources.org.eclipse.core.resources.IFileReturns the file resource used to store bookmarks.Returns the optional editor ID from the trace type extension.Returns theTmfTraceElementlocated under theTmfTracesFolder.Getter for the trace end time@NonNull org.eclipse.swt.graphics.ImagegetIcon()Returns the icon of this element.Returns the text of the label of this element.org.eclipse.ui.views.properties.IPropertyDescriptor[]Getter for the trace start timegetTrace()Get the instantiated trace associated with this element.Get a friendly name for the type of element this common project element is, to be displayed in UI messages.static voidinit()Initialize statically at startup by getting extensions from the platform extension registry.Instantiate aITmfEventobject based on the trace type and the corresponding extension.Instantiate aITmfTraceobject based on the trace type and the corresponding extension.booleanbooleanisPropertySet(Object id) voidvoidsetEndTime(@NonNull ITmfTimestamp end) Update the trace's end timevoidsetPropertyValue(Object id, Object value) voidsetStartTime(ITmfTimestamp startTime) Update the trace's start timebooleantestAttribute(Object target, String name, String value) Methods inherited from class org.eclipse.tracecompass.tmf.ui.project.model.TmfCommonProjectElement
copy, copy, copy, copySupplementaryFolder, copySupplementaryFolder, createBookmarksFile, deleteSupplementaryFolder, dispose, getAvailableAnalysis, getAvailableChildrenAnalyses, getChildElementReports, getDestinationPathRelativeToParent, getElementPath, getSupplementaryResources, getTraces, getTraceType, hasSupplementaryResources, prepareSupplementaryFolder, refreshSupplementaryFolder, refreshSupplementaryFolder, refreshTraceType, renameSupplementaryFolderMethods 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, toStringMethods inherited from interface org.eclipse.tracecompass.tmf.ui.project.model.ITmfProjectModelElement
getChild, hasChildren
-
Field Details
-
BUNDLE
Bundle attribute name- See Also:
-
IS_LINKED
IsLinked attribute name.- See Also:
-
-
Constructor Details
-
TmfTraceElement
public TmfTraceElement(String name, org.eclipse.core.resources.IResource trace, TmfTraceFolder parent) Constructor. Creates trace model element under the trace folder.- Parameters:
name- The name of tracetrace- The trace resource.parent- The parent element (trace folder)
-
TmfTraceElement
public TmfTraceElement(String name, org.eclipse.core.resources.IResource trace, TmfExperimentElement parent) Constructor. Creates trace model element under the experiment folder.- Parameters:
name- The name of tracetrace- The trace resource.parent- The parent element (experiment folder)
-
-
Method Details
-
init
public static void init()Initialize statically at startup by getting extensions from the platform extension registry. -
getIcon
public @NonNull org.eclipse.swt.graphics.Image getIcon()Description copied from interface:ITmfProjectModelElementReturns the icon of this element.- Specified by:
getIconin interfaceITmfProjectModelElement- Overrides:
getIconin classTmfCommonProjectElement- Returns:
- The icon
- Since:
- 2.0
-
getLabelText
Description copied from interface:ITmfProjectModelElementReturns the text of the label of this element.- Specified by:
getLabelTextin interfaceITmfProjectModelElement- Returns:
- The label text
- Since:
- 2.0
-
instantiateTrace
Instantiate aITmfTraceobject based on the trace type and the corresponding extension.- Specified by:
instantiateTracein classTmfCommonProjectElement- Returns:
- the
ITmfTraceornullfor an error
-
instantiateEvent
Instantiate aITmfEventobject based on the trace type and the corresponding extension.- Returns:
- the
ITmfEventornullfor an error
-
getEditorId
Description copied from class:TmfCommonProjectElementReturns the optional editor ID from the trace type extension.- Specified by:
getEditorIdin classTmfCommonProjectElement- Returns:
- the editor ID or
nullif not defined.
-
getBookmarksFile
public org.eclipse.core.resources.IFile getBookmarksFile()Returns the file resource used to store bookmarks. The file may not exist.- Overrides:
getBookmarksFilein classTmfCommonProjectElement- Returns:
- the bookmarks file
-
getElementUnderTraceFolder
Returns theTmfTraceElementlocated under theTmfTracesFolder.- Returns:
thisif this element is under theTmfTracesFolderelse the correspondingTmfTraceElementif this element is underTmfExperimentElement.
-
getTypeName
Description copied from class:TmfCommonProjectElementGet a friendly name for the type of element this common project element is, to be displayed in UI messages.- Specified by:
getTypeNamein classTmfCommonProjectElement- Returns:
- A string for the type of project element this object is, for example "trace" or "experiment"
-
testAttribute
- Specified by:
testAttributein interfaceorg.eclipse.ui.IActionFilter
-
getEditableValue
- Specified by:
getEditableValuein interfaceorg.eclipse.ui.views.properties.IPropertySource
-
getTrace
Description copied from class:TmfCommonProjectElementGet the instantiated trace associated with this element.- Overrides:
getTracein classTmfCommonProjectElement- Returns:
- The instantiated trace or null if trace is not (yet) available
-
getPropertyDescriptors
public org.eclipse.ui.views.properties.IPropertyDescriptor[] getPropertyDescriptors()- Specified by:
getPropertyDescriptorsin interfaceorg.eclipse.ui.views.properties.IPropertySource
-
getPropertyValue
- Specified by:
getPropertyValuein interfaceorg.eclipse.ui.views.properties.IPropertySource
-
resetPropertyValue
- Specified by:
resetPropertyValuein interfaceorg.eclipse.ui.views.properties.IPropertySource
-
setPropertyValue
- Specified by:
setPropertyValuein interfaceorg.eclipse.ui.views.properties.IPropertySource
-
isPropertyResettable
- Specified by:
isPropertyResettablein interfaceorg.eclipse.ui.views.properties.IPropertySource2
-
isPropertySet
- Specified by:
isPropertySetin interfaceorg.eclipse.ui.views.properties.IPropertySource- Specified by:
isPropertySetin interfaceorg.eclipse.ui.views.properties.IPropertySource2
-
copy
Copy this trace in the trace folder. No other parameters are mentioned so the trace is copied in this element's project trace folder- Parameters:
newName- The new trace name- Returns:
- the new Resource object
-
closeEditors
public void closeEditors()Close opened editors associated with this trace.- Overrides:
closeEditorsin classTmfCommonProjectElement
-
delete
public void delete(org.eclipse.core.runtime.IProgressMonitor progressMonitor) throws org.eclipse.core.runtime.CoreException Delete the trace resource, remove it from experiments and delete its supplementary files- Parameters:
progressMonitor- a progress monitor, or null if progress reporting is not desired- Throws:
org.eclipse.core.runtime.CoreException- thrown when IResource.delete fails
-
delete
public void delete(org.eclipse.core.runtime.IProgressMonitor progressMonitor, boolean overwriting) throws org.eclipse.core.runtime.CoreException Delete the trace resource, and optionally remove it from experiments and delete its supplementary files.- Parameters:
progressMonitor- a progress monitor, or null if progress reporting is not desiredoverwriting- if true, keep the trace in experiments and only delete non-hidden supplementary files (keeping the properties sub-folder), otherwise remove the trace from experiments and delete the supplementary folder completely- Throws:
org.eclipse.core.runtime.CoreException- thrown when IResource.delete fails- Since:
- 3.1
-
delete
public void delete(org.eclipse.core.runtime.IProgressMonitor progressMonitor, boolean overwriting, boolean closeEditors) throws org.eclipse.core.runtime.CoreException Delete the trace resource, and optionally remove it from experiments and delete its supplementary files. Editors are first closed if requested.- Parameters:
progressMonitor- a progress monitor, or null if progress reporting is not desiredoverwriting- if true, keep the trace in experiments and only delete non-hidden supplementary files (keeping the properties sub-folder), otherwise remove the trace from experiments and delete the supplementary folder completelycloseEditors- if true, editors associated with this trace are first closed before proceeding, otherwise it is the responsibility of the caller to first close editors before calling the method- Throws:
org.eclipse.core.runtime.CoreException- thrown when IResource.delete fails- Since:
- 4.0
-
setStartTime
Update the trace's start time- Parameters:
startTime- updated start time for this trace- Since:
- 3.0
-
getStartTime
Getter for the trace start time- Returns:
- the start time from the trace if available, or from self when read in advance from supplementary files or from fast trace read. Return null if completely unknown.
- Since:
- 3.0
-
setEndTime
Update the trace's end time- Parameters:
end- updated end time for this trace- Since:
- 3.0
-
getEndTime
Getter for the trace end time- Returns:
- the end time from the trace if available, or from self when read in advance from supplementary files or from fast trace read. Return null if completely unknown.
- Since:
- 3.0
-
deleteSupplementaryResources
public void deleteSupplementaryResources(org.eclipse.core.resources.IResource[] resources) Description copied from class:TmfCommonProjectElementDeletes the given resources.- Overrides:
deleteSupplementaryResourcesin classTmfCommonProjectElement- Parameters:
resources- array of resources to delete.
-
deleteSupplementaryResources
public void deleteSupplementaryResources()Deletes all supplementary resources in the supplementary directory. Also delete the supplementary resources of experiments that contain this trace.- Overrides:
deleteSupplementaryResourcesin classTmfCommonProjectElement
-