From 322b77230862234b9c8e79e92b2201e585822ec0 Mon Sep 17 00:00:00 2001 From: lhauch Date: Sun, 16 Jul 2006 08:26:44 +0000 Subject: [PATCH] Added some checks to see if the attributes were set - clears up some warning messages when trying to unset an attribute that was not set. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1024 6f19259b-4bc3-4df7-8a09-765794883524 --- .../packaging/ui/SpdFileContents.java | 50 +++++++++++++++---- .../packaging/ui/SpdLibClassDecls.java | 12 ++--- 2 files changed, 45 insertions(+), 17 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 2aaf6e22f7..3b5c686956 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 @@ -340,22 +340,29 @@ public class SpdFileContents { if (instanceVer != null){ lc.setRecommendedInstanceVersion(instanceVer); } else { - lc.unsetRecommendedInstanceVersion(); + if (lc.isSetRecommendedInstanceVersion()) { + lc.unsetRecommendedInstanceVersion(); + } } } else { - lc.unsetRecommendedInstanceGuid(); - lc.unsetRecommendedInstanceVersion(); + if (lc.isSetRecommendedInstanceGuid()) { + lc.unsetRecommendedInstanceGuid(); + } } if (stringToList(hdrAttribArch) != null){ lc.setSupArchList(stringToList(hdrAttribArch)); } else { - lc.unsetSupArchList(); + if (lc.isSetSupArchList()) { + lc.unsetSupArchList(); + } } if (stringToList(hdrAttribModType) != null){ lc.setSupModuleList(stringToList(hdrAttribModType)); } else { - lc.unsetSupModuleList(); + if (lc.isSetSupModuleList()) { + lc.unsetSupModuleList(); + } } } @@ -397,22 +404,28 @@ public class SpdFileContents { e.setGuidValue(guid); e.setHelpText(hlp); if (stringToList(guidTypeList) != null) { - e.setGuidTypeList(stringToList(guidTypeList)); + e.setGuidTypeList(stringToList(guidTypeList)); } else{ + if (e.isSetGuidTypeList()) { e.unsetGuidTypeList(); + } } if (stringToList(archList) != null){ e.setSupArchList(stringToList(archList)); } else{ + if (e.isSetSupArchList()) { e.unsetSupArchList(); + } } if (stringToList(modTypeList) != null) { e.setSupModuleList(stringToList(modTypeList)); } else{ + if (e.isSetSupModuleList()) { e.unsetSupModuleList(); + } } } @@ -440,13 +453,17 @@ public class SpdFileContents { e.setSupArchList(stringToList(archList)); } else{ + if (e.isSetSupArchList()) { e.unsetSupArchList(); + } } if (stringToList(modTypeList) != null) { e.setSupModuleList(stringToList(modTypeList)); } else{ + if (e.isSetSupModuleList()) { e.unsetSupModuleList(); + } } } cursor.dispose(); @@ -473,13 +490,17 @@ public class SpdFileContents { e.setSupArchList(stringToList(archList)); } else{ + if (e.isSetSupArchList()) { e.unsetSupArchList(); + } } if (stringToList(modTypeList) != null) { e.setSupModuleList(stringToList(modTypeList)); } else{ + if (e.isSetSupModuleList()) { e.unsetSupModuleList(); + } } } cursor.dispose(); @@ -989,11 +1010,18 @@ public class SpdFileContents { */ if (hdrAttribArch != null) { lc.setSupArchList(stringToList(hdrAttribArch)); + } else { + if (lc.isSetSupArchList()) { + lc.unsetSupArchList(); + } } + if (hdrAttribModType != null) { lc.setSupModuleList(stringToList(hdrAttribModType)); } else { - lc.unsetSupModuleList(); + if (lc.isSetSupModuleList()) { + lc.unsetSupModuleList(); + } } } @@ -1278,12 +1306,16 @@ public class SpdFileContents { if (archList != null){ pe.setSupArchList(stringToList(archList)); } else { - pe.unsetSupArchList(); + if (pe.isSetSupArchList()) { + pe.unsetSupArchList(); + } } if (modTypeList != null){ pe.setSupModuleList(stringToList(modTypeList)); } else { - pe.unsetSupModuleList(); + if (pe.isSetSupModuleList()) { + pe.unsetSupModuleList(); + } } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java index 4d35348dcf..dade30d282 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java @@ -251,7 +251,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen vModule.add("UEFI_DRIVER"); vModule.add("UEFI_APPLICATION"); vModule.add("USER_DEFINED"); - vModule.add("NONE"); jTable.getColumnModel().getColumn(cnSupMod).setCellEditor(new ListEditor(vModule)); @@ -293,12 +292,8 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen arch = m.getValueAt(row, cnSupArch).toString(); } String module = null; - // if (lsm.isSelectionEmpty()) { if (m.getValueAt(row, cnSupMod) != null) { module = m.getValueAt(row, cnSupMod).toString(); - if (module == "NONE") { - module = null; - } } String[] rowData = {lib, hdr, hlp}; if (!dataValidation(rowData)) { @@ -308,7 +303,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen // LAH getLibInstances(lib); -// LAH String guid = nameToGuid(name); + if (name != null) { + String guid = nameToGuid(name); + } // LAH WAS sfc.updateSpdLibClass(row, lib, hdr, hlp, guid, ver, arch, module); sfc.updateSpdLibClass(row, lib, hdr, hlp, null, null, arch, module); @@ -589,8 +586,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen // //convert to GUID before storing recommended lib instance. // - getLibInstances(row[0]); - + getLibInstances(row[cnClassName]); // LAH recommendGuid = nameToGuid(row[3]); // LAH WAS sfc.genSpdLibClassDeclarations(row[0], recommendGuid, row[1], row[2], row[5], null, null, row[4], null, row[6]);