From: jlin16 Date: Sat, 21 Oct 2006 04:05:01 +0000 (+0000) Subject: Fix the problem of not sync. module order list in FVs when user change the FvBinding... X-Git-Tag: edk2-stable201903~24066 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=91621725935f62c2c50be3695f7fee4966f08ab0 Fix the problem of not sync. module order list in FVs when user change the FvBinding for a ModuleSA. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1808 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index fc49cd4151..bc47248073 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -1991,7 +1991,16 @@ public class FpdFileContents { } public void removeModuleInBuildOptionsUserExtensions (String fvName, String moduleGuid, String moduleVersion, String packageGuid, String packageVersion, String arch) { - if (getUserExtsIncModCount(fvName) > 0) { + // + // if there is only one module before remove operation, the whole user extension should be removed. + // + int moduleAmount = getUserExtsIncModCount(fvName); + if (moduleAmount == 1) { + removeBuildOptionsUserExtensions(fvName); + return; + } + + if (moduleAmount > 1) { XmlCursor cursor = getfpdBuildOpts().newCursor(); QName elementUserExts = new QName (xmlNs, "UserExtensions"); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index ac8841c790..5d26337411 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -1282,6 +1282,19 @@ public class FpdModuleSA extends JDialog implements ActionListener { } return jPanelModuleSaOpts; } + + private Vector getVectorFromString (String s) { + if (s == null || s.equals("null")) { + s = ""; + } + String[] sa1 = s.split(" "); + Vector v = new Vector(); + for (int i = 0; i < sa1.length; ++i) { + v.add(sa1[i]); + } + return v; + } + /** * This method initializes jTextField * @@ -1303,11 +1316,24 @@ public class FpdModuleSA extends JDialog implements ActionListener { return; } - ffc.setFvBinding(moduleKey, newFvBinding); + Vector oldFvList = getVectorFromString (originalFvBinding); + Vector newFvList = getVectorFromString (newFvBinding); String moduleInfo[] = moduleKey.split(" "); - String fvNames[] = newFvBinding.split(" "); - for (int i = 0; i < fvNames.length; ++i) { - ffc.addModuleIntoBuildOptionsUserExtensions(fvNames[i], moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); + ffc.setFvBinding(moduleKey, newFvBinding); + // + // remove module from Fvs that not in newFvList now. + // + oldFvList.removeAll(newFvList); + for (int j = 0; j < oldFvList.size(); ++j) { + ffc.removeModuleInBuildOptionsUserExtensions(oldFvList.get(j), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); + } + // + // add module to Fvs that were not in oldFvList. + // + oldFvList = getVectorFromString (originalFvBinding); + newFvList.removeAll(oldFvList); + for (int i = 0; i < newFvList.size(); ++i) { + ffc.addModuleIntoBuildOptionsUserExtensions(newFvList.get(i), moduleInfo[0], moduleInfo[1], moduleInfo[2], moduleInfo[3], moduleInfo[4]); } docConsole.setSaved(false); }