}\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
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
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 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