Add support for displaying of CTF context info in TMF (Bug 385494)
authorBernd Hufmann <bhufmann@gmail.com>
Tue, 28 Aug 2012 14:58:16 +0000 (10:58 -0400)
committerBernd Hufmann <bhufmann@gmail.com>
Fri, 31 Aug 2012 14:43:43 +0000 (10:43 -0400)
Change-Id: Ib1ca3094b7d203ac4207fb027d48629028571de4
Signed-off-by: Bernd Hufmann <bhufmann@gmail.com>
Reviewed-on: https://git.eclipse.org/r/7456
Tested-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEvent.java

index 9de76d1eb44e2cd161498d534f28033ffb9c37a8..0d56c1707252991225cf4cb1f899dabc982de4c7 100644 (file)
@@ -28,7 +28,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfTimestamp;
 /**
  * A wrapper class around CTF's Event Definition/Declaration that maps all
  * types of Declaration to native Java types.
- * 
+ *
  * @version 1.0
  * @author Alexandre Montplaisir
  */
@@ -41,6 +41,8 @@ public final class CtfTmfEvent implements ITmfEvent, Cloneable {
     private static final String NO_STREAM = "No stream"; //$NON-NLS-1$
     private static final String EMPTY_CTF_EVENT_NAME = "Empty CTF event"; //$NON-NLS-1$
 
+    /** Prefix for Context information stored as CtfTmfEventfield */
+    private static final String CONTEXT_FIELD_PREFIX = "context."; //$NON-NLS-1$
 
     // ------------------------------------------------------------------------
     // Attributes
@@ -122,6 +124,24 @@ public final class CtfTmfEvent implements ITmfEvent, Cloneable {
             fields.add(curField);
         }
 
+        /* Add context information as CtfTmfEventField */
+        StructDefinition structContext = eventDef.getContext();
+        if (structContext != null) {
+            definitions = structContext.getDefinitions();
+            String curContextName;
+            Definition curContextDef;
+            CtfTmfEventField curContext;
+            it = definitions.entrySet().iterator();
+            while(it.hasNext()) {
+                Entry<String, Definition> entry = it.next();
+                /* Prefix field name to */
+                curContextName = CONTEXT_FIELD_PREFIX + entry.getKey();
+                curContextDef = entry.getValue();
+                curContext = CtfTmfEventField.parseField(curContextDef, curContextName);
+                fields.add(curContext);
+            }
+        }
+
         return fields.toArray(new CtfTmfEventField[fields.size()]);
     }
 
This page took 0.02845 seconds and 5 git commands to generate.