From 3fea44b040a655c5aa52edab5b822cd7bdedc3bb Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Wed, 4 May 2016 16:04:00 -0400 Subject: [PATCH] tmf: add trace type ID property to be displayed in Properties view 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 Reviewed-on: https://git.eclipse.org/r/72082 Reviewed-by: Hudson CI Reviewed-by: Matthew Khouzam Tested-by: Matthew Khouzam --- .../tmf/ui/project/model/Messages.java | 4 ++++ .../tmf/ui/project/model/TmfTraceElement.java | 15 ++++++++++++++- .../tmf/ui/project/model/messages.properties | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java index 863d79d977..80d9043a06 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/Messages.java @@ -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; diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfTraceElement.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfTraceElement.java index 5db6facf68..1579dca6f8 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfTraceElement.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/TmfTraceElement.java @@ -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) { diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties index 36950d5ec0..a7a6a0a521 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties +++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/project/model/messages.properties @@ -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 -- 2.34.1