]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix tracker "Package Library Class Recommended Instance should not default to null":
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 Jul 2006 07:35:43 +0000 (07:35 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 17 Jul 2006 07:35:43 +0000 (07:35 +0000)
When adding a library class to a Package, the recommended instance name is a drop down with no entries, and the table gets filled in with a recommended instance of "null"

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

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java

index 6bd63d43b484f5c826b4c7c3bf254926f0089a5f..e856cfce4c01f917a8218ed41436ba2863ba9c5e 100644 (file)
@@ -348,6 +348,9 @@ public class SpdFileContents {
               if (lc.isSetRecommendedInstanceGuid()) {\r
                 lc.unsetRecommendedInstanceGuid();\r
               }\r
+              if (lc.isSetRecommendedInstanceVersion()) {\r
+                  lc.unsetRecommendedInstanceVersion();\r
+              }\r
             }\r
 \r
             if (stringToList(hdrAttribArch) != null){\r
@@ -1011,14 +1014,22 @@ public class SpdFileContents {
         lc.setIncludeHeader(clsIncludeFile);\r
         lc.setHelpText(help);\r
 // LAH added logic so you cannot set the version unless the GUID is defined.\r
-/* LAH\r
+\r
         if (clsUsage != null) {\r
           lc.setRecommendedInstanceGuid(clsUsage);\r
           if (instanceVer != null) {\r
             lc.setRecommendedInstanceVersion(instanceVer);\r
           }\r
         }\r
-*/\r
+        else {\r
+          if (lc.isSetRecommendedInstanceGuid()) {\r
+              lc.unsetRecommendedInstanceGuid();\r
+          }\r
+          if (lc.isSetRecommendedInstanceVersion()) {\r
+              lc.unsetRecommendedInstanceVersion();\r
+          }\r
+        }\r
+\r
         if (hdrAttribArch != null) {\r
             lc.setSupArchList(stringToList(hdrAttribArch));\r
         } else {\r
index dade30d282d77959bdcbca787e480bf1477c17bf..51c8ee9a757398352a42e1f803c719f316a282dd 100644 (file)
@@ -217,15 +217,13 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
            model = new DefaultTableModel();\r
            jTable = new JTable(model);\r
            jTable.setRowHeight(20);\r
-//           jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
+           jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
            jTable.setColumnSelectionAllowed(false);\r
            model.addColumn("Class Name");\r
            model.addColumn("Header");\r
            model.addColumn("Help Text");\r
-           model.addColumn("Reserved");\r
-           model.addColumn("Reserved");\r
-//           model.addColumn("Recommended Instance");\r
-//           model.addColumn("Version");\r
+           model.addColumn("Recommended Instance");\r
+           model.addColumn("Version");\r
            model.addColumn("Sup. Arch");\r
            model.addColumn("Mod. Types");\r
            \r
@@ -236,7 +234,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
            vArch.add("EBC");\r
            vArch.add("ARM");\r
            vArch.add("PPC");\r
-//           jTable.getColumnModel().getColumn(cnSupArch).setCellEditor(new ListEditor(vArch));\r
+           jTable.getColumnModel().getColumn(cnSupArch).setCellEditor(new ListEditor(vArch));\r
            \r
            Vector<String> vModule = new Vector<String>();\r
            vModule.add("BASE");\r
@@ -295,20 +293,16 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             if (m.getValueAt(row, cnSupMod) != null) {\r
                 module = m.getValueAt(row, cnSupMod).toString();\r
             }\r
-            String[] rowData = {lib, hdr, hlp};\r
+            String[] rowData = {lib, hdr, hlp, name, ver};\r
             if (!dataValidation(rowData)) {\r
                 return;\r
             }\r
             docConsole.setSaved(false);\r
             \r
-// LAH            getLibInstances(lib);\r
-\r
-            if (name != null) {\r
-              String guid = nameToGuid(name);\r
-            }\r
+            getLibInstances(lib);\r
+            String guid = nameToGuid(name);\r
             \r
-            // LAH WAS sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);\r
-            sfc.updateSpdLibClass(row, lib, hdr, hlp, null, null, arch, module);\r
+            sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module);\r
         }\r
     }\r
 \r
@@ -494,17 +488,17 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             jContentPane.add(starLabel, null);\r
             jContentPane.add(jLabel2HelpText, null);\r
             jContentPane.add(getJTextFieldHelp(), null);\r
-// LAH Removed until we can fix permanently\r
-//            jContentPane.add(jLabel3RecInstName, null);\r
-//            jContentPane.add(getJTextField1RecInstName(), null);\r
-//            jContentPane.add(jLabel4RecInstVer, null);\r
-//            jContentPane.add(getJTextField2RecInstVer(), null);\r
+\r
+            jContentPane.add(jLabel3RecInstName, null);\r
+            jContentPane.add(getJTextField1RecInstName(), null);\r
+            jContentPane.add(jLabel4RecInstVer, null);\r
+            jContentPane.add(getJTextField2RecInstVer(), null);\r
             jContentPane.add(jLabel5SupArchList, null);\r
             jContentPane.add(jLabel6SupModList, null);\r
             \r
             jContentPane.add(getJScrollPaneModules(), null);\r
             jContentPane.add(getJScrollPane1Arch(), null);\r
-// LAH            jContentPane.add(getJComboBox(), null);\r
+            jContentPane.add(getJComboBox(), null);\r
             \r
         }\r
         \r
