import org.tianocore.frameworkwizard.common.DataType;\r
import org.tianocore.frameworkwizard.common.DataValidation;\r
import org.tianocore.frameworkwizard.common.FileOperation;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
import org.tianocore.frameworkwizard.common.IFileFilter;\r
import org.tianocore.frameworkwizard.common.Log;\r
import org.tianocore.frameworkwizard.common.OpenFile;\r
initExistingPackage();\r
this.jButtonBrowse.setVisible(false);\r
this.jTextFieldFilePath\r
- .setToolTipText("Input module name here. For example, Application\\HelloWorld\\HelloWorld.msa");\r
+ .setToolTipText("<html>Input the module's relative path and filename, for example:<br>Application\\HelloWorld\\HelloWorld.msa</html>");\r
this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);\r
this.jLabelDestinationFile.setText("New Module Path and Filename");\r
}\r
this.jLabelBelong.setEnabled(false);\r
this.jComboBoxExistingPackage.setEnabled(false);\r
this.jButtonBrowse.setVisible(false);\r
- this.jTextFieldFilePath.setToolTipText("Input package name here. For example, MdePkg\\MdePkg.fpd");\r
+ this.jTextFieldFilePath.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.jLabelBelong.setEnabled(false);\r
this.jComboBoxExistingPackage.setEnabled(false);\r
this.jTextFieldFilePath\r
- .setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd");\r
+ .setToolTipText("<html>Select the platform's relative path and filename. For example:<br>C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd</html>");\r
this.jLabelDestinationFile.setText("New Platform Path and Filename");\r
}\r
//\r
this.jButtonGenerateGuid.setEnabled(false);\r
this.jLabelVersion.setEnabled(false);\r
this.jTextFieldVersion.setEnabled(false);\r
- this.jTextFieldFilePath.setToolTipText("Input workspace path here. For example, C:\\MyWorkspace");\r
+ this.jTextFieldFilePath.setToolTipText("<html>Input the workspace path, for example:<br>C:\\MyWorkspace</html>");\r
this.jLabelDestinationFile.setText("New Workspace Path");\r
}\r
}\r
if (jContentPane == null) {\r
jLabelBelong = new JLabel();\r
jLabelBelong.setBounds(new java.awt.Rectangle(15, 60, 190, 20));\r
- jLabelBelong.setText("Clone to Package");\r
+ jLabelBelong.setText("Clone Package");\r
jLabelVersion = new JLabel();\r
jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 190, 20));\r
jLabelVersion.setText("Version");\r
// Check Basename\r
//\r
if (isEmpty(this.jTextFieldBaseName.getText())) {\r
- Log.wrn("Clone", "Base Name couldn't be empty!");\r
+ Log.wrn("Clone", "The Name is required!");\r
return false;\r
}\r
if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
- Log.wrn("Clone", "Incorrect data type for Base Name");\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
return false;\r
}\r
\r
// Check Guid\r
//\r
if (isEmpty(this.jTextFieldGuid.getText())) {\r
- Log.wrn("Clone", "Guid couldn't be empty!");\r
+ Log.wrn("Clone", "A Guid is required!!");\r
return false;\r
}\r
if (!DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.wrn("Clone", "Incorrect data type for Guid");\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
return false;\r
}\r
\r
// Check Version\r
//\r
if (isEmpty(this.jTextFieldVersion.getText())) {\r
- Log.wrn("Clone", "Version couldn't be empty!");\r
+ Log.wrn("Clone", "A Version must be entered!");\r
return false;\r
}\r
if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {\r
- Log.wrn("Clone", "Incorrect data type for Version");\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
return false;\r
}\r
\r
// Common Check\r
//\r
if (!srcFile.exists()) {\r
- Log.wrn("Clone", "The source doesn't exist");\r
+ Log.wrn("Clone", "The source file does not exist!");\r
return false;\r
}\r
if (isEmpty(trg)) {\r
- Log.wrn("Clone", "The destination file path couldn't be empty");\r
+ Log.wrn("Clone", "The destination file path must be entered!");\r
return false;\r
}\r
if (src.equals(trg)) {\r
- Log.wrn("Clone", "The source and destination couldn't be same");\r
+ Log.wrn("Clone", "The source and destination can not be same!");\r
return false;\r
}\r
if (trgFile.exists()) {\r
- Log.wrn("Clone", "The destination already exists");\r
+ Log.wrn("Clone", "The destination already exists!");\r
return false;\r
}\r
\r
//\r
if (mode == DataType.RETURN_TYPE_WORKSPACE) {\r
if (trg.indexOf(src + DataType.FILE_SEPARATOR) == 0) {\r
- Log.wrn("Clone", "The new workspace couldn't be in current workspace!");\r
+ Log.wrn("Clone", "The new workspace can not be located within the current workspace!");\r
return false;\r
}\r
}\r
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
trg = this.getModulePath();\r
if (src.equals(trg)) {\r
- Log.wrn("Clone", "The source and destination couldn't be same");\r
+ Log.wrn("Clone", "The source and destination paths for cloning a module must be different!");\r
return false;\r
}\r
trgFile = new File(trg);\r
if (trgFile.exists()) {\r
- Log.wrn("Clone", "The target module already exists");\r
+ Log.wrn("Clone", "The target module already exists!");\r
return false;\r
}\r
return checkId();\r
//\r
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
if (trg.indexOf(DataType.DOS_FILE_SEPARATOR) == -1 && trg.indexOf(DataType.UNIX_FILE_SEPARATOR) == -1) {\r
- Log.wrn("Clone", "The package name must include a path");\r
+ Log.wrn("Clone", "The package name must include a path!");\r
return false;\r
}\r
trg = this.getPackagePath();\r
if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {\r
- Log.wrn("Clone", "The source and destination couldn't be same");\r
+ Log.wrn("Clone", "The source and destination paths for cloning a package must be different!");\r
return false;\r
}\r
trgFile = new File(trg);\r
if (trgFile.exists()) {\r
- Log.wrn("Clone", "The target package already exists");\r
+ Log.wrn("Clone", "The target package already exists!");\r
return false;\r
}\r
return checkId();\r
//\r
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
if (trg.indexOf(Workspace.getCurrentWorkspace()) != 0) {\r
- Log.wrn("Clone", "The target platform must be in current workspace");\r
+ Log.wrn("Clone", "The platform clone must be located in the current workspace!");\r
return false;\r
}\r
trgFile = new File(trg);\r
if (trgFile.exists()) {\r
- Log.wrn("Clone", "The target platform already exists");\r
+ Log.wrn("Clone", "The target platform already exists.");\r
return false;\r
}\r
return checkId();\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
+ // Update GlobalData\r
+ //\r
+ GlobalData.vModuleList.addElement(mid);\r
+ GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);\r
\r
this.returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;\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
+ // Add all cloned modules\r
+ //\r
+ Vector<String> modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath());\r
+ String modulePath = null;\r
+ ModuleSurfaceArea msa = null;\r
+ \r
+ for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
+ try {\r
+ modulePath = modulePaths.get(indexJ);\r
+ msa = OpenFile.openMsaFile(modulePath);\r
+ } catch (IOException e) {\r
+ Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
+ continue;\r
+ } catch (XmlException e) {\r
+ Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
+ continue;\r
+ } catch (Exception e) {\r
+ Log.err("Open Module Surface Area " + modulePath, "Invalid file type");\r
+ continue;\r
+ }\r
+ Identification id = Tools.getId(modulePath, msa);\r
+ mid = new ModuleIdentification(id, pid);\r
+ GlobalData.vModuleList.addElement(mid);\r
+ GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);\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
+ // Update GlobalData\r
+ //\r
+ GlobalData.vPlatformList.addElement(fid);\r
+ GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, fpd);\r
\r
this.returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;\r
}\r
c.setPackageGuid(id.getGuid());\r
c.setPackageVersion(id.getVersion());\r
c.setId(count.add(new BigInteger("1")));\r
- String guid = wt.getModuleFarGuid(oldId);\r
+ String guid = wt.getPackageFarGuid(oldId);\r
if (guid != null && !guid.equals("")) {\r
c.setFarGuid(guid);\r
}\r
c.setPlatformGuid(id.getGuid());\r
c.setPlatformVersion(id.getVersion());\r
c.setId(count.add(new BigInteger("1")));\r
- String guid = wt.getModuleFarGuid(oldId);\r
+ String guid = wt.getPlatformFarGuid(oldId);\r
if (guid != null && !guid.equals("")) {\r
c.setFarGuid(guid);\r
}\r