X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Tools%2FJava%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2Fdialog%2FLibraryClassDefsDlg.java;h=5c48303a26c079089596427645a4d0332bb00266;hb=9216450d1143056a50a5f916984a2d7faf590488;hp=0c8d66343427db8aa3e63f6c5a2d953cc2378ac6;hpb=a721f5c47e42989f67f28377a208158cdb6f6d3d;p=mirror_edk2.git diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java index 0c8d663434..5c48303a26 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java @@ -32,6 +32,7 @@ import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.find.Find; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; +import org.tianocore.frameworkwizard.common.ui.IComboBox; import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; @@ -60,7 +61,7 @@ public class LibraryClassDefsDlg extends IDialog { // private JPanel jContentPane = null; - private JComboBox jComboBoxLibraryClassName = null; + private IComboBox iComboBoxLibraryClassName = null; private JLabel jLabelUsage = null; @@ -121,14 +122,14 @@ public class LibraryClassDefsDlg extends IDialog { @return javax.swing.JComboBox jComboBoxSelect **/ - private JComboBox getJComboBoxLibraryClassName() { - if (jComboBoxLibraryClassName == null) { - jComboBoxLibraryClassName = new JComboBox(); - jComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(168, 12, 320, 20)); - jComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20)); - jComboBoxLibraryClassName.setEnabled(true); + private IComboBox getIComboBoxLibraryClassName() { + if (iComboBoxLibraryClassName == null) { + iComboBoxLibraryClassName = new IComboBox(); + iComboBoxLibraryClassName.setBounds(new java.awt.Rectangle(168, 12, 320, 20)); + iComboBoxLibraryClassName.setPreferredSize(new Dimension(320, 20)); + iComboBoxLibraryClassName.setEnabled(true); } - return jComboBoxLibraryClassName; + return iComboBoxLibraryClassName; } /** @@ -349,13 +350,13 @@ public class LibraryClassDefsDlg extends IDialog { Tools .generateComboBoxByVector( - this.jComboBoxLibraryClassName, + this.iComboBoxLibraryClassName, wt .getAllLibraryClassDefinitionsFromPackages(wt .getPackageDependenciesOfModule(mid))); if (lcid != null) { - this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName()); + this.iComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName()); this.jComboBoxUsage.setSelectedItem(lcid.getUsage()); this.jTextFieldRecommendedInstanceVersion.setText(lcid.getRecommendedInstanceVersion()); this.jTextFieldRecommendedInstanceGuid.setText(lcid.getRecommendedInstanceGuid()); @@ -375,7 +376,7 @@ public class LibraryClassDefsDlg extends IDialog { **/ public void setViewMode(boolean isView) { if (isView) { - this.jComboBoxLibraryClassName.setEnabled(!isView); + this.iComboBoxLibraryClassName.setEnabled(!isView); this.jComboBoxUsage.setEnabled(!isView); } } @@ -422,7 +423,7 @@ public class LibraryClassDefsDlg extends IDialog { jContentPane.setLayout(null); jContentPane.setPreferredSize(new java.awt.Dimension(495, 255)); - jContentPane.add(getJComboBoxLibraryClassName(), null); + jContentPane.add(getIComboBoxLibraryClassName(), null); jContentPane.add(jLabelUsage, null); jContentPane.add(getJComboBoxUsage(), null); jContentPane.add(jLabelLibraryClassName, null); @@ -497,40 +498,14 @@ public class LibraryClassDefsDlg extends IDialog { // // Check LibraryClass // - if (this.jComboBoxLibraryClassName.getSelectedItem() == null) { + if (this.iComboBoxLibraryClassName.getSelectedItem() == null) { Log.wrn("Update Library Class Definitions", "Please select one Library Class"); return false; } - if (!DataValidation.isLibraryClass(this.jComboBoxLibraryClassName.getSelectedItem().toString())) { + if (!DataValidation.isLibraryClass(this.iComboBoxLibraryClassName.getSelectedItem().toString())) { Log.wrn("Update Library Class Definitions", "Incorrect data type for Library Class"); return false; } - - // - // Check if the library is produced - // - String strUsage = this.jComboBoxUsage.getSelectedItem().toString(); - // - // Check only when the library class is consumed - // - if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) { - LibraryClassVector v = Find.getAllLibraryClassVector(); - boolean isFind = false; - for (int index = 0; index < v.size(); index++) { - LibraryClassIdentification lid = v.getLibraryClass(index); - if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) { - if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED) - || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) { - isFind = true; - break; - } - } - } - if (!isFind) { - Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet."); - return false; - } - } // // Check RecommendedInstanceVersion @@ -561,12 +536,38 @@ public class LibraryClassDefsDlg extends IDialog { return false; } } + + // + // Check if the library is produced + // + String strUsage = this.jComboBoxUsage.getSelectedItem().toString(); + // + // Check only when the library class is consumed + // + if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) { + LibraryClassVector v = Find.getAllLibraryClassVector(); + boolean isFind = false; + for (int index = 0; index < v.size(); index++) { + LibraryClassIdentification lid = v.getLibraryClass(index); + if (lid.getLibraryClassName().equals(this.iComboBoxLibraryClassName.getSelectedItem().toString())) { + if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED) + || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) { + isFind = true; + break; + } + } + } + if (!isFind) { + Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet. It may have some errors in build time."); + //return false; + } + } return true; } private LibraryClassIdentification getCurrentLibraryClass() { - String name = this.jComboBoxLibraryClassName.getSelectedItem().toString(); + String name = this.iComboBoxLibraryClassName.getSelectedItem().toString(); String usage = this.jComboBoxUsage.getSelectedItem().toString(); String version = this.jTextFieldRecommendedInstanceVersion.getText(); String guid = this.jTextFieldRecommendedInstanceGuid.getText();