]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix the problem of not sync. module order list in FVs when user change the FvBinding...
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 21 Oct 2006 04:05:01 +0000 (04:05 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 21 Oct 2006 04:05:01 +0000 (04:05 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1808 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java

index fc49cd4151faf641964d3a1e920b9e3a3cdc344f..bc472480732078223a42f3fe1018ab6e41be5d93 100644 (file)
@@ -1991,7 +1991,16 @@ public class FpdFileContents {
     }\r
     \r
     public void removeModuleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {\r
     }\r
     \r
     public void removeModuleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) {\r
-        if (getUserExtsIncModCount(fvName) > 0) {\r
+        //\r
+        // if there is only one module before remove operation, the whole user extension should be removed.\r
+        //\r
+        int moduleAmount = getUserExtsIncModCount(fvName);\r
+        if (moduleAmount == 1) {\r
+            removeBuildOptionsUserExtensions(fvName);\r
+            return;\r
+        }\r
+        \r
+        if (moduleAmount > 1) {\r
             \r
             XmlCursor cursor = getfpdBuildOpts().newCursor();\r
             QName elementUserExts = new QName (xmlNs, "UserExtensions");\r
             \r
             XmlCursor cursor = getfpdBuildOpts().newCursor();\r
             QName elementUserExts = new QName (xmlNs, "UserExtensions");\r
index ac8841c7907ffa893a83895fbb0868f9ae93a033..5d26337411a6b7c22bcf4d3236e7249117ee81c2 100644 (file)
@@ -1282,6 +1282,19 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         }\r
         return jPanelModuleSaOpts;\r
     }\r
         }\r
         return jPanelModuleSaOpts;\r
     }\r
+    \r
+    private Vector<String> getVectorFromString (String s) {\r
+        if (s == null || s.equals("null")) {\r
+            s = "";\r
+        }\r
+        String[] sa1 = s.split(" ");\r
+        Vector<String> v = new Vector<String>();\r
+        for (int i = 0; i < sa1.length; ++i) {\r
+            v.add(sa1[i]);\r
+        }\r
+        return v;\r
+    }\r
+    \r
     /**\r
      * This method initializes jTextField      \r
      *         \r
     /**\r
      * This method initializes jTextField      \r
      *         \r
@@ -1303,11 +1316,24 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                         return;\r
                     }\r
                     \r
                         return;\r
                     }\r
                     \r
-                    ffc.setFvBinding(moduleKey, newFvBinding);\r
+                    Vector<String> oldFvList = getVectorFromString (originalFvBinding);\r
+                    Vector<String> newFvList = getVectorFromString (newFvBinding);\r
                     String moduleInfo[] = moduleKey.split(" ");\r
                     String moduleInfo[] = moduleKey.split(" ");\r
-                    String fvNames[] = newFvBinding.split(" ");\r
-                    for (int i = 0; i < fvNames.length; ++i) {\r
-                        ffc.addModuleIntoBuildOptionsUserExtensions(fvNames[i], moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);\r
+                    ffc.setFvBinding(moduleKey, newFvBinding);\r
+                    //\r
+                    // remove module from Fvs that not in newFvList now.\r
+                    //\r
+                    oldFvList.removeAll(newFvList);\r
+                    for (int j = 0; j < oldFvList.size(); ++j) {\r
+                        ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);    \r
+                    }\r
+                    //\r
+                    // add module to Fvs that were not in oldFvList.\r
+                    //\r
+                    oldFvList = getVectorFromString (originalFvBinding);\r
+                    newFvList.removeAll(oldFvList);\r
+                    for (int i = 0; i < newFvList.size(); ++i) {\r
+                        ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]);\r
                     }\r
                     docConsole.setSaved(false);\r
                 }\r
                     }\r
                     docConsole.setSaved(false);\r
                 }\r