Fix the bug of leaving empty GuidTypeList, SupArchList attributes in xml file.
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 18 Jul 2006 09:53:52 +0000 (09:53 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 18 Jul 2006 09:53:52 +0000 (09:53 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1038 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/SpdGuidDecls.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java

index e856cfc..a71421a 100644 (file)
@@ -1216,18 +1216,31 @@ public class SpdFileContents {
             e.setCName(cName);\r
             e.setGuidValue(guid);\r
             e.setHelpText(help);\r
-            e.setGuidTypeList(guidTypeList);\r
-            e.setSupArchList(archList);\r
-            e.setSupModuleList(modTypeList);\r
-//            if (guidTypeList != null && guidTypeList.size() > 0) {\r
-//                e.setGuidTypeList(new ArrayList<String>(guidTypeList));\r
-//            }\r
-//            if (archList != null && archList.size() > 0){\r
-//                e.setSupArchList(new ArrayList<String>(archList));\r
-//            }\r
-//            if (modTypeList != null && modTypeList.size() > 0) {\r
-//                e.setSupModuleList(new ArrayList<String>(modTypeList));\r
-//            }\r
+            if (guidTypeList != null) {\r
+                e.setGuidTypeList(guidTypeList);\r
+            }\r
+            else{\r
+                if (e.isSetGuidTypeList()) {\r
+                    e.unsetGuidTypeList();\r
+                }\r
+            }\r
+            if (archList != null) {\r
+                e.setSupArchList(archList);\r
+            }\r
+            else {\r
+                if (e.isSetSupArchList()) {\r
+                    e.unsetSupArchList();\r
+                }\r
+            }\r
+            if (modTypeList != null){\r
+                e.setSupModuleList(modTypeList);\r
+            }\r
+            else {\r
+                if (e.isSetSupModuleList()) {\r
+                    e.unsetSupModuleList();\r
+                }\r
+            }\r
+\r
             return;\r
         }\r
         if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) {\r
@@ -1237,14 +1250,23 @@ public class SpdFileContents {
             pe.setCName(cName);\r
             pe.setGuidValue(guid);\r
             pe.setHelpText(help);\r
-            pe.setSupArchList(archList);\r
-            pe.setSupModuleList(modTypeList);\r
-//            if (archList != null && archList.size() > 0){\r
-//                pe.setSupArchList(new ArrayList<String>(archList));\r
-//            }\r
-//            if (modTypeList != null && modTypeList.size() > 0) {\r
-//                pe.setSupModuleList(new ArrayList<String>(modTypeList));\r
-//            }\r
+            if (archList != null) {\r
+                pe.setSupArchList(archList);\r
+            }\r
+            else {\r
+                if (pe.isSetSupArchList()) {\r
+                    pe.unsetSupArchList();\r
+                }\r
+            }\r
+            if (modTypeList != null){\r
+                pe.setSupModuleList(modTypeList);\r
+            }\r
+            else {\r
+                if (pe.isSetSupModuleList()) {\r
+                    pe.unsetSupModuleList();\r
+                }\r
+            }\r
+\r
             return;\r
         }\r
         if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) {\r
@@ -1254,14 +1276,23 @@ public class SpdFileContents {
             ppe.setCName(cName);\r
             ppe.setGuidValue(guid);\r
             ppe.setHelpText(help);\r
-            ppe.setSupArchList(archList);\r
-            ppe.setSupModuleList(modTypeList);\r
-//            if (archList != null && archList.size() > 0){\r
-//                ppe.setSupArchList(new ArrayList<String>(archList));\r
-//            }\r
-//            if (archList != null && modTypeList.size() > 0) {\r
-//                ppe.setSupModuleList(new ArrayList<String>(modTypeList));\r
-//            }\r
+            if (archList != null) {\r
+                ppe.setSupArchList(archList);\r
+            }\r
+            else {\r
+                if (ppe.isSetSupArchList()) {\r
+                    ppe.unsetSupArchList();\r
+                }\r
+            }\r
+            if (modTypeList != null){\r
+                ppe.setSupModuleList(modTypeList);\r
+            }\r
+            else {\r
+                if (ppe.isSetSupModuleList()) {\r
+                    ppe.unsetSupModuleList();\r
+                }\r
+            }\r
+\r
             return;\r
         }\r
 \r
index 91f4ba6..6459c2c 100644 (file)
@@ -252,9 +252,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
        int row = arg0.getFirstRow();\r
        TableModel m = (TableModel)arg0.getSource();\r
        if (arg0.getType() == TableModelEvent.UPDATE){\r
-           if (docConsole != null) {\r
-               docConsole.setSaved(false);\r
-           }\r
+           \r
            updateRow(row, m);\r
        }\r
    }\r
@@ -280,7 +278,9 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
        if (!dataValidation(rowData)){\r
            return;\r
        }\r
-       \r
+       if (docConsole != null) {\r
+           docConsole.setSaved(false);\r
+       }\r
        sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList);\r
    }\r
     /**\r
@@ -549,9 +549,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
             if (!dataValidation(row)) {\r
                 return;\r
             }\r
-            if (docConsole != null) {\r
-                docConsole.setSaved(false);\r
-            }\r
+            \r
             model.addRow(row);\r
             jTable.changeSelection(model.getRowCount()-1, 0, false, false);\r
             addRow(row);\r
@@ -610,17 +608,35 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{
     \r
     protected void addRow(String[] row) {\r
         Vector<String> vArch = iCheckBoxList.getAllCheckedItemsString();\r
+        if (vArch.size() == 0) {\r
+            vArch = null;\r
+        }\r
         Vector<String> vModType = iCheckBoxList2.getAllCheckedItemsString();\r
+        if (vModType.size() == 0) {\r
+            vModType = null;\r
+        }\r
         Vector<String> vguidType = iCheckBoxList1.getAllCheckedItemsString();\r
+        if (vguidType.size() == 0) {\r
+            vguidType = null;\r
+        }\r
+        if (docConsole != null) {\r
+            docConsole.setSaved(false);\r
+        }\r
         sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType);\r
     }\r
     \r
     protected void removeRow(int i){\r
         sfc.removeSpdGuidDeclaration(i);\r
+        if (docConsole != null) {\r
+            docConsole.setSaved(false);\r
+        }\r
     }\r
     \r
     protected void clearAllRow(){\r
         sfc.removeSpdGuidDeclaration();\r
+        if (docConsole != null) {\r
+            docConsole.setSaved(false);\r
+        }\r
     }\r
 \r
     /**\r
index 23adb11..f03b5cb 100644 (file)
@@ -108,9 +108,11 @@ public class SpdPpiDecls extends SpdGuidDecls {
     \r
     protected void removeRow(int i){\r
         sfc.removeSpdPpiDeclaration(i);\r
+        docConsole.setSaved(false);\r
     }\r
     \r
     protected void clearAllRow(){\r
         sfc.removeSpdPpiDeclaration();\r
+        docConsole.setSaved(false);\r
     }\r
 }\r
index 51994cf..d58fcef 100644 (file)
@@ -102,14 +102,17 @@ public class SpdProtocolDecls extends SpdGuidDecls {
         if (!dataValidation(row)){\r
             return;\r
         }\r
+        docConsole.setSaved(false);\r
         sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5]));\r
     }\r
     \r
     protected void removeRow(int i){\r
         sfc.removeSpdProtocolDeclaration(i);\r
+        docConsole.setSaved(false);\r
     }\r
     \r
     protected void clearAllRow(){\r
         sfc.removeSpdProtocolDeclaration();\r
+        docConsole.setSaved(false);\r
     }\r
 }\r