]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
Adjusted sizes to accommodate Windows, iMac and Linux GUI
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / Clone.java
index 016bada67873fd70cfc26aa65e39c6d58613ea7d..9253793ca966d137311af29b506413fff59a26a9 100644 (file)
@@ -336,7 +336,8 @@ public class Clone extends IDialog {
             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
@@ -357,7 +358,8 @@ public class Clone extends IDialog {
             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
@@ -446,16 +448,16 @@ public class Clone extends IDialog {
                 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
@@ -507,11 +509,11 @@ public class Clone extends IDialog {
         // 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
@@ -519,11 +521,11 @@ public class Clone extends IDialog {
         // 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
@@ -531,11 +533,11 @@ public class Clone extends IDialog {
         // 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
@@ -566,19 +568,19 @@ public class Clone extends IDialog {
         // 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
@@ -587,7 +589,7 @@ public class Clone extends IDialog {
         //\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
@@ -596,18 +598,18 @@ public class Clone extends IDialog {
         // 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
@@ -618,17 +620,17 @@ public class Clone extends IDialog {
         //\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
@@ -639,12 +641,12 @@ public class Clone extends IDialog {
         //\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
@@ -657,18 +659,12 @@ public class Clone extends IDialog {
         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
@@ -682,7 +678,7 @@ public class Clone extends IDialog {
             trg = getModulePath();\r
             newId.setPath(trg);\r
             vFiles = wt.getAllModuleFilesPath(src);\r
-            \r
+\r
             //\r
             // First copy all files to new directory\r
             //\r
@@ -710,7 +706,7 @@ public class Clone extends IDialog {
             // Update Cloned From element\r
             //\r
             updateModuleClonedId(msa, oldId);\r
-            \r
+\r
             //\r
             // Save to file\r
             //\r
@@ -719,14 +715,15 @@ public class Clone extends IDialog {
             //\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
@@ -745,14 +742,14 @@ public class Clone extends IDialog {
             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
@@ -780,7 +777,7 @@ public class Clone extends IDialog {
             // Update Cloned From element\r
             //\r
             updatePackageClonedId(spd, oldId);\r
-            \r
+\r
             //\r
             // Save to file\r
             //\r
@@ -837,7 +834,7 @@ public class Clone extends IDialog {
         }\r
         vFiles = null;\r
     }\r
-    \r
+\r
     private String getSelectPackagePath() {\r
         return Tools.getFilePathOnly(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath());\r
     }\r
@@ -849,7 +846,7 @@ public class Clone extends IDialog {
         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
@@ -857,7 +854,7 @@ public class Clone extends IDialog {
         trg = Tools.convertPathToCurrentOsType(trg);\r
         return trg;\r
     }\r
-    \r
+\r
     /**\r
      Set target item's Cloned From element\r
 \r
@@ -906,7 +903,7 @@ public class Clone extends IDialog {
         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
@@ -962,7 +959,7 @@ public class Clone extends IDialog {
         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
@@ -1018,9 +1015,9 @@ public class Clone extends IDialog {
         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