]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
Refresh library instance selection UI for platform editor after library instance...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdModuleSA.java
index f58c09570d4a724b9d4f08ad61eb64f9c879934f..e46a9bbeaff6377fcdf5b3d93b18ee8b7f6f2ef5 100644 (file)
@@ -196,18 +196,24 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     }\r
     \r
     public void initLibraries(String key) {\r
+        libClassTableModel.setRowCount(0);\r
+        libInstanceTableModel.setRowCount(0);\r
+        selectedInstancesTableModel.setRowCount(0);\r
+        Vector<String> errorMsg = new Vector<String>();\r
         try {\r
             //\r
             // display library classes that need to be resolved. also potential instances for them.\r
             //\r
-            resolveLibraryInstances(moduleKey);\r
+            resolveLibraryInstances(moduleKey, errorMsg);\r
         } catch (Exception e) {\r
-            JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage());\r
+            String exceptionMsg = e.getCause() + " " + e.getMessage();\r
+            errorMsg.add(exceptionMsg);\r
+            JOptionPane.showMessageDialog(frame, exceptionMsg);\r
         }\r
         //\r
         // display lib instances already selected for key\r
         //\r
-        selectedInstancesTableModel.setRowCount(0);\r
+        \r
         int instanceCount = ffc.getLibraryInstancesCount(key);\r
         if (instanceCount != 0) {\r
             String[][] saa = new String[instanceCount][5];\r
@@ -226,15 +232,25 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                     // re-evaluate lib instance usage when adding a already-selected lib instance.\r
                     //\r
                     try {\r
-                        resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
+                        resolveLibraryInstances(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4], errorMsg);\r
                     } catch (Exception e) {\r
-                        JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage());\r
+                        String exceptionMsg = e.getCause() + " " + e.getMessage();\r
+                        if (!errorMsg.contains(exceptionMsg)) {\r
+                            JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage());\r
+                        }\r
                     }\r
                     selectedInstancesTableModel.addRow(saa[i]);\r
                 }\r
             }\r
         }\r
 \r
+        if (errorMsg.size() > 0) {\r
+            String errors = "";\r
+            for (int i = 0; i < errorMsg.size(); ++i) {\r
+                errors += " " + errorMsg.get(i) + "\n";\r
+            }\r
+            JOptionPane.showMessageDialog(frame, errors);\r
+        }\r
         showClassToResolved();\r
     }\r
     \r
@@ -326,7 +342,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         }\r
     }\r
     \r
-    private void resolveLibraryInstances(String key) throws MultipleInstanceException, NoInstanceException{\r
+    private void resolveLibraryInstances(String key, Vector<String> errorMsg) throws MultipleInstanceException, NoInstanceException{\r
         ModuleIdentification mi = WorkspaceProfile.getModuleId(key);\r
         PackageIdentification[] depPkgList = null;\r
         \r
@@ -401,7 +417,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
             }\r
             ArrayList<String> instances = getInstancesForClass(cls, depPkgList);\r
             if (instances.size() == 0) {\r
-                throw new NoInstanceException (cls.className);\r
+//                throw new NoInstanceException (cls.className);\r
+                String exceptionMsg = new NoInstanceException (cls.className).getMessage();\r
+                if (!errorMsg.contains(exceptionMsg)) {\r
+                    errorMsg.add(exceptionMsg);    \r
+                }\r
+                \r
             }\r
             classInstanceMap.put(cls, instances);\r
 \r
@@ -541,6 +562,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     \r
     private void showClassToResolved(){\r
         libClassTableModel.setRowCount(0);\r
+        libInstanceTableModel.setRowCount(0);\r
         if (classConsumed == null || classConsumed.size() == 0) {\r
             return;\r
         }\r
@@ -556,7 +578,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                 libClassTableModel.addRow(s);\r
             }\r
         }\r
-        libInstanceTableModel.setRowCount(0);\r
+        \r
     }\r
     \r
     private void addLibInstance (ModuleIdentification libMi) throws Exception{\r
@@ -1175,12 +1197,22 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                                   libInstanceTableModel.getValueAt(row, 2), libInstanceTableModel.getValueAt(row, 3),\r
                                   libInstanceTableModel.getValueAt(row, 4)};\r
                     selectedInstancesTableModel.addRow(s);\r
+                    \r
+                    Vector<String> errorMsg = new Vector<String>();\r
                     try {\r
-                        resolveLibraryInstances(instanceValue);\r
+                        resolveLibraryInstances(instanceValue, errorMsg);\r
                     }\r
                     catch (Exception exp) {\r
                         JOptionPane.showMessageDialog(frame, exp.getMessage());\r
                     }\r
+                    \r
+                    if (errorMsg.size() > 0) {\r
+                        String errors = "";\r
+                        for (int i = 0; i < errorMsg.size(); ++i) {\r
+                            errors += " " + errorMsg.get(i) + "\n";\r
+                        }\r
+                        JOptionPane.showMessageDialog(frame, errors);\r
+                    }\r
                     showClassToResolved();\r
                 }\r
             });\r
@@ -1786,8 +1818,21 @@ private JButton getJButtonUpdatePcd() {
                 String cName = model.getValueAt(row, 0)+"";\r
                 String tsGuid = model.getValueAt(row, 1)+"";\r
                 String oldItemType = model.getValueAt(row, 2)+"";\r
+                String dataType = model.getValueAt(row, 5)+"";\r
                 String newItemType = jComboBoxItemType.getSelectedItem()+"";\r
                 String newValue = jTextFieldPcdDefault.isVisible()? jTextFieldPcdDefault.getText():jComboBoxFeatureFlagValue.getSelectedItem()+""; \r
+                if (newValue.length() == 0){\r
+                \r
+                    if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {\r
+                        newValue = "0";\r
+                    }\r
+                    if (dataType.equals("BOOLEAN")){\r
+                        newValue = "FALSE";\r
+                    }\r
+                    if (dataType.equals("VOID*")) {\r
+                        newValue = "L\"\"";\r
+                    }\r
+                }\r
                 \r
                 String[] pcdInfo = {"", "", ""};\r
                 Vector<String> validPcdTypes = new Vector<String>();\r