From 2c85fbc88abf847c8b13f4b55fdad62d3b0697bc Mon Sep 17 00:00:00 2001 From: jlin16 Date: Tue, 18 Jul 2006 09:53:52 +0000 Subject: [PATCH] Fix the bug of leaving empty GuidTypeList, SupArchList attributes in xml file. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1038 6f19259b-4bc3-4df7-8a09-765794883524 --- .../packaging/ui/SpdFileContents.java | 87 +++++++++++++------ .../packaging/ui/SpdGuidDecls.java | 30 +++++-- .../packaging/ui/SpdPpiDecls.java | 2 + .../packaging/ui/SpdProtocolDecls.java | 3 + 4 files changed, 87 insertions(+), 35 deletions(-) diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java index e856cfce4c..a71421a82e 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java @@ -1216,18 +1216,31 @@ public class SpdFileContents { e.setCName(cName); e.setGuidValue(guid); e.setHelpText(help); - e.setGuidTypeList(guidTypeList); - e.setSupArchList(archList); - e.setSupModuleList(modTypeList); -// if (guidTypeList != null && guidTypeList.size() > 0) { -// e.setGuidTypeList(new ArrayList(guidTypeList)); -// } -// if (archList != null && archList.size() > 0){ -// e.setSupArchList(new ArrayList(archList)); -// } -// if (modTypeList != null && modTypeList.size() > 0) { -// e.setSupModuleList(new ArrayList(modTypeList)); -// } + if (guidTypeList != null) { + e.setGuidTypeList(guidTypeList); + } + else{ + if (e.isSetGuidTypeList()) { + e.unsetGuidTypeList(); + } + } + if (archList != null) { + e.setSupArchList(archList); + } + else { + if (e.isSetSupArchList()) { + e.unsetSupArchList(); + } + } + if (modTypeList != null){ + e.setSupModuleList(modTypeList); + } + else { + if (e.isSetSupModuleList()) { + e.unsetSupModuleList(); + } + } + return; } if (parent instanceof ProtocolDeclarationsDocument.ProtocolDeclarations) { @@ -1237,14 +1250,23 @@ public class SpdFileContents { pe.setCName(cName); pe.setGuidValue(guid); pe.setHelpText(help); - pe.setSupArchList(archList); - pe.setSupModuleList(modTypeList); -// if (archList != null && archList.size() > 0){ -// pe.setSupArchList(new ArrayList(archList)); -// } -// if (modTypeList != null && modTypeList.size() > 0) { -// pe.setSupModuleList(new ArrayList(modTypeList)); -// } + if (archList != null) { + pe.setSupArchList(archList); + } + else { + if (pe.isSetSupArchList()) { + pe.unsetSupArchList(); + } + } + if (modTypeList != null){ + pe.setSupModuleList(modTypeList); + } + else { + if (pe.isSetSupModuleList()) { + pe.unsetSupModuleList(); + } + } + return; } if (parent instanceof PpiDeclarationsDocument.PpiDeclarations) { @@ -1254,14 +1276,23 @@ public class SpdFileContents { ppe.setCName(cName); ppe.setGuidValue(guid); ppe.setHelpText(help); - ppe.setSupArchList(archList); - ppe.setSupModuleList(modTypeList); -// if (archList != null && archList.size() > 0){ -// ppe.setSupArchList(new ArrayList(archList)); -// } -// if (archList != null && modTypeList.size() > 0) { -// ppe.setSupModuleList(new ArrayList(modTypeList)); -// } + if (archList != null) { + ppe.setSupArchList(archList); + } + else { + if (ppe.isSetSupArchList()) { + ppe.unsetSupArchList(); + } + } + if (modTypeList != null){ + ppe.setSupModuleList(modTypeList); + } + else { + if (ppe.isSetSupModuleList()) { + ppe.unsetSupModuleList(); + } + } + return; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java index 91f4ba64de..6459c2c56e 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java @@ -252,9 +252,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ int row = arg0.getFirstRow(); TableModel m = (TableModel)arg0.getSource(); if (arg0.getType() == TableModelEvent.UPDATE){ - if (docConsole != null) { - docConsole.setSaved(false); - } + updateRow(row, m); } } @@ -280,7 +278,9 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ if (!dataValidation(rowData)){ return; } - + if (docConsole != null) { + docConsole.setSaved(false); + } sfc.updateSpdGuidDecl(row, name, cName, guid, help, archList, modTypeList, guidTypeList); } /** @@ -549,9 +549,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ if (!dataValidation(row)) { return; } - if (docConsole != null) { - docConsole.setSaved(false); - } + model.addRow(row); jTable.changeSelection(model.getRowCount()-1, 0, false, false); addRow(row); @@ -610,17 +608,35 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ protected void addRow(String[] row) { Vector vArch = iCheckBoxList.getAllCheckedItemsString(); + if (vArch.size() == 0) { + vArch = null; + } Vector vModType = iCheckBoxList2.getAllCheckedItemsString(); + if (vModType.size() == 0) { + vModType = null; + } Vector vguidType = iCheckBoxList1.getAllCheckedItemsString(); + if (vguidType.size() == 0) { + vguidType = null; + } + if (docConsole != null) { + docConsole.setSaved(false); + } sfc.genSpdGuidDeclarations(row[0], row[1], row[2], row[3], vArch, vModType, vguidType); } protected void removeRow(int i){ sfc.removeSpdGuidDeclaration(i); + if (docConsole != null) { + docConsole.setSaved(false); + } } protected void clearAllRow(){ sfc.removeSpdGuidDeclaration(); + if (docConsole != null) { + docConsole.setSaved(false); + } } /** diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java index 23adb116f6..f03b5cb3df 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java @@ -108,9 +108,11 @@ public class SpdPpiDecls extends SpdGuidDecls { protected void removeRow(int i){ sfc.removeSpdPpiDeclaration(i); + docConsole.setSaved(false); } protected void clearAllRow(){ sfc.removeSpdPpiDeclaration(); + docConsole.setSaved(false); } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java index 51994cf18a..d58fcef00a 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java @@ -102,14 +102,17 @@ public class SpdProtocolDecls extends SpdGuidDecls { if (!dataValidation(row)){ return; } + docConsole.setSaved(false); sfc.genSpdProtocolDeclarations(row[0], row[1], row[2], row[3], stringToVector(row[4]), stringToVector(row[5])); } protected void removeRow(int i){ sfc.removeSpdProtocolDeclaration(i); + docConsole.setSaved(false); } protected void clearAllRow(){ sfc.removeSpdProtocolDeclaration(); + docConsole.setSaved(false); } }