From 5b396948e7501bc0ea4b655f7b3c50dbd14552c6 Mon Sep 17 00:00:00 2001 From: hche10x Date: Thu, 8 Mar 2007 05:48:32 +0000 Subject: [PATCH] 1. Fix EDKT528: Framework wizard should not force user to specify a GuidCName for all HOB types git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2430 6f19259b-4bc3-4df7-8a09-765794883524 --- .../frameworkwizard/common/Tools.java | 3 ++ .../Events/EventsIdentification.java | 3 ++ .../Hobs/HobsIdentification.java | 3 ++ .../module/ui/ModuleEvents.java | 2 +- .../module/ui/dialog/EventsDlg.java | 28 ++++++++----------- .../module/ui/dialog/HobsDlg.java | 24 ++++++---------- 6 files changed, 31 insertions(+), 32 deletions(-) diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java index 6dcb91e931..3eb9b85455 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java @@ -704,6 +704,9 @@ public class Tools { * */ public static boolean isEmpty(String strValue) { + if (strValue == null) { + return true; + } if (strValue.length() > 0) { return false; } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java index 24e168335d..bbb22e594a 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Events/EventsIdentification.java @@ -17,6 +17,8 @@ package org.tianocore.frameworkwizard.module.Identifications.Events; import java.util.Vector; +import org.tianocore.frameworkwizard.common.DataType; + public class EventsIdentification { // @@ -38,6 +40,7 @@ public class EventsIdentification { public EventsIdentification(String arg0, String arg1, String arg2, String arg3, Vector arg4, String arg5, String arg6) { this.name = (arg0 == null ? "" : arg0); + this.name = (this.name == DataType.EMPTY_SELECT_ITEM ? "" : this.name); this.type = (arg1 == null ? "" : arg1); this.usage = (arg2 == null ? "" : arg2); this.featureFlag = (arg3 == null ? "" : arg3); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java index e2144fa583..7b9dadd15e 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/Hobs/HobsIdentification.java @@ -17,6 +17,8 @@ package org.tianocore.frameworkwizard.module.Identifications.Hobs; import java.util.Vector; +import org.tianocore.frameworkwizard.common.DataType; + public class HobsIdentification { // @@ -36,6 +38,7 @@ public class HobsIdentification { public HobsIdentification(String arg0, String arg1, String arg2, String arg3, Vector arg4, String arg5) { this.name = (arg0 == null ? "" : arg0); + this.name = (this.name == DataType.EMPTY_SELECT_ITEM ? "" : this.name); this.type = (arg1 == null ? "" : arg1); this.usage = (arg2 == null ? "" : arg2); this.featureFlag = (arg3 == null ? "" : arg3); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java index 31977b5bb0..354be3ddae 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModuleEvents.java @@ -461,7 +461,7 @@ public class ModuleEvents extends IInternalFrame { e.setEventType(EventTypes.Enum.forString(vid.getEvents(index).getGroup())); } se.addNewEventTypes(); - se.setEventTypesArray(ce.getEventTypesList().size() - 1, e); + se.setEventTypesArray(se.getEventTypesList().size() - 1, e); } } } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java index 552a77dd46..10e3a174ca 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/EventsDlg.java @@ -330,9 +330,17 @@ public class EventsDlg extends IDialog { Tools .generateComboBoxByVector(iComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_EFI_EVENT)); + + this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0); + this.iComboBoxGuidC_Name.setSelectedIndex(0); if (this.id != null) { - this.iComboBoxGuidC_Name.setSelectedItem(id.getName()); + String tmpName = id.getName(); + if (isEmpty(tmpName)) { + tmpName = DataType.EMPTY_SELECT_ITEM; + } + + this.iComboBoxGuidC_Name.setSelectedItem(tmpName); this.jComboBoxEventsType.setSelectedItem(id.getType()); this.jComboBoxUsage.setSelectedItem(id.getUsage()); this.jTextAreaHelpText.setText(id.getHelp()); @@ -424,7 +432,7 @@ public class EventsDlg extends IDialog { jContentPane.add(jStarLabel1, null); jContentPane.add(jLabelEventType, null); jContentPane.add(getJComboBoxEventsType(), null); - jContentPane.add(jStarLabel2, null); + //jContentPane.add(jStarLabel2, null); jContentPane.add(jLabelC_Name, null); jContentPane.add(getIComboBoxGuidC_Name(), null); jContentPane.add(jStarLabel3, null); @@ -494,20 +502,8 @@ public class EventsDlg extends IDialog { // // Check Name // - if (this.iComboBoxGuidC_Name.getSelectedItem() == null) { - Log.wrn("Update Guids", "Please select one Event Name"); - return false; - } - - // - // Check Name - // - if (isEmpty(this.iComboBoxGuidC_Name.getSelectedItem().toString())) { - Log.wrn("Update Events", "Event Name couldn't be empty"); - return false; - } - - if (!isEmpty(this.iComboBoxGuidC_Name.getSelectedItem().toString())) { + String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString(); + if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) { if (!DataValidation.isC_NameType(this.iComboBoxGuidC_Name.getSelectedItem().toString())) { Log.wrn("Update Events", "Incorrect data type for Event Name"); return false; diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java index 73a1869a7f..caf1649984 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/HobsDlg.java @@ -310,10 +310,16 @@ public class HobsDlg extends IDialog { Tools .generateComboBoxByVector(iComboBoxGuidC_Name, wt.getAllGuidDeclarationsFromPackages(vpid, EnumerationData.GUID_TYPE_HOB)); + this.iComboBoxGuidC_Name.insertItemAt(DataType.EMPTY_SELECT_ITEM, 0); + this.iComboBoxGuidC_Name.setSelectedIndex(0); if (this.id != null) { - this.iComboBoxGuidC_Name.setSelectedItem(id.getName()); + String tmpName = id.getName(); + if (isEmpty(tmpName)) { + tmpName = DataType.EMPTY_SELECT_ITEM; + } + this.iComboBoxGuidC_Name.setSelectedItem(tmpName); this.jComboBoxHobType.setSelectedItem(id.getType()); this.jComboBoxUsage.setSelectedItem(id.getUsage()); this.jTextAreaHelpText.setText(id.getHelp()); @@ -395,7 +401,6 @@ public class HobsDlg extends IDialog { jContentPane.setLayout(null); jContentPane.setPreferredSize(new java.awt.Dimension(485, 215)); - jContentPane.add(jStarLabel1, null); jContentPane.add(jLabelC_Name, null); jContentPane.add(getIComboBoxGuidC_Name(), null); jContentPane.add(jStarLabel2, null); @@ -463,19 +468,8 @@ public class HobsDlg extends IDialog { // // Check Name // - if (this.iComboBoxGuidC_Name.getSelectedItem() == null) { - Log.wrn("Update Guids", "Please select one Hob Name"); - return false; - } - // - // Check Name - // - if (isEmpty(this.iComboBoxGuidC_Name.getSelectedItem().toString())) { - Log.wrn("Update Hobs", "Hob Guid C Name must be entered!"); - return false; - } - - if (!isEmpty(this.iComboBoxGuidC_Name.getSelectedItem().toString())) { + String tmpName = this.iComboBoxGuidC_Name.getSelectedItem().toString(); + if (!tmpName.equals(DataType.EMPTY_SELECT_ITEM) && isEmpty(tmpName)) { if (!DataValidation.isC_NameType(this.iComboBoxGuidC_Name.getSelectedItem().toString())) { Log.wrn("Update Hobs", "Incorrect data type for Hob Name"); return false;