X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2FClone.java;h=3395434efda5ceef6da95a1f79772f14b5633990;hb=4917d9ddc38808bce82bc54ee690edf6bb5804a6;hp=68aef5eb35dd06dfca07aa330ed7b5a77b681799;hpb=739c6b04fd86cb47de673b1038bea336a7f3499c;p=mirror_edk2.git
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
index 68aef5eb35..3395434efd 100644
--- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
+++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
@@ -36,6 +36,7 @@ import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;
import org.tianocore.frameworkwizard.common.DataType;
import org.tianocore.frameworkwizard.common.DataValidation;
import org.tianocore.frameworkwizard.common.FileOperation;
+import org.tianocore.frameworkwizard.common.GlobalData;
import org.tianocore.frameworkwizard.common.IFileFilter;
import org.tianocore.frameworkwizard.common.Log;
import org.tianocore.frameworkwizard.common.OpenFile;
@@ -360,7 +361,7 @@ public class Clone extends IDialog {
initExistingPackage();
this.jButtonBrowse.setVisible(false);
this.jTextFieldFilePath
- .setToolTipText("Input module name here. For example, Application\\HelloWorld\\HelloWorld.msa");
+ .setToolTipText("Input the module's relative path and filename, for example:
Application\\HelloWorld\\HelloWorld.msa");
this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
this.jLabelDestinationFile.setText("New Module Path and Filename");
}
@@ -375,7 +376,7 @@ public class Clone extends IDialog {
this.jLabelBelong.setEnabled(false);
this.jComboBoxExistingPackage.setEnabled(false);
this.jButtonBrowse.setVisible(false);
- this.jTextFieldFilePath.setToolTipText("Input package name here. For example, MdePkg\\MdePkg.fpd");
+ this.jTextFieldFilePath.setToolTipText("Input the package's relative path and file name, for example:
MdePkg\\MdePkg.spd");
this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);
this.jLabelDestinationFile.setText("New Package Path and Filename");
}
@@ -388,7 +389,7 @@ public class Clone extends IDialog {
this.jLabelBelong.setEnabled(false);
this.jComboBoxExistingPackage.setEnabled(false);
this.jTextFieldFilePath
- .setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd");
+ .setToolTipText("Select the platform's relative path and filename. For example:
C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd");
this.jLabelDestinationFile.setText("New Platform Path and Filename");
}
//
@@ -406,7 +407,7 @@ public class Clone extends IDialog {
this.jButtonGenerateGuid.setEnabled(false);
this.jLabelVersion.setEnabled(false);
this.jTextFieldVersion.setEnabled(false);
- this.jTextFieldFilePath.setToolTipText("Input workspace path here. For example, C:\\MyWorkspace");
+ this.jTextFieldFilePath.setToolTipText("Input the workspace path, for example:
C:\\MyWorkspace");
this.jLabelDestinationFile.setText("New Workspace Path");
}
}
@@ -421,7 +422,7 @@ public class Clone extends IDialog {
if (jContentPane == null) {
jLabelBelong = new JLabel();
jLabelBelong.setBounds(new java.awt.Rectangle(15, 60, 190, 20));
- jLabelBelong.setText("Clone to Package");
+ jLabelBelong.setText("Clone Package");
jLabelVersion = new JLabel();
jLabelVersion.setBounds(new java.awt.Rectangle(15, 160, 190, 20));
jLabelVersion.setText("Version");
@@ -550,11 +551,11 @@ public class Clone extends IDialog {
// Check Basename
//
if (isEmpty(this.jTextFieldBaseName.getText())) {
- Log.wrn("Clone", "Base Name couldn't be empty!");
+ Log.wrn("Clone", "The Name is required!");
return false;
}
if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {
- Log.wrn("Clone", "Incorrect data type for Base Name");
+ Log.wrn("Clone", "Incorrect data type for the Name, it must
be a single word, starting with an alpha character.");
return false;
}
@@ -562,11 +563,11 @@ public class Clone extends IDialog {
// Check Guid
//
if (isEmpty(this.jTextFieldGuid.getText())) {
- Log.wrn("Clone", "Guid couldn't be empty!");
+ Log.wrn("Clone", "A Guid is required!!");
return false;
}
if (!DataValidation.isGuid(this.jTextFieldGuid.getText())) {
- Log.wrn("Clone", "Incorrect data type for Guid");
+ Log.wrn("Clone", "Incorrect data type for Guid, which must
be in registry format (8-4-4-4-12) for example:
d3adb123-eef1-466d-39ac-02febcaf5997");
return false;
}
@@ -574,11 +575,11 @@ public class Clone extends IDialog {
// Check Version
//
if (isEmpty(this.jTextFieldVersion.getText())) {
- Log.wrn("Clone", "Version couldn't be empty!");
+ Log.wrn("Clone", "A Version must be entered!");
return false;
}
if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {
- Log.wrn("Clone", "Incorrect data type for Version");
+ Log.wrn("Clone", "Incorrect data type for Version, which must
be one or more digits, optionally followed by sequence
of one or more dot, one or more digits; examples:
1.0 1.0.1 12.25.256");
return false;
}
@@ -610,19 +611,19 @@ public class Clone extends IDialog {
// Common Check
//
if (!srcFile.exists()) {
- Log.wrn("Clone", "The source doesn't exist");
+ Log.wrn("Clone", "The source file does not exist!");
return false;
}
if (isEmpty(trg)) {
- Log.wrn("Clone", "The destination file path couldn't be empty");
+ Log.wrn("Clone", "The destination file path must be entered!");
return false;
}
if (src.equals(trg)) {
- Log.wrn("Clone", "The source and destination couldn't be same");
+ Log.wrn("Clone", "The source and destination can not be same!");
return false;
}
if (trgFile.exists()) {
- Log.wrn("Clone", "The destination already exists");
+ Log.wrn("Clone", "The destination already exists!");
return false;
}
@@ -631,7 +632,7 @@ public class Clone extends IDialog {
//
if (mode == DataType.RETURN_TYPE_WORKSPACE) {
if (trg.indexOf(src + DataType.FILE_SEPARATOR) == 0) {
- Log.wrn("Clone", "The new workspace couldn't be in current workspace!");
+ Log.wrn("Clone", "The new workspace can not be located within the current workspace!");
return false;
}
}
@@ -642,12 +643,12 @@ public class Clone extends IDialog {
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {
trg = this.getModulePath();
if (src.equals(trg)) {
- Log.wrn("Clone", "The source and destination couldn't be same");
+ Log.wrn("Clone", "The source and destination paths for cloning a module must be different!");
return false;
}
trgFile = new File(trg);
if (trgFile.exists()) {
- Log.wrn("Clone", "The target module already exists");
+ Log.wrn("Clone", "The target module already exists!");
return false;
}
return checkId();
@@ -658,17 +659,17 @@ public class Clone extends IDialog {
//
if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {
if (trg.indexOf(DataType.DOS_FILE_SEPARATOR) == -1 && trg.indexOf(DataType.UNIX_FILE_SEPARATOR) == -1) {
- Log.wrn("Clone", "The package name must include a path");
+ Log.wrn("Clone", "The package name must include a path!");
return false;
}
trg = this.getPackagePath();
if (Tools.getFilePathOnly(src).equals(Tools.getFilePathOnly(trg))) {
- Log.wrn("Clone", "The source and destination couldn't be same");
+ Log.wrn("Clone", "The source and destination paths for cloning a package must be different!");
return false;
}
trgFile = new File(trg);
if (trgFile.exists()) {
- Log.wrn("Clone", "The target package already exists");
+ Log.wrn("Clone", "The target package already exists!");
return false;
}
return checkId();
@@ -679,12 +680,12 @@ public class Clone extends IDialog {
//
if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {
if (trg.indexOf(Workspace.getCurrentWorkspace()) != 0) {
- Log.wrn("Clone", "The target platform must be in current workspace");
+ Log.wrn("Clone", "The platform clone must be located in the current workspace!");
return false;
}
trgFile = new File(trg);
if (trgFile.exists()) {
- Log.wrn("Clone", "The target platform already exists");
+ Log.wrn("Clone", "The target platform already exists.");
return false;
}
return checkId();
@@ -752,7 +753,7 @@ public class Clone extends IDialog {
// Update Section
//
updateModuleClonedId(msa, oldId);
-
+
//
// Save to file
//
@@ -774,6 +775,12 @@ public class Clone extends IDialog {
// Update the db file
//
wt.addModuleToPackage(mid, psa);
+
+ //
+ // Update GlobalData
+ //
+ GlobalData.vModuleList.addElement(mid);
+ GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);
this.returnType = DataType.RETURN_TYPE_MODULE_SURFACE_AREA;
}
@@ -831,7 +838,40 @@ public class Clone extends IDialog {
// Update the db file
//
wt.addPackageToDatabase(pid);
-
+
+ //
+ // Update GlobalData
+ //
+ GlobalData.vPackageList.addElement(pid);
+ GlobalData.openingPackageList.insertToOpeningPackageList(pid, spd);
+
+ //
+ // Add all cloned modules
+ //
+ Vector modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath());
+ String modulePath = null;
+ ModuleSurfaceArea msa = null;
+
+ for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {
+ try {
+ modulePath = modulePaths.get(indexJ);
+ msa = OpenFile.openMsaFile(modulePath);
+ } catch (IOException e) {
+ Log.err("Open Module Surface Area " + modulePath, e.getMessage());
+ continue;
+ } catch (XmlException e) {
+ Log.err("Open Module Surface Area " + modulePath, e.getMessage());
+ continue;
+ } catch (Exception e) {
+ Log.err("Open Module Surface Area " + modulePath, "Invalid file type");
+ continue;
+ }
+ Identification id = Tools.getId(modulePath, msa);
+ mid = new ModuleIdentification(id, pid);
+ GlobalData.vModuleList.addElement(mid);
+ GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);
+ }
+
this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;
}
@@ -868,6 +908,12 @@ public class Clone extends IDialog {
// Update the db file
//
wt.addPlatformToDatabase(fid);
+
+ //
+ // Update GlobalData
+ //
+ GlobalData.vPlatformList.addElement(fid);
+ GlobalData.openingPlatformList.insertToOpeningPlatformList(fid, fpd);
this.returnType = DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA;
}
@@ -1016,7 +1062,7 @@ public class Clone extends IDialog {
c.setPackageGuid(id.getGuid());
c.setPackageVersion(id.getVersion());
c.setId(count.add(new BigInteger("1")));
- String guid = wt.getModuleFarGuid(oldId);
+ String guid = wt.getPackageFarGuid(oldId);
if (guid != null && !guid.equals("")) {
c.setFarGuid(guid);
}
@@ -1072,7 +1118,7 @@ public class Clone extends IDialog {
c.setPlatformGuid(id.getGuid());
c.setPlatformVersion(id.getVersion());
c.setId(count.add(new BigInteger("1")));
- String guid = wt.getModuleFarGuid(oldId);
+ String guid = wt.getPlatformFarGuid(oldId);
if (guid != null && !guid.equals("")) {
c.setFarGuid(guid);
}