analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / filter / xml / TmfFilterContentHandler.java
index 0ae67371d9da4bbc10d437c88832fffe4b4d34af..dc159844fc3a3a79698a030329c5e6dd58246d7f 100644 (file)
@@ -93,6 +93,7 @@ public class TmfFilterContentHandler extends DefaultHandler {
 
             node = new TmfFilterTraceTypeNode(null);
             String traceTypeId = atts.getValue(TmfFilterTraceTypeNode.TYPE_ATTR);
+            traceTypeId = TmfTraceType.buildCompatibilityTraceTypeId(traceTypeId);
             ((TmfFilterTraceTypeNode) node).setTraceTypeId(traceTypeId);
             TraceTypeHelper helper = TmfTraceType.getTraceType(traceTypeId);
             if (helper != null) {
@@ -228,19 +229,22 @@ public class TmfFilterContentHandler extends DefaultHandler {
 
     private static void createEventAspect(TmfFilterAspectNode node, Attributes atts) {
         String traceTypeId = atts.getValue(TmfFilterAspectNode.TRACE_TYPE_ID_ATTR);
+        traceTypeId = TmfTraceType.buildCompatibilityTraceTypeId(traceTypeId);
         String name = atts.getValue(TmfFilterAspectNode.EVENT_ASPECT_ATTR);
         if (TmfFilterAspectNode.BASE_ASPECT_ID.equals(traceTypeId)) {
             for (ITmfEventAspect eventAspect : ITmfEventAspect.BASE_ASPECTS) {
                 if (eventAspect.getName().equals(name)) {
                     node.setEventAspect(eventAspect);
                     node.setTraceTypeId(traceTypeId);
+                    if (eventAspect instanceof TmfEventFieldAspect) {
+                        String field = atts.getValue(TmfFilterAspectNode.FIELD_ATTR);
+                        if (field != null && !field.isEmpty()) {
+                            node.setEventAspect(((TmfEventFieldAspect) eventAspect).forField(field));
+                        }
+                    }
                     break;
                 }
             }
-        } else if (TmfFilterAspectNode.EVENT_FIELD_ASPECT_ID.equals(traceTypeId) && name != null) {
-            ITmfEventAspect eventAspect = new TmfEventFieldAspect(name, name);
-            node.setEventAspect(eventAspect);
-            node.setTraceTypeId(traceTypeId);
         } else if (traceTypeId != null && name != null) {
             TraceTypeHelper helper = TmfTraceType.getTraceType(traceTypeId);
             if (helper != null) {
@@ -248,6 +252,12 @@ public class TmfFilterContentHandler extends DefaultHandler {
                     if (eventAspect.getName().equals(name)) {
                         node.setEventAspect(eventAspect);
                         node.setTraceTypeId(traceTypeId);
+                        if (eventAspect instanceof TmfEventFieldAspect) {
+                            String field = atts.getValue(TmfFilterAspectNode.FIELD_ATTR);
+                            if (field != null && !field.isEmpty()) {
+                                node.setEventAspect(((TmfEventFieldAspect) eventAspect).forField(field));
+                            }
+                        }
                         break;
                     }
                 }
@@ -266,9 +276,8 @@ public class TmfFilterContentHandler extends DefaultHandler {
                     node.setEventAspect(ITmfEventAspect.BaseAspects.CONTENTS);
                     node.setTraceTypeId(TmfFilterAspectNode.BASE_ASPECT_ID);
                 } else {
-                    ITmfEventAspect eventAspect = new TmfEventFieldAspect(field, field);
-                    node.setEventAspect(eventAspect);
-                    node.setTraceTypeId(TmfFilterAspectNode.EVENT_FIELD_ASPECT_ID);
+                    node.setEventAspect(ITmfEventAspect.BaseAspects.CONTENTS.forField(field));
+                    node.setTraceTypeId(TmfFilterAspectNode.BASE_ASPECT_ID);
                 }
             }
         }
This page took 0.027911 seconds and 5 git commands to generate.