]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
1. Make SPD editor tables bigger.and table now focus the entry added.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFileContents.java
index 0fc11f08b28a42c7e41176aff7463056cc3c28ce..0fbffe0837acd4b133f3a155be23a2093d7d6f3e 100644 (file)
@@ -264,6 +264,10 @@ public class FpdFileContents {
                 }\r
             }\r
             cursor.removeXml();\r
+            if (getFrameworkModulesCount() == 0) {\r
+                cursor.toParent();\r
+                cursor.removeXml();\r
+            }\r
         }\r
         cursor.dispose();\r
     }\r
@@ -390,7 +394,7 @@ public class FpdFileContents {
             \r
         }\r
         catch (Exception e){\r
-            e.printStackTrace();\r
+//            e.printStackTrace();\r
             throw e;\r
         }\r
         \r
@@ -653,13 +657,15 @@ public class FpdFileContents {
         //ToDo add Arch filter\r
         \r
         try {\r
+            if (moduleSa == null) {\r
+                moduleSa = genModuleSA(mi);\r
+            }\r
+            \r
             ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r
             if (msa.getPcdCoded() == null) {\r
                 return;\r
             }\r
-            if (moduleSa == null) {\r
-                moduleSa = genModuleSA(mi);\r
-            }\r
+            \r
             Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
             m.put("ModuleSurfaceArea", msa);\r
             SurfaceAreaQuery.setDoc(m);\r
@@ -688,7 +694,7 @@ public class FpdFileContents {
             \r
         }\r
         catch (Exception e){\r
-            e.printStackTrace();\r
+//            e.printStackTrace();\r
             throw e; \r
         }\r
         \r
@@ -1003,22 +1009,20 @@ public class FpdFileContents {
         \r
         XmlCursor cursor = o.newCursor();\r
         if (cursor.toFirstChild()) {\r
-            DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData = \r
-                (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r
-            if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) {\r
-                cursor.removeXml();\r
-                cursor.dispose();\r
-                return;\r
-            }\r
-            while (cursor.toNextSibling()) {\r
-                \r
-                pcdBuildData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r
+            do {\r
+                DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData = \r
+                    (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject();\r
                 if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) {\r
                     cursor.removeXml();\r
+                    if (getDynamicPcdBuildDataCount() == 0) {\r
+                        cursor.toParent();\r
+                        cursor.removeXml();\r
+                    }\r
                     cursor.dispose();\r
                     return;\r
                 }\r
             }\r
+            while (cursor.toNextSibling());\r
         }\r
         cursor.dispose();\r
     }\r
@@ -1257,6 +1261,10 @@ public class FpdFileContents {
                 cursor.toNextSibling();\r
             }\r
             cursor.removeXml();\r
+            if (getBuildOptionsUserDefAntTaskCount() == 0) {\r
+                cursor.toParent();\r
+                cursor.removeXml();\r
+            }\r
         }\r
         cursor.dispose();\r
     }\r
@@ -1341,6 +1349,10 @@ public class FpdFileContents {
                 cursor.toNextSibling();\r
             }\r
             cursor.removeXml();\r
+            if (getBuildOptionsOptCount() == 0) {\r
+                cursor.toParent();\r
+                cursor.removeXml();\r
+            }\r
         }\r
         cursor.dispose();\r
     }\r
@@ -1576,10 +1588,15 @@ public class FpdFileContents {
                 cursor.toNextSibling(qSections);\r
             }\r
             if (cursor.toFirstChild()) {\r
-                for (int m = 0; m < k; ++m) {\r
+                int m = 0;\r
+                for (; m < k; ++m) {\r
                     cursor.toNextSibling();\r
                 }\r
                 cursor.removeXml();\r
+                if (m == 0) {\r
+                    cursor.toParent();\r
+                    cursor.removeXml();\r
+                }\r
             }\r
         }\r
         cursor.dispose();\r
@@ -1858,7 +1875,16 @@ public class FpdFileContents {
     }\r
     \r
     public void setPlatformDefsOutputDir(String outputDir) {\r
-        getfpdPlatformDefs().setOutputDirectory(outputDir);\r
+        if (outputDir != null && outputDir.length() > 0) {\r
+            getfpdPlatformDefs().setOutputDirectory(outputDir);\r
+        }\r
+        else{\r
+            XmlCursor cursor = getfpdPlatformDefs().newCursor();\r
+            if (cursor.toChild(new QName(xmlNs, "OutputDirectory"))) {\r
+                cursor.removeXml();\r
+            }\r
+            cursor.dispose();\r
+        }\r
     }\r
     \r
     public FlashDocument.Flash getfpdFlash() {\r