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
This commit is contained in:
jlin16 2006-10-21 04:05:01 +00:00
parent 92a4a910df
commit 9162172593
2 changed files with 40 additions and 5 deletions

View File

@ -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");

View File

@ -1282,6 +1282,19 @@ public class FpdModuleSA extends JDialog implements ActionListener {
}
return jPanelModuleSaOpts;
}
private Vector<String> getVectorFromString (String s) {
if (s == null || s.equals("null")) {
s = "";
}
String[] sa1 = s.split(" ");
Vector<String> v = new Vector<String>();
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<String> oldFvList = getVectorFromString (originalFvBinding);
Vector<String> 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);
}