]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
Fix the problem of not sync. module order list in FVs when user change the FvBinding...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdModuleSA.java
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