@@ -569,6 +563,8 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             row[cnClassName] = jTextFieldAdd.getText();\r
             row[cnHdrFile] = jTextFieldHdr.getText().replace('\\', '/');\r
             row[cnHelpText] = jTextFieldHelp.getText();\r
+            row[cnRecInstName] = jComboBox.getSelectedItem()+"";\r
+            row[cnRecInstVer] = jTextField2RecInstVer.getText();\r
             row[cnSupArch] = vectorToString(iCheckBoxList.getAllCheckedItemsString());\r
             if (row[cnSupArch].length() == 0) {\r
                 row[cnSupArch] = null;\r
@@ -587,10 +583,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             //convert to GUID before storing recommended lib instance.\r
             //\r
             getLibInstances(row[cnClassName]);\r
-// LAH            recommendGuid = nameToGuid(row[3]);\r
+            String recommendGuid = nameToGuid(row[cnRecInstName]);\r
 \r
-// LAH WAS             sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]);\r
-            sfc.genSpdLibClassDeclarations(row[cnClassName], null, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, row[cnRecInstVer], null, row[cnSupMod]);\r
+            sfc.genSpdLibClassDeclarations(row[cnClassName], recommendGuid, row[cnHdrFile], row[cnHelpText], row[cnSupArch], null, null, row[cnRecInstVer], null, row[cnSupMod]);\r
             \r
         }\r
         //\r
@@ -603,6 +598,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             int rowSelected = selectedRow;\r
             if (rowSelected >= 0) {\r
                 model.removeRow(rowSelected);\r
+                docConsole.setSaved(false);\r
                 sfc.removeSpdLibClass(rowSelected);\r
             }\r
         }\r
@@ -611,7 +607,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             if (model.getRowCount() == 0) {\r
                 return;\r
             }\r
-            \r
+            docConsole.setSaved(false);\r
             model.setRowCount(0);\r
             sfc.removeSpdLibClass();\r
         }\r
@@ -624,9 +620,17 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
         }\r
         if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {\r
             JOptionPane.showMessageDialog(frame, "Include Header is NOT PathAndFilename Type.");\r
+            return false;\r
         }\r
         if (row[cnHelpText].length() == 0) {\r
             JOptionPane.showMessageDialog(frame, "Help Text Must NOT be empty.");\r
+            return false;\r
+        }\r
+        if (row[cnRecInstVer].length() > 0) {\r
+            if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {\r
+                JOptionPane.showMessageDialog(frame, "Recommended Instance Version is NOT VersionDataType.");\r
+                return false;\r
+            }\r
         }\r
         return true;\r
     }\r
@@ -892,7 +896,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     }\r
 \r
     private String nameToGuid(String name) {\r
-        String s = "";\r
+        String s = null;\r
         if (!libNameGuidMap.containsKey(name)) {\r
             return s;\r
         }\r