import org.tianocore.frameworkwizard.common.Sort;\r
import org.tianocore.frameworkwizard.common.Tools;\r
import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
+import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r
import org.tianocore.frameworkwizard.far.FarHeader;\r
import org.tianocore.frameworkwizard.far.FarIdentification;\r
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
return GlobalData.vPackageList;\r
}\r
\r
+ /**\r
+ Get all package which match parameter isRepackagable\r
+ \r
+ @param isRepackagable\r
+ @return\r
+ \r
+ **/\r
+ public Vector<PackageIdentification> getAllRepackagablePackages() {\r
+ Vector<PackageIdentification> v = new Vector<PackageIdentification>();\r
+ for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {\r
+ OpeningPackageType opt = GlobalData.openingPackageList.getOpeningPackageByIndex(index);\r
+ if (opt.getXmlSpd() != null) {\r
+ if (opt.getXmlSpd().getPackageDefinitions() != null) {\r
+ if (opt.getXmlSpd().getPackageDefinitions().getRePackage()) {\r
+ v.addElement(opt.getId());\r
+ }\r
+ } else {\r
+ v.addElement(opt.getId());\r
+ }\r
+ } else {\r
+ v.addElement(opt.getId());\r
+ }\r
+ }\r
+ return v;\r
+ }\r
+\r
public Vector<FarIdentification> getAllFars() {\r
\r
Vector<FarIdentification> v = new Vector<FarIdentification>();\r
String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText();\r
Vector<String> type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList()\r
.get(index).getValidUsage());\r
-\r
+ //\r
+ // The algorithm for PCD of msa should be:\r
+ // 1. If the type of PCD from Spd is FEATURE_FLAG, \r
+ // the type of Msa only can be FEATURE_FLAG.\r
+ // 2. If the type of PCD from Spd is not FEATURE_FLAG, \r
+ // the type of Msa could be selected from the PCD's all types and "DYNAMIC" type.\r
+ //\r
+ boolean hasFEATURE_FLAG = false;\r
+ boolean hasDYNAMIC = false;\r
+ for (int indexOfType = 0; indexOfType < type.size(); indexOfType++) {\r
+ if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {\r
+ hasDYNAMIC = true;\r
+ }\r
+ if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {\r
+ hasFEATURE_FLAG = true;\r
+ }\r
+ }\r
+ if (hasFEATURE_FLAG) {\r
+ type.removeAllElements();\r
+ type.addElement(DataType.PCD_ITEM_TYPE_FEATURE_FLAG);\r
+ } else {\r
+ if (!hasDYNAMIC) {\r
+ type.addElement(DataType.PCD_ITEM_TYPE_DYNAMIC);\r
+ }\r
+ }\r
vector.addPcd(new PcdIdentification(name, guidCName, help, type));\r
}\r
}\r
//\r
// Check id\r
//\r
- if (mid.equals(id)) {\r
- return GlobalData.vPackageList.elementAt(indexI);\r
+ if (mid != null) {\r
+ if (mid.equals(id)) {\r
+ return GlobalData.vPackageList.elementAt(indexI);\r
+ }\r
}\r
-\r
}\r
}\r
\r
//\r
PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();\r
PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);\r
- if (spd != null) {\r
- if (spd.getLibraryClassDeclarations() != null) {\r
- LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();\r
- for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {\r
- if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {\r
- v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())\r
- + DataType.FILE_SEPARATOR\r
- + lcdl.getLibraryClassList()\r
- .get(indexOfLibOfSpd)\r
- .getIncludeHeader()));\r
- }\r
- }\r
- }\r
+ String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name);\r
+ if (!Tools.isEmpty(headerFile)) {\r
+ v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())\r
+ + DataType.FILE_SEPARATOR + headerFile));\r
}\r
}\r
}\r
}\r
return v;\r
}\r
+\r
+ public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) {\r
+ String headerFile = "";\r
+ if (spd != null) {\r
+ if (spd.getLibraryClassDeclarations() != null) {\r
+ LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();\r
+ for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {\r
+ if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {\r
+ return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader();\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ return headerFile;\r
+ }\r
}\r