this.jLabelBelong.setEnabled(false);\r
this.jComboBoxExistingPackage.setEnabled(false);\r
this.jButtonBrowse.setVisible(false);\r
- this.jTextFieldFilePath.setToolTipText("<html>Input the package's relative path and file name, for example:<br>MdePkg\\MdePkg.spd</html>");\r
+ this.jTextFieldFilePath\r
+ .setToolTipText("<html>Input the package's relative path and file name, for example:<br>MdePkg\\MdePkg.spd</html>");\r
this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);\r
this.jLabelDestinationFile.setText("New Package Path and Filename");\r
}\r
this.jButtonGenerateGuid.setEnabled(false);\r
this.jLabelVersion.setEnabled(false);\r
this.jTextFieldVersion.setEnabled(false);\r
- this.jTextFieldFilePath.setToolTipText("<html>Input the workspace path, for example:<br>C:\\MyWorkspace</html>");\r
+ this.jTextFieldFilePath\r
+ .setToolTipText("<html>Input the workspace path, for example:<br>C:\\MyWorkspace</html>");\r
this.jLabelDestinationFile.setText("New Workspace Path");\r
}\r
}\r
return false;\r
}\r
if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
- Log.wrn("Clone", "<html>Incorrect data type for the Name, it must<br>be a single word, starting with an alpha character.</html>");\r
+ Log\r
+ .wrn("Clone",\r
+ "<html>Incorrect data type for the Name, it must<br>be a single word, starting with an alpha character.</html>");\r
return false;\r
}\r
\r
return false;\r
}\r
if (!DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.wrn("Clone", "<html>Incorrect data type for Guid, which must<br>be in registry format (8-4-4-4-12) for example:<br>d3adb123-eef1-466d-39ac-02febcaf5997</html>");\r
+ Log\r
+ .wrn(\r
+ "Clone",\r
+ "<html>Incorrect data type for Guid, which must<br>be in registry format (8-4-4-4-12) for example:<br>d3adb123-eef1-466d-39ac-02febcaf5997</html>");\r
return false;\r
}\r
\r
return false;\r
}\r
if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {\r
- Log.wrn("Clone", "<html>Incorrect data type for Version, which must<br>be one or more digits, optionally followed by sequence<br>of one or more dot, one or more digits; examples:<br>1.0 1.0.1 12.25.256</html>");\r
+ Log\r
+ .wrn(\r
+ "Clone",\r
+ "<html>Incorrect data type for Version, which must<br>be one or more digits, optionally followed by sequence<br>of one or more dot, one or more digits; examples:<br>1.0 1.0.1 12.25.256</html>");\r
return false;\r
}\r
\r
newId.setPath(trg);\r
vFiles = wt.getAllFilesPathOfModule(src);\r
\r
+ String oldPackagePath = GlobalData.openingModuleList.getIdByPath(src).getPackageId().getPath();\r
+ String newPackagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();\r
+\r
//\r
// First copy all files to new directory\r
//\r
FileOperation.copyFile(src, trg);\r
for (int index = 1; index < vFiles.size(); index++) {\r
String oldFile = vFiles.get(index);\r
- String newFile = vFiles.get(index).replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));\r
+ String newFile = "";\r
+ if (oldFile.indexOf(Tools.getFilePathOnly(src)) > -1) {\r
+ //\r
+ // The file is not include header\r
+ //\r
+ newFile = oldFile.replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));\r
+ } else if (oldFile.indexOf(Tools.getFilePathOnly(oldPackagePath)) > -1) {\r
+ //\r
+ // The file is include header\r
+ //\r
+ newFile = oldFile.replace(Tools.getFilePathOnly(oldPackagePath),\r
+ Tools.getFilePathOnly(newPackagePath));\r
+ }\r
+\r
FileOperation.copyFile(oldFile, newFile);\r
}\r
\r
// Update <Cloned> Section\r
//\r
updateModuleClonedId(msa, oldId);\r
- \r
+\r
//\r
// Save to file\r
//\r
// Update the db file\r
//\r
wt.addModuleToPackage(mid, psa);\r
- \r
+\r
//\r
// Update GlobalData\r
//\r
// Update the db file\r
//\r
wt.addPackageToDatabase(pid);\r
- \r
+\r
//\r
// Update GlobalData\r
//\r
GlobalData.vPackageList.addElement(pid);\r
GlobalData.openingPackageList.insertToOpeningPackageList(pid, spd);\r
- \r
+\r
//\r
// Add all cloned modules\r
//\r
Vector<String> modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath());\r
String modulePath = null;\r
ModuleSurfaceArea msa = null;\r
- \r
+\r
for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
try {\r
modulePath = modulePaths.get(indexJ);\r
GlobalData.vModuleList.addElement(mid);\r
GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);\r
}\r
- \r
+\r
this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;\r
}\r
\r
// Update the db file\r
//\r
wt.addPlatformToDatabase(fid);\r
- \r
+\r
//\r
// Update GlobalData\r
//\r
import org.apache.xmlbeans.XmlException;\r
import org.tianocore.DbPathAndFilename;\r
import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;\r
+import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations;\r
+import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
import org.tianocore.MsaFilesDocument.MsaFiles;\r
import org.tianocore.PackageDependenciesDocument.PackageDependencies;\r
msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn);\r
spd.setMsaFiles(msaFile);\r
SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd);\r
+ //\r
+ // Update GlobalData\r
+ //\r
+ GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()).setMsaFiles(msaFile);\r
}\r
\r
/**\r
public Vector<String> getAllFilesPathOfModule(String path) {\r
Vector<String> v = new Vector<String>();\r
path = Tools.convertPathToCurrentOsType(path);\r
+\r
+ //\r
+ // First add msa file's path\r
+ //\r
v.addElement(path);\r
+\r
ModuleSurfaceArea msa = GlobalData.openingModuleList\r
.getModuleSurfaceAreaFromId(GlobalData.openingModuleList\r
.getIdByPath(path));\r
+ //\r
+ // Get common defined files of module\r
+ //\r
if (msa != null) {\r
//\r
// Get all files' path of a module\r
}\r
}\r
\r
+ //\r
+ // Get include header files for this module\r
+ //\r
+ if (msa.getLibraryClassDefinitions() != null) {\r
+ LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();\r
+ for (int index = 0; index < lcd.sizeOfLibraryClassArray(); index++) {\r
+ if (lcd.getLibraryClassList().get(index).getUsage().toString()\r
+ .equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
+ || lcd.getLibraryClassList().get(index).getUsage().toString()\r
+ .equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
+ //\r
+ // Get library class name\r
+ //\r
+ String name = lcd.getLibraryClassList().get(index).getKeyword();\r
+\r
+ //\r
+ // Find file path for this class\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
+ }\r
+ }\r
+ }\r
+ }\r
+\r
return v;\r
}\r
\r