]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Fix the problem of adding PCD for different Arch.
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 1 Aug 2006 05:59:51 +0000 (05:59 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 1 Aug 2006 05:59:51 +0000 (05:59 +0000)
2. enhanced exception messages.
3. pick out getModuleId method to GlobalData class.

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

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/GlobalData.java

index bcc19389280d27e8def8a42cfa76fae4bcac4664..63b9d6713d45194295fb9fcf6e344c58d779f2a1 100644 (file)
@@ -776,7 +776,7 @@ public class FpdFileContents {
                     //\r
                     // ToDo Error \r
                     //\r
-                    throw new PcdDeclNotFound(mi.getName() + " " + msaPcd.getCName());\r
+                    throw new PcdDeclNotFound("No Declaration for PCD Entry " + msaPcd.getCName() + " in Module " + mi.getName());\r
                 }\r
                 //\r
                 // AddItem to ModuleSA PcdBuildDefinitions\r
@@ -788,7 +788,7 @@ public class FpdFileContents {
             \r
         }\r
         catch (Exception e){\r
-            e.printStackTrace();\r
+            \r
             throw e; \r
         }\r
         \r
@@ -879,10 +879,10 @@ public class FpdFileContents {
             while(li.hasNext()) {\r
                 String value = li.next().toString();\r
                 String[] valuePart= value.split(" ");\r
-                if (!valuePart[4].equals("DYNAMIC")) {\r
+                if (!valuePart[5].equals("DYNAMIC")) {\r
                     //ToDo error for same pcd, other type than dynamic\r
                     pcdConsumer.remove(listValue);\r
-                    throw new PcdItemTypeConflictException(value);\r
+                    throw new PcdItemTypeConflictException(cName, value);\r
                 }\r
             }\r
         }\r
@@ -891,10 +891,10 @@ public class FpdFileContents {
             while(li.hasNext()) {\r
                 String value = li.next().toString();\r
                 String[] valuePart= value.split(" ");\r
-                if (valuePart[4].equals("DYNAMIC")) {\r
+                if (valuePart[5].equals("DYNAMIC")) {\r
                     //ToDo error for same pcd, other type than non-dynamic\r
                     pcdConsumer.remove(listValue);\r
-                    throw new PcdItemTypeConflictException(value);\r
+                    throw new PcdItemTypeConflictException(cName, value);\r
                 }\r
             }\r
         }\r
@@ -1030,7 +1030,7 @@ public class FpdFileContents {
     \r
     private ArrayList<String> LookupPlatformPcdData(String pcdKey) {\r
         \r
-        return dynPcdMap.get("pcdKey");\r
+        return dynPcdMap.get(pcdKey);\r
     }\r
     \r
     public int getDynamicPcdBuildDataCount() {\r
@@ -2464,8 +2464,9 @@ class PcdItemTypeConflictException extends Exception {
     private static final long serialVersionUID = 1L;\r
     private String details = null;\r
     \r
-    PcdItemTypeConflictException(String info){\r
-        details = "ItemTypeConflict: " + info;\r
+    PcdItemTypeConflictException(String pcdName, String info){\r
+        ModuleIdentification mi = GlobalData.getModuleId(info);\r
+        details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();\r
     }\r
     \r
     public String getMessage() {\r
index 25a39c0a62fe73c4c5cbd3bb3bccdbf8ccb487e2..954d992e1d648c21efd159d939c122cbeaeb481c 100644 (file)
@@ -218,6 +218,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                         return;\r
                     }\r
                     //ToDo put Arch instead of null\r
+                    boolean errorOccurred = false;\r
                     for (int i = 0; i < vArchs.size(); ++i) {\r
                         String arch = vArchs.get(i);\r
                         al.add(arch);\r
@@ -237,12 +238,19 @@ public class FpdFrameworkModules extends IInternalFrame {
                            ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null);\r
                        }\r
                        catch (Exception exception) {\r
-                           JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage());\r
+                           JOptionPane.showMessageDialog(frame, "Adding " + row[0] + " with SupArch " + arch + ": "+ exception.getMessage());\r
+                           errorOccurred = true;\r
                        }\r
                     }\r
                     \r
-                    \r
-                    JOptionPane.showMessageDialog(frame, "This Module with Arch "+ archsAdded +" Added Successfully.");\r
+                    String s = "This Module with Arch "+ archsAdded;\r
+                    if (errorOccurred) {\r
+                        s += " Added with Error. Platform may NOT Be Built."; \r
+                    }\r
+                    else {\r
+                        s += " Added Successfully.";\r
+                    }\r
+                    JOptionPane.showMessageDialog(frame,  s);\r
                     jTableFpdModules.changeSelection(modelFpdModules.getRowCount()-1, 0, false, false);\r
                 }\r
             });\r
@@ -361,7 +369,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     String pg = sa[2];\r
                     String pv = sa[3];\r
                     String arch = sa[4];\r
-                    ModuleIdentification mi = getModuleId(sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3] + " " + sa[4]);\r
+                    ModuleIdentification mi = GlobalData.getModuleId(sa[0] + " " + sa[1] + " " + sa[2] + " " + sa[3] + " " + sa[4]);\r
                     mv = mi.getVersion();\r
                     pv = mi.getPackage().getVersion();\r
                     modelFpdModules.removeRow(selectedRow);\r
@@ -434,7 +442,7 @@ public class FpdFrameworkModules extends IInternalFrame {
             String[][] saa = new String[ffc.getFrameworkModulesCount()][5];\r
             ffc.getFrameworkModulesInfo(saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
-                ModuleIdentification mi = getModuleId(saa[i][0]+ " "+saa[i][1]+" "+saa[i][2]+" "+saa[i][3]);\r
+                ModuleIdentification mi = GlobalData.getModuleId(saa[i][0]+ " "+saa[i][1]+" "+saa[i][2]+" "+saa[i][3]);\r
                 String[] row = {"", "", "", "", "", ""};\r
                 if (mi != null) {\r
                     row[0] = mi.getName();\r
@@ -507,43 +515,6 @@ public class FpdFrameworkModules extends IInternalFrame {
         this.setVisible(true);\r
         \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().equalsIgnoreCase(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().equalsIgnoreCase(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
 }  //  @jve:decl-index=0:visual-constraint="10,10"\r
 \r
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
index 4a325c21ffbf6111fd234e789ce88be91c4a8aa8..afa4c31e0b9fa95355bf2cebd00430f640ffab0b 100644 (file)
@@ -428,6 +428,42 @@ public class GlobalData {
         return result;\r
     }\r
 \r
+    public static 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().equalsIgnoreCase(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().equalsIgnoreCase(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
     public static Vector<String> getModuleSupArchs(ModuleIdentification mi) throws Exception{\r
         Vector<String> vArchs = null;\r