import org.tianocore.frameworkwizard.common.FileOperation;\r
import org.tianocore.frameworkwizard.common.IFileFilter;\r
import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.OpenFile;\r
import org.tianocore.frameworkwizard.common.SaveFile;\r
import org.tianocore.frameworkwizard.common.Tools;\r
import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpenFile;\r
import org.tianocore.frameworkwizard.common.ui.IDialog;\r
import org.tianocore.frameworkwizard.common.ui.IFrame;\r
import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
this.jTextFieldSource.setText(Tools.convertPathToCurrentOsType(s));\r
initExistingPackage();\r
this.jButtonBrowse.setVisible(false);\r
- this.jTextFieldFilePath.setToolTipText("Input module name here. For example, Application\\HelloWorld\\HelloWorld.msa");\r
+ this.jTextFieldFilePath\r
+ .setToolTipText("Input module name here. For example, Application\\HelloWorld\\HelloWorld.msa");\r
this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);\r
this.jLabelDestinationFile.setText("New Module Path and Filename");\r
}\r
this.jTextFieldSource.setText(oldId.getPath());\r
this.jLabelBelong.setEnabled(false);\r
this.jComboBoxExistingPackage.setEnabled(false);\r
- this.jTextFieldFilePath.setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd");\r
+ this.jTextFieldFilePath\r
+ .setToolTipText("Select platform path here. For example, C:\\MyWorkspace\\EdkNt32Pkg\\Nt32.fpd");\r
this.jLabelDestinationFile.setText("New Platform Path and Filename");\r
}\r
if (mode == DataType.RETURN_TYPE_WORKSPACE) {\r
try {\r
this.save();\r
} catch (IOException e) {\r
+ Log.wrn("Clone", e.getMessage());\r
Log.err("Clone", e.getMessage());\r
- e.printStackTrace();\r
return;\r
} catch (XmlException e) {\r
+ Log.wrn("Clone", e.getMessage());\r
Log.err("Clone", e.getMessage());\r
- e.printStackTrace();\r
return;\r
} catch (Exception e) {\r
+ Log.wrn("Clone", e.getMessage());\r
Log.err("Clone", e.getMessage());\r
- e.printStackTrace();\r
return;\r
}\r
} else {\r
// Check Basename\r
//\r
if (isEmpty(this.jTextFieldBaseName.getText())) {\r
- Log.err("Base Name couldn't be empty!");\r
+ Log.wrn("Clone", "Base Name couldn't be empty!");\r
return false;\r
}\r
if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\r
- Log.err("Incorrect data type for Base Name");\r
+ Log.wrn("Clone", "Incorrect data type for Base Name");\r
return false;\r
}\r
\r
// Check Guid\r
//\r
if (isEmpty(this.jTextFieldGuid.getText())) {\r
- Log.err("Guid couldn't be empty!");\r
+ Log.wrn("Clone", "Guid couldn't be empty!");\r
return false;\r
}\r
if (!DataValidation.isGuid(this.jTextFieldGuid.getText())) {\r
- Log.err("Incorrect data type for Guid");\r
+ Log.wrn("Clone", "Incorrect data type for Guid");\r
return false;\r
}\r
\r
// Check Version\r
//\r
if (isEmpty(this.jTextFieldVersion.getText())) {\r
- Log.err("Version couldn't be empty!");\r
+ Log.wrn("Clone", "Version couldn't be empty!");\r
return false;\r
}\r
if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {\r
- Log.err("Incorrect data type for Version");\r
+ Log.wrn("Clone", "Incorrect data type for Version");\r
return false;\r
}\r
\r
// Common Check\r
//\r
if (!srcFile.exists()) {\r
- Log.err("The source doesn't exist");\r
+ Log.wrn("Clone", "The source doesn't exist");\r
return false;\r
}\r
if (isEmpty(trg)) {\r
- Log.err("The destination file path couldn't be empty");\r
+ Log.wrn("Clone", "The destination file path couldn't be empty");\r
return false;\r
}\r
if (src.equals(trg)) {\r
- Log.err("The source and destination couldn't be same");\r
+ Log.wrn("Clone", "The source and destination couldn't be same");\r
return false;\r
}\r
if (trgFile.exists()) {\r
- Log.err("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.err("The new workspace couldn't be in current workspace!");\r
+ Log.wrn("Clone", "The new workspace couldn't be in current workspace!");\r
return false;\r
}\r
}\r
// Check for Module\r
//\r
if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
-// if (trg.indexOf(DataType.DOS_FILE_SEPARATOR) == -1 && trg.indexOf(DataType.UNIX_FILE_SEPARATOR) == -1) {\r
-// Log.err("The module name must include a path");\r
-// return false;\r
-// }\r
+ // if (trg.indexOf(DataType.DOS_FILE_SEPARATOR) == -1 && trg.indexOf(DataType.UNIX_FILE_SEPARATOR) == -1) {\r
+ // Log.err("The module name must include a path");\r
+ // return false;\r
+ // }\r
trg = this.getModulePath();\r
if (src.equals(trg)) {\r
- Log.err("The source and destination couldn't be same");\r
+ Log.wrn("Clone", "The source and destination couldn't be same");\r
return false;\r
}\r
trgFile = new File(trg);\r
if (trgFile.exists()) {\r
- Log.err("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.err("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.err("The source and destination couldn't be same");\r
+ Log.wrn("Clone", "The source and destination couldn't be same");\r
return false;\r
}\r
trgFile = new File(trg);\r
if (trgFile.exists()) {\r
- Log.err("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.err("The target platform must be in current workspace");\r
+ Log.wrn("Clone", "The target platform must be in current workspace");\r
return false;\r
}\r
trgFile = new File(trg);\r
if (trgFile.exists()) {\r
- Log.err("The target platform already exists");\r
+ Log.wrn("Clone", "The target platform already exists");\r
return false;\r
}\r
return checkId();\r
String src = this.oldId.getPath();\r
String trg = this.jTextFieldFilePath.getText();\r
Vector<String> vFiles = new Vector<String>();\r
- \r
+\r
//\r
// Clone Workspace\r
//\r
if (mode == DataType.RETURN_TYPE_WORKSPACE) {\r
- try {\r
- FileOperation.copyFolder(src, trg);\r
- } catch (Exception e) {\r
- this.returnType = DataType.RETURN_TYPE_CANCEL;\r
- Log.err("Clone Workspace", e.getMessage());\r
- e.printStackTrace();\r
- }\r
+ FileOperation.copyFolder(src, trg);\r
this.returnType = DataType.RETURN_TYPE_WORKSPACE;\r
}\r
\r
trg = getModulePath();\r
newId.setPath(trg);\r
vFiles = wt.getAllModuleFilesPath(src);\r
- \r
+\r
//\r
// First copy all files to new directory\r
//\r
// Update Cloned From element\r
//\r
updateModuleClonedId(msa, oldId);\r
- \r
+\r
//\r
// Save to file\r
//\r
//\r
// Update to platformId\r
//\r
- this.setMid(new ModuleIdentification(newId, packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())));\r
+ this.setMid(new ModuleIdentification(newId,\r
+ packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex())));\r
\r
//\r
// Open belonging package\r
//\r
PackageSurfaceArea psa = PackageSurfaceArea.Factory.newInstance();\r
psa = OpenFile.openSpdFile(mid.getPackageId().getPath());\r
- \r
+\r
//\r
// Update the db file\r
//\r
trg = this.getPackagePath();\r
newId.setPath(trg);\r
vFiles = wt.getAllPakcageFilesPath(src);\r
- \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
FileOperation.copyFile(oldFile, newFile);\r
}\r
- \r
+\r
//\r
// First copy all files to new directory\r
//\r
// Update Cloned From element\r
//\r
updatePackageClonedId(spd, oldId);\r
- \r
+\r
//\r
// Save to file\r
//\r
}\r
vFiles = null;\r
}\r
- \r
+\r
private String getSelectPackagePath() {\r
return Tools.getFilePathOnly(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath());\r
}\r
Tools.convertPathToCurrentOsType(trg);\r
return trg;\r
}\r
- \r
+\r
private String getPackagePath() {\r
String trg = this.jTextFieldFilePath.getText();\r
trg = Tools.addPathExt(trg, mode);\r
trg = Tools.convertPathToCurrentOsType(trg);\r
return trg;\r
}\r
- \r
+\r
/**\r
Set target item's Cloned From element\r
\r
c.setId(count.add(new BigInteger("1")));\r
String guid = wt.getModuleFarGuid(oldId);\r
if (guid != null && !guid.equals("")) {\r
- c.setFarGuid(guid); \r
+ c.setFarGuid(guid);\r
}\r
\r
cf.addNewCloned();\r
c.setId(count.add(new BigInteger("1")));\r
String guid = wt.getModuleFarGuid(oldId);\r
if (guid != null && !guid.equals("")) {\r
- c.setFarGuid(guid); \r
+ c.setFarGuid(guid);\r
}\r
\r
cf.addNewCloned();\r
c.setId(count.add(new BigInteger("1")));\r
String guid = wt.getModuleFarGuid(oldId);\r
if (guid != null && !guid.equals("")) {\r
- c.setFarGuid(guid); \r
+ c.setFarGuid(guid);\r
}\r
- \r
+\r
cf.addNewCloned();\r
cf.setClonedArray(cf.getClonedList().size() - 1, c);\r
pd.addNewClonedFrom();\r