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=c475b4ab1bdcbeff159832fa15d0ca4454fcfc3e;hpb=feccee87a78e68d575dbdf44b34ca0cb5a21ea8d;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 c475b4ab1b..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 @@ -30,13 +30,16 @@ import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.EnumerationData; 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; import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification; +import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector; import org.tianocore.frameworkwizard.packaging.PackageIdentification; import org.tianocore.frameworkwizard.workspace.WorkspaceTools; @@ -58,7 +61,7 @@ public class LibraryClassDefsDlg extends IDialog { // private JPanel jContentPane = null; - private JComboBox jComboBoxLibraryClassName = null; + private IComboBox iComboBoxLibraryClassName = null; private JLabel jLabelUsage = null; @@ -119,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; } /** @@ -213,7 +216,7 @@ public class LibraryClassDefsDlg extends IDialog { private JTextField getJTextFieldFeatureFlag() { if (jTextFieldFeatureFlag == null) { jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168,197,320,20)); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 197, 320, 20)); jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20)); jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE"); jTextFieldFeatureFlag.setEnabled(false); @@ -304,7 +307,8 @@ public class LibraryClassDefsDlg extends IDialog { This is the default constructor **/ - public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) { + public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, + ModuleIdentification mid) { super(iFrame, true); init(inLibraryClassIdentification, mid); } @@ -329,25 +333,30 @@ public class LibraryClassDefsDlg extends IDialog { private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) { init(); this.lcid = inLibraryClassIdentification; - + // // Init arch with module's arch // this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid)); - + // // Get defined library classes from dependent packages // Vector vpid = wt.getPackageDependenciesOfModule(mid); if (vpid.size() <= 0) { - Log.wrn("Init Library Class", "This module hasn't defined any package dependency, so there is no library class can be added"); + Log.wrn("Init Library Class", + "This module hasn't defined any package dependency, so there is no library class can be added"); } - - Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName, - wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid))); + + Tools + .generateComboBoxByVector( + 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()); @@ -367,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); } } @@ -393,7 +402,7 @@ public class LibraryClassDefsDlg extends IDialog { jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20)); jLabelArch.setText("Supported Architectures"); jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12,197,168,20)); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 197, 168, 20)); jLabelFeatureFlag.setText("Feature Flag Expression"); jLabelFeatureFlag.setEnabled(false); jLabelRecommendedInstanceGuid = new JLabel(); @@ -414,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); @@ -489,15 +498,15 @@ 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 RecommendedInstanceVersion // @@ -527,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();