tmf: add trace type ID property to be displayed in Properties view
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Wed, 4 May 2016 20:04:00 +0000 (16:04 -0400)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Wed, 11 May 2016 20:09:54 +0000 (16:09 -0400)
This information is needed when creating XML analysis. User have no
other way to know the ID (unless looking into Trace Compass source
code)

Change-Id: I7463c84ed0e7b480ba52984e485fe7354ed4d2cd
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/72082
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfTraceElement.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties

index 863d79d9774991f562b85dcc99ec875239885c43..80d9043a0639137775ae8460ed0cdde07f2f899a 100644 (file)
@@ -75,6 +75,10 @@ public class Messages extends NLS {
     /** The descriptor for the event type property */
     public static String TmfTraceElement_EventType;
 
+    /** The descriptor for the trace type ID property
+     * @since 2.0*/
+    public static String TmfTraceElement_TraceTypeId;
+
     /** The descriptor for the linked property */
     public static String TmfTraceElement_IsLinked;
 
index 5db6facf68878231783cbfb7d61a556958a77ec2..1579dca6f86165d729b754a5891ee23ea7cf57de 100644 (file)
@@ -97,6 +97,7 @@ public class TmfTraceElement extends TmfCommonProjectElement implements IActionF
     private static final String PATH = Messages.TmfTraceElement_Path;
     private static final String LOCATION = Messages.TmfTraceElement_Location;
     private static final String TRACE_TYPE = Messages.TmfTraceElement_EventType;
+    private static final String TRACE_TYPE_ID = Messages.TmfTraceElement_TraceTypeId;
     private static final String IS_LINKED_PROPERTY = Messages.TmfTraceElement_IsLinked;
     private static final String SOURCE_LOCATION = Messages.TmfTraceElement_SourceLocation;
     private static final String TIME_OFFSET = Messages.TmfTraceElement_TimeOffset;
@@ -108,6 +109,7 @@ public class TmfTraceElement extends TmfCommonProjectElement implements IActionF
     private static final ReadOnlyTextPropertyDescriptor PATH_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(PATH, PATH);
     private static final ReadOnlyTextPropertyDescriptor LOCATION_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(LOCATION, LOCATION);
     private static final ReadOnlyTextPropertyDescriptor TYPE_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(TRACE_TYPE, TRACE_TYPE);
+    private static final ReadOnlyTextPropertyDescriptor TYPE_ID_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(TRACE_TYPE_ID, TRACE_TYPE_ID);
     private static final ReadOnlyTextPropertyDescriptor IS_LINKED_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(IS_LINKED_PROPERTY, IS_LINKED_PROPERTY);
     private static final ReadOnlyTextPropertyDescriptor SOURCE_LOCATION_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(SOURCE_LOCATION, SOURCE_LOCATION);
     private static final ReadOnlyTextPropertyDescriptor TIME_OFFSET_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(TIME_OFFSET, TIME_OFFSET);
@@ -115,7 +117,7 @@ public class TmfTraceElement extends TmfCommonProjectElement implements IActionF
     private static final ReadOnlyTextPropertyDescriptor SIZE_DESCRIPTOR = new ReadOnlyTextPropertyDescriptor(SIZE, SIZE);
 
     private static final IPropertyDescriptor[] sfDescriptors = { NAME_DESCRIPTOR, PATH_DESCRIPTOR, LOCATION_DESCRIPTOR,
-            TYPE_DESCRIPTOR, IS_LINKED_DESCRIPTOR, SOURCE_LOCATION_DESCRIPTOR,
+            TYPE_DESCRIPTOR, TYPE_ID_DESCRIPTOR, IS_LINKED_DESCRIPTOR, SOURCE_LOCATION_DESCRIPTOR,
             TIME_OFFSET_DESCRIPTOR, LAST_MODIFIED_DESCRIPTOR, SIZE_DESCRIPTOR };
 
     static {
@@ -123,6 +125,7 @@ public class TmfTraceElement extends TmfCommonProjectElement implements IActionF
         PATH_DESCRIPTOR.setCategory(RESOURCE_PROPERTIES_CATEGORY);
         LOCATION_DESCRIPTOR.setCategory(RESOURCE_PROPERTIES_CATEGORY);
         TYPE_DESCRIPTOR.setCategory(RESOURCE_PROPERTIES_CATEGORY);
+        TYPE_ID_DESCRIPTOR.setCategory(RESOURCE_PROPERTIES_CATEGORY);
         IS_LINKED_DESCRIPTOR.setCategory(RESOURCE_PROPERTIES_CATEGORY);
         SOURCE_LOCATION_DESCRIPTOR.setCategory(RESOURCE_PROPERTIES_CATEGORY);
         TIME_OFFSET_DESCRIPTOR.setCategory(RESOURCE_PROPERTIES_CATEGORY);
@@ -550,6 +553,16 @@ public class TmfTraceElement extends TmfCommonProjectElement implements IActionF
             return ""; //$NON-NLS-1$
         }
 
+        if (TRACE_TYPE_ID.equals(id)) {
+            if (getTraceType() != null) {
+                TraceTypeHelper helper = TmfTraceType.getTraceType(getTraceType());
+                if (helper != null) {
+                    return helper.getTraceTypeId();
+                }
+            }
+            return ""; //$NON-NLS-1$
+        }
+
         if (TIME_OFFSET.equals(id)) {
             long offset = TimestampTransformFactory.getTimestampTransform(getElementUnderTraceFolder().getResource()).transform(0);
             if (offset != 0) {
index 36950d5ec013b149c8684ec1087f17a2a4d22bd6..a7a6a0a52187ab6684f7e42563132437f9f2f3d0 100644 (file)
@@ -27,6 +27,7 @@ TmfTraceElement_Name = name
 TmfTraceElement_Path = path
 TmfTraceElement_Location = location
 TmfTraceElement_EventType = type
+TmfTraceElement_TraceTypeId = type ID
 TmfTraceElement_IsLinked = linked
 TmfTraceElement_SourceLocation = source location
 TmfTraceElement_TimeOffset = time offset
This page took 0.027908 seconds and 5 git commands to generate.