X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.tmf.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Ftmf%2Fui%2Fproject%2Fmodel%2FTmfTraceElement.java;h=fabef20eb9b662e70033fab6a09239b9c2bcbeea;hb=d04ec5a723064f4f1b26100362491b7f07e27cca;hp=e3b09d1091b465d222064f32da8a7d4122509a82;hpb=beb1910697e18dde9c145228b04f2b01c5adca16;p=deliverable%2Ftracecompass.git
diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
index e3b09d1091..fabef20eb9 100644
--- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
+++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/project/model/TmfTraceElement.java
@@ -38,16 +38,16 @@ import org.eclipse.linuxtools.tmf.core.TmfCommonConstants;
import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;
import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;
+import org.eclipse.linuxtools.tmf.core.util.ReadOnlyTextPropertyDescriptor;
import org.eclipse.linuxtools.tmf.ui.editors.TmfEventsEditor;
import org.eclipse.ui.IActionFilter;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource2;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
/**
- * 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.
+ * 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
@@ -76,11 +76,11 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
private static final String sfEventType = "type"; //$NON-NLS-1$
private static final String sfIsLinked = "linked"; //$NON-NLS-1$
- private static final TextPropertyDescriptor sfNameDescriptor = new TextPropertyDescriptor(sfName, sfName);
- private static final TextPropertyDescriptor sfPathDescriptor = new TextPropertyDescriptor(sfPath, sfPath);
- private static final TextPropertyDescriptor sfLocationDescriptor = new TextPropertyDescriptor(sfLocation, sfLocation);
- private static final TextPropertyDescriptor sfTypeDescriptor = new TextPropertyDescriptor(sfEventType, sfEventType);
- private static final TextPropertyDescriptor sfIsLinkedDescriptor = new TextPropertyDescriptor(sfIsLinked, sfIsLinked);
+ private static final ReadOnlyTextPropertyDescriptor sfNameDescriptor = new ReadOnlyTextPropertyDescriptor(sfName, sfName);
+ private static final ReadOnlyTextPropertyDescriptor sfPathDescriptor = new ReadOnlyTextPropertyDescriptor(sfPath, sfPath);
+ private static final ReadOnlyTextPropertyDescriptor sfLocationDescriptor = new ReadOnlyTextPropertyDescriptor(sfLocation, sfLocation);
+ private static final ReadOnlyTextPropertyDescriptor sfTypeDescriptor = new ReadOnlyTextPropertyDescriptor(sfEventType, sfEventType);
+ private static final ReadOnlyTextPropertyDescriptor sfIsLinkedDescriptor = new ReadOnlyTextPropertyDescriptor(sfIsLinked, sfIsLinked);
private static final IPropertyDescriptor[] sfDescriptors = { sfNameDescriptor, sfPathDescriptor, sfLocationDescriptor,
sfTypeDescriptor, sfIsLinkedDescriptor };
@@ -106,12 +106,14 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
// Static initialization
// ------------------------------------------------------------------------
- // The mapping of available trace type IDs to their corresponding configuration element
+ // The mapping of available trace type IDs to their corresponding
+ // configuration element
private static final Map sfTraceTypeAttributes = new HashMap();
private static final Map sfTraceCategories = new HashMap();
/**
- * Initialize statically at startup by getting extensions from the platform extension registry.
+ * Initialize statically at startup by getting extensions from the platform
+ * extension registry.
*/
public static void init() {
IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(TmfTraceType.TMF_TRACE_TYPE_ID);
@@ -131,21 +133,28 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
// Constructors
// ------------------------------------------------------------------------
/**
- * Constructor.
- * Creates trace model element under the trace folder.
- * @param name The name of trace
- * @param trace The trace resource.
- * @param parent The parent element (trace folder)
+ * Constructor. Creates trace model element under the trace folder.
+ *
+ * @param name
+ * The name of trace
+ * @param trace
+ * The trace resource.
+ * @param parent
+ * The parent element (trace folder)
*/
public TmfTraceElement(String name, IResource trace, TmfTraceFolder parent) {
this(name, trace, (TmfProjectModelElement) parent);
}
+
/**
- * Constructor.
- * Creates trace model element under the experiment folder.
- * @param name The name of trace
- * @param trace The trace resource.
- * @param parent The parent element (experiment folder)
+ * Constructor. Creates trace model element under the experiment folder.
+ *
+ * @param name
+ * The name of trace
+ * @param trace
+ * The trace resource.
+ * @param parent
+ * The parent element (experiment folder)
*/
public TmfTraceElement(String name, IResource trace, TmfExperimentElement parent) {
this(name, trace, (TmfProjectModelElement) parent);
@@ -162,6 +171,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
// ------------------------------------------------------------------------
/**
* Returns the trace type ID.
+ *
* @return trace type ID.
*/
public String getTraceType() {
@@ -169,8 +179,8 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
/**
- * Refreshes the trace type filed by reading the trace type persistent property of the resource
- * referenece.
+ * Refreshes the trace type filed by reading the trace type persistent
+ * property of the resource referenece.
*/
public void refreshTraceType() {
try {
@@ -181,7 +191,8 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
/**
- * Instantiate a ITmfTrace
object based on the trace type and the corresponding extension.
+ * Instantiate a ITmfTrace
object based on the trace type and
+ * the corresponding extension.
*
* @return the ITmfTrace
or null
for an error
*/
@@ -207,6 +218,9 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
}
IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
+ if (ce == null) {
+ return null;
+ }
ITmfTrace trace = (ITmfTrace) ce.createExecutableExtension(TmfTraceType.TRACE_TYPE_ATTR);
return trace;
}
@@ -217,7 +231,8 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
/**
- * Instantiate a ITmfEvent
object based on the trace type and the corresponding extension.
+ * Instantiate a ITmfEvent
object based on the trace type and
+ * the corresponding extension.
*
* @return the ITmfEvent
or null
for an error
*/
@@ -239,6 +254,9 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
}
IConfigurationElement ce = sfTraceTypeAttributes.get(fTraceTypeId);
+ if (ce == null) {
+ return null;
+ }
ITmfEvent event = (ITmfEvent) ce.createExecutableExtension(TmfTraceType.EVENT_TYPE_ATTR);
return event;
}
@@ -250,6 +268,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
/**
* Returns the optional editor ID from the trace type extension.
+ *
* @return the editor ID or null
if not defined.
*/
public String getEditorId() {
@@ -270,12 +289,14 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
/**
- * 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.
+ * 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.
+ *
* @return the bookmarks file
- * @throws CoreException if the bookmarks file cannot be created
+ * @throws CoreException
+ * if the bookmarks file cannot be created
* @since 2.0
*/
public IFile createBookmarksFile() throws CoreException {
@@ -297,8 +318,9 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
/**
- * Returns the file resource used to store bookmarks.
- * The file may not exist.
+ * Returns the file resource used to store bookmarks. The file may not
+ * exist.
+ *
* @return the bookmarks file
* @since 2.0
*/
@@ -314,15 +336,18 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
}
/**
- * Returns the TmfTraceElement
located under the TmfTracesFolder
.
+ * Returns the TmfTraceElement
located under the
+ * TmfTracesFolder
.
*
- * @return this
if this element is under the TmfTracesFolder
- * else the corresponding TmfTraceElement
if this element is under
+ * @return this
if this element is under the
+ * TmfTracesFolder
else the corresponding
+ * TmfTraceElement
if this element is under
* TmfExperimentElement
.
*/
public TmfTraceElement getElementUnderTraceFolder() {
- // If trace is under an experiment, return original trace from the traces folder
+ // If trace is under an experiment, return original trace from the
+ // traces folder
if (getParent() instanceof TmfExperimentElement) {
for (TmfTraceElement aTrace : getProject().getTracesFolder().getTraces()) {
if (aTrace.getName().equals(getName())) {
@@ -349,10 +374,7 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
// ------------------------------------------------------------------------
// TmfTraceElement
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.linuxtools.tmf.ui.project.model.ITmfProjectModelElement#getProject()
- */
+
@Override
public TmfProjectElement getProject() {
if (getParent() instanceof TmfTraceFolder) {
@@ -373,28 +395,16 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
// IPropertySource2
// ------------------------------------------------------------------------
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
- */
@Override
public Object getEditableValue() {
return null;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
- */
@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
return Arrays.copyOf(sfDescriptors, sfDescriptors.length);
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
- */
@Override
public Object getPropertyValue(Object id) {
@@ -435,35 +445,19 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
return "[no category]"; //$NON-NLS-1$
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
- */
@Override
public void resetPropertyValue(Object id) {
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
- */
@Override
public void setPropertyValue(Object id, Object value) {
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertyResettable(java.lang.Object)
- */
@Override
public boolean isPropertyResettable(Object id) {
return false;
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.views.properties.IPropertySource2#isPropertySet(java.lang.Object)
- */
@Override
public boolean isPropertySet(Object id) {
return false;
@@ -484,5 +478,4 @@ public class TmfTraceElement extends TmfWithFolderElement implements IActionFilt
return new TmfTraceElement(string, res, folder);
}
-
}