]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
1. Fix the problem of adding PCD for different Arch.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdModuleSA.java
index 0da5a935c93a47e52c09d3b8df98b550457b8751..36b22be6a4784f7e2945847ab2986a047ffb7039 100644 (file)
@@ -175,7 +175,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
             String[][] saa = new String[instanceCount][5];\r
             ffc.getLibraryInstances(key, saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
-                ModuleIdentification mi = getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
+                ModuleIdentification mi = GlobalData.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
                 if (mi != null) {\r
                     saa[i][0] = mi.getName();\r
                     saa[i][2] = mi.getVersion();\r
@@ -218,7 +218,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     }\r
     \r
     private void resolveLibraryInstances(String key) {\r
-        ModuleIdentification mi = getModuleId(key);\r
+        ModuleIdentification mi = GlobalData.getModuleId(key);\r
         PackageIdentification[] depPkgList = null;\r
         try{\r
             Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
@@ -326,7 +326,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     }\r
     \r
     private void removeInstance(String key) {\r
-        ModuleIdentification mi = getModuleId(key); \r
+        ModuleIdentification mi = GlobalData.getModuleId(key); \r
         //\r
         // remove pcd information of instance from current ModuleSA\r
         //\r
@@ -361,42 +361,6 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         \r
     }\r
     \r
-    private ModuleIdentification getModuleId(String key){\r
-        //\r
-        // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.\r
-        //\r
-        String[] keyPart = key.split(" ");\r
-        Set<PackageIdentification> spi = GlobalData.getPackageList();\r
-        Iterator ispi = spi.iterator();\r
-        \r
-        while(ispi.hasNext()) {\r
-            PackageIdentification pi = (PackageIdentification)ispi.next();\r
-            if ( !pi.getGuid().equals(keyPart[2])){ \r
-\r
-                continue;\r
-            }\r
-            if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){\r
-                if(!pi.getVersion().equals(keyPart[3])){\r
-                    continue;\r
-                }\r
-            }\r
-            Set<ModuleIdentification> smi = GlobalData.getModules(pi);\r
-            Iterator ismi = smi.iterator();\r
-            while(ismi.hasNext()) {\r
-                ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
-                if (mi.getGuid().equals(keyPart[0])){\r
-                    if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){\r
-                        if(!mi.getVersion().equals(keyPart[1])){\r
-                            continue;\r
-                        }\r
-                    }\r
-\r
-                    return mi;\r
-                }\r
-            }\r
-        }\r
-        return null;\r
-    }\r
     \r
     private String[] getClassProduced(ModuleIdentification mi){\r
         \r
@@ -668,11 +632,11 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         ffc.getLibraryInstances(moduleKey, saa);\r
         \r
         try{\r
-            if (ffc.getPcdBuildDataInfo(getModuleId(moduleKey), cName, sa)) {\r
+            if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(moduleKey), cName, sa)) {\r
                 return;\r
             }\r
             for (int j = 0; j < saa.length; ++j) {\r
-                if (ffc.getPcdBuildDataInfo(getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),\r
+                if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),\r
                                             cName, sa)) {\r
                     return;\r
                 }\r
@@ -880,8 +844,8 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                         while(li.hasNext()) {\r
                             String instance = li.next();\r
                             String[] s = {"", "", "", "", ""};\r
-                            if (getModuleId(instance) != null) {\r
-                                s[0] = getModuleId(instance).getName();\r
+                            if (GlobalData.getModuleId(instance) != null) {\r
+                                s[0] = GlobalData.getModuleId(instance).getName();\r
                             }\r
                             \r
                             String[] instancePart = instance.split(" ");\r
@@ -1020,7 +984,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                     libInstanceTableModel.getValueAt(row, 2) + " " +\r
                     libInstanceTableModel.getValueAt(row, 3) + " " +\r
                     libInstanceTableModel.getValueAt(row, 4);\r
-                    ModuleIdentification libMi = getModuleId(instanceValue);\r
+                    ModuleIdentification libMi = GlobalData.getModuleId(instanceValue);\r
                     ffc.genLibraryInstance(libMi, moduleKey);\r
                     //\r
                     // Add pcd information of selected instance to current moduleSA\r
@@ -1029,7 +993,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                         ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));\r
                     }\r
                     catch (Exception exception) {\r
-                        JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage());\r
+                        JOptionPane.showMessageDialog(frame, "Adding Instance" + s[0] + ": "+ exception.getMessage());\r
                     }\r
                     resolveLibraryInstances(instanceValue);\r
                 }\r