]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Fix EDKT408: Clone a library class does not copy the library head
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Oct 2006 08:17:20 +0000 (08:17 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 16 Oct 2006 08:17:20 +0000 (08:17 +0000)
2. Fix EDKT398: Wizard does not refresh work environment when clone a module or a library

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1757 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java

index 3395434efda5ceef6da95a1f79772f14b5633990..6c9e25a31a61f6ef7f9b2871b0434507baf21330 100644 (file)
@@ -376,7 +376,8 @@ public class Clone extends IDialog {
             this.jLabelBelong.setEnabled(false);\r
             this.jComboBoxExistingPackage.setEnabled(false);\r
             this.jButtonBrowse.setVisible(false);\r
-            this.jTextFieldFilePath.setToolTipText("<html>Input the package's relative path and file name, for example:<br>MdePkg\\MdePkg.spd</html>");\r
+            this.jTextFieldFilePath\r
+                                   .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
@@ -407,7 +408,8 @@ public class Clone extends IDialog {
             this.jButtonGenerateGuid.setEnabled(false);\r
             this.jLabelVersion.setEnabled(false);\r
             this.jTextFieldVersion.setEnabled(false);\r
-            this.jTextFieldFilePath.setToolTipText("<html>Input the workspace path, for example:<br>C:\\MyWorkspace</html>");\r
+            this.jTextFieldFilePath\r
+                                   .setToolTipText("<html>Input the workspace path, for example:<br>C:\\MyWorkspace</html>");\r
             this.jLabelDestinationFile.setText("New Workspace Path");\r
         }\r
     }\r
@@ -555,7 +557,9 @@ public class Clone extends IDialog {
             return false;\r
         }\r
         if (!DataValidation.isBaseName(this.jTextFieldBaseName.getText())) {\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
+            Log\r
+               .wrn("Clone",\r
+                    "<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
@@ -567,7 +571,10 @@ public class Clone extends IDialog {
             return false;\r
         }\r
         if (!DataValidation.isGuid(this.jTextFieldGuid.getText())) {\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
+            Log\r
+               .wrn(\r
+                    "Clone",\r
+                    "<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
@@ -579,7 +586,10 @@ public class Clone extends IDialog {
             return false;\r
         }\r
         if (!DataValidation.isVersion(this.jTextFieldVersion.getText())) {\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
+            Log\r
+               .wrn(\r
+                    "Clone",\r
+                    "<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
@@ -726,13 +736,29 @@ public class Clone extends IDialog {
             newId.setPath(trg);\r
             vFiles = wt.getAllFilesPathOfModule(src);\r
 \r
+            String oldPackagePath = GlobalData.openingModuleList.getIdByPath(src).getPackageId().getPath();\r
+            String newPackagePath = packages.elementAt(this.jComboBoxExistingPackage.getSelectedIndex()).getPath();\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
+                String newFile = "";\r
+                if (oldFile.indexOf(Tools.getFilePathOnly(src)) > -1) {\r
+                    //\r
+                    // The file is not include header\r
+                    //\r
+                    newFile = oldFile.replace(Tools.getFilePathOnly(src), Tools.getFilePathOnly(trg));\r
+                } else if (oldFile.indexOf(Tools.getFilePathOnly(oldPackagePath)) > -1) {\r
+                    //\r
+                    // The file is include header\r
+                    //\r
+                    newFile = oldFile.replace(Tools.getFilePathOnly(oldPackagePath),\r
+                                              Tools.getFilePathOnly(newPackagePath));\r
+                }\r
+\r
                 FileOperation.copyFile(oldFile, newFile);\r
             }\r
 \r
@@ -753,7 +779,7 @@ public class Clone extends IDialog {
             // Update <Cloned> Section\r
             //\r
             updateModuleClonedId(msa, oldId);\r
-            \r
+\r
             //\r
             // Save to file\r
             //\r
@@ -775,7 +801,7 @@ public class Clone extends IDialog {
             // Update the db file\r
             //\r
             wt.addModuleToPackage(mid, psa);\r
-            \r
+\r
             //\r
             // Update GlobalData\r
             //\r
@@ -838,20 +864,20 @@ public class Clone extends IDialog {
             // 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
             //\r
             // Add all cloned modules\r
             //\r
             Vector<String> modulePaths = GlobalData.getAllModulesOfPackage(pid.getPath());\r
             String modulePath = null;\r
             ModuleSurfaceArea msa = null;\r
-            \r
+\r
             for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
                 try {\r
                     modulePath = modulePaths.get(indexJ);\r
@@ -871,7 +897,7 @@ public class Clone extends IDialog {
                 GlobalData.vModuleList.addElement(mid);\r
                 GlobalData.openingModuleList.insertToOpeningModuleList(mid, msa);\r
             }\r
-            \r
+\r
             this.returnType = DataType.RETURN_TYPE_PACKAGE_SURFACE_AREA;\r
         }\r
 \r
@@ -908,7 +934,7 @@ public class Clone extends IDialog {
             // Update the db file\r
             //\r
             wt.addPlatformToDatabase(fid);\r
-            \r
+\r
             //\r
             // Update GlobalData\r
             //\r
index 4e40d59efc16f54fd5d0db2018ae14ba5be93434..dedbdddf20b48c45d4355a0c14eaa102630ea3a3 100644 (file)
@@ -23,6 +23,8 @@ import org.apache.xmlbeans.XmlCursor;
 import org.apache.xmlbeans.XmlException;\r
 import org.tianocore.DbPathAndFilename;\r
 import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;\r
+import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations;\r
+import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.MsaFilesDocument.MsaFiles;\r
 import org.tianocore.PackageDependenciesDocument.PackageDependencies;\r
@@ -676,6 +678,10 @@ public class WorkspaceTools {
         msaFile.setFilenameArray(msaFile.getFilenameList().size() - 1, fn);\r
         spd.setMsaFiles(msaFile);\r
         SaveFile.saveSpdFile(mid.getPackageId().getPath(), spd);\r
+        //\r
+        // Update GlobalData\r
+        //\r
+        GlobalData.openingPackageList.getPackageSurfaceAreaFromId(mid.getPackageId()).setMsaFiles(msaFile);\r
     }\r
 \r
     /**\r
@@ -733,10 +739,18 @@ public class WorkspaceTools {
     public Vector<String> getAllFilesPathOfModule(String path) {\r
         Vector<String> v = new Vector<String>();\r
         path = Tools.convertPathToCurrentOsType(path);\r
+\r
+        //\r
+        // First add msa file's path\r
+        //\r
         v.addElement(path);\r
+\r
         ModuleSurfaceArea msa = GlobalData.openingModuleList\r
                                                             .getModuleSurfaceAreaFromId(GlobalData.openingModuleList\r
                                                                                                                     .getIdByPath(path));\r
+        //\r
+        // Get common defined files of module\r
+        //\r
         if (msa != null) {\r
             //\r
             // Get all files' path of a module\r
@@ -751,6 +765,44 @@ public class WorkspaceTools {
             }\r
         }\r
 \r
+        //\r
+        // Get include header files for this module\r
+        //\r
+        if (msa.getLibraryClassDefinitions() != null) {\r
+            LibraryClassDefinitions lcd = msa.getLibraryClassDefinitions();\r
+            for (int index = 0; index < lcd.sizeOfLibraryClassArray(); index++) {\r
+                if (lcd.getLibraryClassList().get(index).getUsage().toString()\r
+                       .equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
+                    || lcd.getLibraryClassList().get(index).getUsage().toString()\r
+                          .equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
+                    //\r
+                    // Get library class name\r
+                    //\r
+                    String name = lcd.getLibraryClassList().get(index).getKeyword();\r
+\r
+                    //\r
+                    // Find file path for this class\r
+                    //\r
+                    PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();\r
+                    PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);\r
+                    if (spd != null) {\r
+                        if (spd.getLibraryClassDeclarations() != null) {\r
+                            LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();\r
+                            for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {\r
+                                if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {\r
+                                    v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())\r
+                                                                                  + DataType.FILE_SEPARATOR\r
+                                                                                  + lcdl.getLibraryClassList()\r
+                                                                                        .get(indexOfLibOfSpd)\r
+                                                                                        .getIncludeHeader()));\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
         return v;\r
     }\r
 \r