]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
1. Merge ModuleDefinitions to MsaHeader
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / Clone.java
index 68d8c48160ba1638205caf39561d75301aaaa860..68aef5eb35dd06dfca07aa330ed7b5a77b681799 100644 (file)
@@ -38,10 +38,10 @@ import org.tianocore.frameworkwizard.common.DataValidation;
 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
@@ -51,14 +51,21 @@ import org.tianocore.frameworkwizard.workspace.Workspace;
 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
 import javax.swing.JComboBox;\r
 \r
+/**\r
+ The class is used to provide functions to clone workspace, module, package and platform\r
+ It extends IDialog\r
+\r
+ **/\r
 public class Clone extends IDialog {\r
 \r
-    /**\r
-     Define class members\r
-     \r
-     **/\r
+    ///\r
+    /// Define Class Serial Version UID\r
+    ///\r
     private static final long serialVersionUID = -5469299324965727137L;\r
 \r
+    ///\r
+    /// Define Class Members\r
+    ///\r
     private JPanel jContentPane = null;\r
 \r
     private JLabel jLabelType = null;\r
@@ -93,16 +100,20 @@ public class Clone extends IDialog {
 \r
     private JButton jButtonGenerateGuid = null;\r
 \r
+    private JLabel jLabelBelong = null;\r
+\r
+    private JComboBox jComboBoxExistingPackage = null;\r
+\r
+    ///\r
+    /// Define members not for UI\r
+    ///\r
+\r
     private int mode = -1;\r
 \r
     private Vector<PackageIdentification> packages = null;\r
 \r
     private WorkspaceTools wt = new WorkspaceTools();\r
 \r
-    private JLabel jLabelBelong = null;\r
-\r
-    private JComboBox jComboBoxExistingPackage = null;\r
-\r
     private Identification oldId = null;\r
 \r
     private Identification newId = null;\r
@@ -114,10 +125,11 @@ public class Clone extends IDialog {
     private PlatformIdentification fid = null;\r
 \r
     /**\r
-     * This method initializes jTextFieldType  \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
+     This method initializes jTextFieldType    \r
+     \r
+     @return javax.swing.JTextField\r
+     \r
+     **/\r
     private JTextField getJTextFieldType() {\r
         if (jTextFieldType == null) {\r
             jTextFieldType = new JTextField();\r
@@ -128,10 +140,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jTextFieldSource        \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
+     This method initializes jTextFieldSource  \r
+     \r
+     @return javax.swing.JTextField    \r
+     \r
+     **/\r
     private JTextField getJTextFieldSource() {\r
         if (jTextFieldSource == null) {\r
             jTextFieldSource = new JTextField();\r
@@ -142,10 +155,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jButtonBrowse   \r
-     *         \r
-     * @return javax.swing.JButton     \r
-     */\r
+     This method initializes jButtonBrowse     \r
+     \r
+     @return javax.swing.JButton       \r
+     \r
+     **/\r
     private JButton getJButtonBrowse() {\r
         if (jButtonBrowse == null) {\r
             jButtonBrowse = new JButton();\r
@@ -157,10 +171,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jTextFieldDestinationFile       \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
+     This method initializes jTextFieldDestinationFile \r
+     \r
+     @return javax.swing.JTextField    \r
+     \r
+     **/\r
     private JTextField getJTextFieldFilePath() {\r
         if (jTextFieldFilePath == null) {\r
             jTextFieldFilePath = new JTextField();\r
@@ -170,10 +185,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jTextFieldBaseName      \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
+     This method initializes jTextFieldBaseName        \r
+     \r
+     @return javax.swing.JTextField    \r
+     \r
+     **/\r
     private JTextField getJTextFieldBaseName() {\r
         if (jTextFieldBaseName == null) {\r
             jTextFieldBaseName = new JTextField();\r
@@ -183,10 +199,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jTextFieldGuid  \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
+     This method initializes jTextFieldGuid    \r
+     \r
+     @return javax.swing.JTextField    \r
+     \r
+     **/\r
     private JTextField getJTextFieldGuid() {\r
         if (jTextFieldGuid == null) {\r
             jTextFieldGuid = new JTextField();\r
@@ -196,10 +213,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jTextFieldVersion       \r
-     *         \r
-     * @return javax.swing.JTextField  \r
-     */\r
+     This method initializes jTextFieldVersion \r
+     \r
+     @return javax.swing.JTextField    \r
+     \r
+     **/\r
     private JTextField getJTextFieldVersion() {\r
         if (jTextFieldVersion == null) {\r
             jTextFieldVersion = new JTextField();\r
@@ -209,10 +227,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jButtonOk       \r
-     *         \r
-     * @return javax.swing.JButton     \r
-     */\r
+     This method initializes jButtonOk \r
+     \r
+     @return javax.swing.JButton       \r
+     \r
+     **/\r
     private JButton getJButtonOk() {\r
         if (jButtonOk == null) {\r
             jButtonOk = new JButton();\r
@@ -224,10 +243,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jButtonCancel   \r
-     *         \r
-     * @return javax.swing.JButton     \r
-     */\r
+     This method initializes jButtonCancel     \r
+     \r
+     @return javax.swing.JButton       \r
+     \r
+     **/\r
     private JButton getJButtonCancel() {\r
         if (jButtonCancel == null) {\r
             jButtonCancel = new JButton();\r
@@ -239,10 +259,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jButtonGenerateGuid     \r
-     *         \r
-     * @return javax.swing.JButton     \r
-     */\r
+     This method initializes jButtonGenerateGuid       \r
+     \r
+     @return javax.swing.JButton       \r
+     \r
+     **/\r
     private JButton getJButtonGenerateGuid() {\r
         if (jButtonGenerateGuid == null) {\r
             jButtonGenerateGuid = new JButton();\r
@@ -254,10 +275,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jComboBoxExistingPackage        \r
-     *         \r
-     * @return javax.swing.JComboBox   \r
-     */\r
+     This method initializes jComboBoxExistingPackage  \r
+     \r
+     @return javax.swing.JComboBox     \r
+     \r
+     **/\r
     private JComboBox getJComboBoxExistingPackage() {\r
         if (jComboBoxExistingPackage == null) {\r
             jComboBoxExistingPackage = new JComboBox();\r
@@ -267,24 +289,21 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     \r
-     @param args\r
+     This is the default constructor\r
      \r
      **/\r
-    public static void main(String[] args) {\r
-\r
-    }\r
-\r
-    /**\r
-     * This is the default constructor\r
-     */\r
     public Clone() {\r
         super();\r
         init();\r
     }\r
 \r
     /**\r
-     This is the default constructor\r
+     This is the override constructor\r
+     \r
+     @param parentFrame       The parent frame which starts this frame\r
+     @param modal             To identify the frame's modal\r
+     @param fileType          To identify the clone target type\r
+     @param identification    The clone target's identification\r
      \r
      **/\r
     public Clone(IFrame parentFrame, boolean modal, int fileType, Identification identification) {\r
@@ -311,10 +330,9 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes this\r
-     * \r
-     * @return void\r
-     */\r
+     This method initializes this\r
+     \r
+     **/\r
     private void init() {\r
         this.setSize(550, 260);\r
         this.setContentPane(getJContentPane());\r
@@ -323,12 +341,17 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes this\r
-     * \r
-     * @return void\r
-     */\r
+     This method initializes this with given clone target type.\r
+     Customize the frame interface via different clone target type.\r
+     \r
+     @param mode To identify the clone target type\r
+     \r
+     **/\r
     private void init(int mode) {\r
         init();\r
+        //\r
+        // For MODULE_SURFACE_AREA\r
+        //\r
         if (mode == DataType.RETURN_TYPE_MODULE_SURFACE_AREA) {\r
             this.jTextFieldType.setText(DataType.MODULE_SURFACE_AREA);\r
             String s = oldId.getPath();\r
@@ -336,10 +359,14 @@ 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
+        //\r
+        // For PACKAGE_SURFACE_AREA\r
+        //\r
         if (mode == DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA) {\r
             this.jTextFieldType.setText(DataType.PACKAGE_SURFACE_AREA);\r
             String s = oldId.getPath();\r
@@ -352,14 +379,21 @@ public class Clone extends IDialog {
             this.jTextFieldFilePath.setSize(320, this.jTextFieldFilePath.getSize().height);\r
             this.jLabelDestinationFile.setText("New Package Path and Filename");\r
         }\r
+        //\r
+        // For PLATFORM_SURFACE_AREA\r
+        //\r
         if (mode == DataType.RETURN_TYPE_PLATFORM_SURFACE_AREA) {\r
             this.jTextFieldType.setText(DataType.PLATFORM_SURFACE_AREA);\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
+        //\r
+        // For WORKSPACE\r
+        //\r
         if (mode == DataType.RETURN_TYPE_WORKSPACE) {\r
             this.jTextFieldType.setText(DataType.WORKSPACE);\r
             this.jTextFieldSource.setText(Workspace.getCurrentWorkspace());\r
@@ -378,10 +412,11 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     * This method initializes jContentPane\r
-     * \r
-     * @return javax.swing.JPanel\r
-     */\r
+     This method initializes jContentPane\r
+     \r
+     @return javax.swing.JPanel\r
+     \r
+     **/\r
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
             jLabelBelong = new JLabel();\r
@@ -444,18 +479,21 @@ public class Clone extends IDialog {
         if (arg0.getSource() == jButtonOk) {\r
             if (this.check()) {\r
                 try {\r
+                    //\r
+                    // Save to file\r
+                    //\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
@@ -469,7 +507,7 @@ public class Clone extends IDialog {
         }\r
 \r
         //\r
-        // Use different file ext\r
+        // Use different file ext for different clone target type\r
         //\r
         if (arg0.getSource() == this.jButtonBrowse) {\r
             JFileChooser fc = new JFileChooser();\r
@@ -499,19 +537,24 @@ public class Clone extends IDialog {
         }\r
     }\r
 \r
-    //\r
-    // Check name, guid and version\r
-    //\r
+    /**\r
+     Check name, guid and version.\r
+     If all of them are valid, save information to new id\r
+     \r
+     @retval true   All name, guid and version are valid\r
+     @retval false  Any one of name, guid and version is invalid\r
+     \r
+     **/\r
     private boolean checkId() {\r
         //\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
@@ -519,11 +562,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 +574,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
@@ -553,7 +596,8 @@ public class Clone extends IDialog {
     /**\r
      Check before save\r
      \r
-     @return\r
+     @retval true   All check points are passed\r
+     @retval false  Any one of check points is failed\r
      \r
      **/\r
     private boolean check() {\r
@@ -566,19 +610,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 +631,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 +640,14 @@ 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
             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 +658,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 +679,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
@@ -653,22 +693,24 @@ public class Clone extends IDialog {
         return true;\r
     }\r
 \r
+    /**\r
+     Save clone target to new location\r
+     \r
+     @throws IOException\r
+     @throws XmlException\r
+     @throws Exception\r
+     \r
+     **/\r
     private void save() throws IOException, XmlException, Exception {\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
@@ -681,8 +723,8 @@ public class Clone extends IDialog {
             //\r
             trg = getModulePath();\r
             newId.setPath(trg);\r
-            vFiles = wt.getAllModuleFilesPath(src);\r
-            \r
+            vFiles = wt.getAllFilesPathOfModule(src);\r
+\r
             //\r
             // First copy all files to new directory\r
             //\r
@@ -707,10 +749,10 @@ public class Clone extends IDialog {
             msa.getMsaHeader().setVersion(newId.getVersion());\r
 \r
             //\r
-            // Update Cloned From element\r
+            // Update <Cloned> Section\r
             //\r
             updateModuleClonedId(msa, oldId);\r
-            \r
+\r
             //\r
             // Save to file\r
             //\r
@@ -719,14 +761,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
@@ -744,24 +787,17 @@ public class Clone extends IDialog {
             //\r
             trg = this.getPackagePath();\r
             newId.setPath(trg);\r
-            vFiles = wt.getAllPakcageFilesPath(src);\r
-            \r
+            vFiles = wt.getAllFilesPathOfPakcage(src);\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
                 FileOperation.copyFile(oldFile, newFile);\r
             }\r
-            \r
-            //\r
-            // First copy all files to new directory\r
-            //\r
-            //FileOperation.copyFolder(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));\r
-\r
-            //\r
-            // Delete old spd file\r
-            //\r
-            //FileOperation.delFile(Tools.getFilePathOnly(trg) + DataType.FILE_SEPARATOR + Tools.getFileNameOnly(src));\r
 \r
             //\r
             // Create new spd file\r
@@ -777,10 +813,10 @@ public class Clone extends IDialog {
             spd.getSpdHeader().setVersion(newId.getVersion());\r
 \r
             //\r
-            // Update Cloned From element\r
+            // Update <Cloned> Section\r
             //\r
             updatePackageClonedId(spd, oldId);\r
-            \r
+\r
             //\r
             // Save to file\r
             //\r
@@ -837,11 +873,24 @@ public class Clone extends IDialog {
         }\r
         vFiles = null;\r
     }\r
-    \r
+\r
+    /**\r
+     Get the path of selected package\r
+     \r
+     @return String The path of selected package\r
+     \r
+     **/\r
     private String getSelectPackagePath() {\r
         return Tools.getFilePathOnly(packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath());\r
     }\r
 \r
+    /**\r
+     Get the path of source module\r
+     Since the path of source module is relative, make it up to full path.\r
+     \r
+     @return String The full path of source module\r
+     \r
+     **/\r
     private String getModulePath() {\r
         String trg = this.jTextFieldFilePath.getText();\r
         trg = Tools.addPathExt(trg, mode);\r
@@ -849,7 +898,14 @@ public class Clone extends IDialog {
         Tools.convertPathToCurrentOsType(trg);\r
         return trg;\r
     }\r
-    \r
+\r
+    /**\r
+     Get the path of source package\r
+     Since the path of source package is relative, make it up to full path.\r
+     \r
+     @return String The full path of source package\r
+     \r
+     **/\r
     private String getPackagePath() {\r
         String trg = this.jTextFieldFilePath.getText();\r
         trg = Tools.addPathExt(trg, mode);\r
@@ -857,13 +913,13 @@ public class Clone extends IDialog {
         trg = Tools.convertPathToCurrentOsType(trg);\r
         return trg;\r
     }\r
-    \r
-    /**\r
-     Set target item's Cloned From element\r
-\r
-     @param id\r
-     @return\r
 \r
+    /**\r
+     Set msa file's <Cloned> section via given identification\r
+     \r
+     @param msa ModuleSurfaceArea for clone target\r
+     @param id Identification of clone source\r
+     \r
      **/\r
     private void updateModuleClonedId(ModuleSurfaceArea msa, Identification id) {\r
         //\r
@@ -906,7 +962,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
@@ -917,10 +973,10 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     Set target item's Cloned From element\r
+     Set spd file's <Cloned> section via given identification\r
      \r
-     @param id\r
-     @return\r
+     @param spd PackageSurfaceArea for clone target\r
+     @param id Identification of clone source\r
      \r
      **/\r
     private void updatePackageClonedId(PackageSurfaceArea spd, Identification id) {\r
@@ -962,7 +1018,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
@@ -973,10 +1029,10 @@ public class Clone extends IDialog {
     }\r
 \r
     /**\r
-     Set target item's Cloned From element\r
+     Set fpd file's <Cloned> section via given identification\r
      \r
-     @param id\r
-     @return\r
+     @param fpd PlatformSurfaceArea for clone target\r
+     @param id Identification of clone source\r
      \r
      **/\r
     private void updatePlatformClonedId(PlatformSurfaceArea fpd, Identification id) {\r
@@ -1018,9 +1074,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
@@ -1028,26 +1084,62 @@ public class Clone extends IDialog {
         fpd.setPlatformDefinitions(pd);\r
     }\r
 \r
+    /**\r
+     Get PlatformIdentification\r
+     \r
+     @return PlatformIdentification\r
+     \r
+     **/\r
     public PlatformIdentification getFid() {\r
         return fid;\r
     }\r
 \r
+    /**\r
+     Set PlatformIdentification\r
+     \r
+     @param fid PlatformIdentification\r
+     \r
+     **/\r
     public void setFid(PlatformIdentification fid) {\r
         this.fid = fid;\r
     }\r
 \r
+    /**\r
+     Get ModuleIdentification\r
+     \r
+     @return ModuleIdentification\r
+     \r
+     **/\r
     public ModuleIdentification getMid() {\r
         return mid;\r
     }\r
 \r
+    /**\r
+     Set ModuleIdentification\r
+     \r
+     @param mid ModuleIdentification\r
+     \r
+     **/\r
     public void setMid(ModuleIdentification mid) {\r
         this.mid = mid;\r
     }\r
 \r
+    /**\r
+     Get PackageIdentification\r
+     \r
+     @return PackageIdentification\r
+     \r
+     **/\r
     public PackageIdentification getPid() {\r
         return pid;\r
     }\r
 \r
+    /**\r
+     Set PackageIdentification\r
+     \r
+     @param pid PackageIdentification\r
+     \r
+     **/\r
     public void setPid(PackageIdentification pid) {\r
         this.pid = pid;\r
     }\r