TMF: Rework some test code for XML analysis to make it easier to add test cases
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.analysis.xml.core / src / org / eclipse / tracecompass / tmf / analysis / xml / core / stateprovider / XmlStateSystemModule.java
index 0a55f106ad4d8293e05cf64ab531ca83e47faf25..0bb33274818377d5e9b7f8cc7e6b7ff57a6e8c7e 100644 (file)
@@ -45,29 +45,29 @@ public class XmlStateSystemModule extends TmfStateSystemAnalysisModule {
 
     @Override
     public String getName() {
-        String name = getId();
+        String id = getId();
         IPath xmlFile = fXmlFile;
         if (xmlFile == null) {
-            return name;
+            return id;
         }
-        Element doc = XmlUtils.getElementInFile(xmlFile.makeAbsolute().toString(), TmfXmlStrings.STATE_PROVIDER, getId());
+        Element doc = XmlUtils.getElementInFile(xmlFile.makeAbsolute().toString(), TmfXmlStrings.STATE_PROVIDER, id);
         /* Label may be available in XML header */
         List<Element> head = XmlUtils.getChildElements(doc, TmfXmlStrings.HEAD);
+        String name = null;
         if (head.size() == 1) {
             List<Element> labels = XmlUtils.getChildElements(head.get(0), TmfXmlStrings.LABEL);
             if (!labels.isEmpty()) {
                 name = labels.get(0).getAttribute(TmfXmlStrings.VALUE);
             }
         }
-
-        return name;
+        return (name == null) ? id : name;
     }
 
     /**
      * Sets the file path of the XML file containing the state provider
      *
      * @param file
-     *            The full path to the XML file
+     *            The absolute path to the XML file
      */
     public void setXmlFile(IPath file) {
         fXmlFile = file;
This page took 0.026115 seconds and 5 git commands to generate.