1. Fix EDKT303: Give warning if no library instances that support the required the library class

2. Fix a bug in Find function: Missing library classes which has same name but different usage.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1736 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
hche10x 2006-10-13 03:13:19 +00:00
parent f4ead3ba43
commit a721f5c47e
3 changed files with 61 additions and 22 deletions

View File

@ -834,7 +834,7 @@ public class Find {
}
//
// Get the sting "PackageName.ModuleName"
// Get the string "PackageName.ModuleName"
//
String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR
+ lcvId.getBelongModule().getName();

View File

@ -16,12 +16,17 @@ package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;
import java.util.Vector;
public class LibraryClassVector {
private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();
public int findLibraryClass(LibraryClassIdentification lib) {
return findLibraryClass(lib.getLibraryClassName());
for (int index = 0; index < vLibraryClass.size(); index++) {
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())
&& vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {
return index;
}
}
return -1;
}
public int findLibraryClass(String name) {

View File

@ -30,6 +30,7 @@ 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.IDialog;
import org.tianocore.frameworkwizard.common.ui.IFrame;
@ -37,6 +38,7 @@ 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;
@ -304,7 +306,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);
}
@ -340,11 +343,16 @@ public class LibraryClassDefsDlg extends IDialog {
//
Vector<PackageIdentification> 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.jComboBoxLibraryClassName,
wt
.getAllLibraryClassDefinitionsFromPackages(wt
.getPackageDependenciesOfModule(mid)));
if (lcid != null) {
this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());
@ -498,6 +506,32 @@ 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.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
//