summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-13 03:13:19 +0000
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-13 03:13:19 +0000
commita721f5c47e42989f67f28377a208158cdb6f6d3d (patch)
treec0dd5a2714203489e4daefa0f045841460a86d01
parentf4ead3ba433d61a12d9011303f10fb18c173a41d (diff)
downloadedk2-a721f5c47e42989f67f28377a208158cdb6f6d3d.zip
edk2-a721f5c47e42989f67f28377a208158cdb6f6d3d.tar.gz
edk2-a721f5c47e42989f67f28377a208158cdb6f6d3d.tar.bz2
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
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java2
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java29
-rw-r--r--Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java52
3 files changed, 61 insertions, 22 deletions
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
index b833ba6..08bae58 100644
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
+++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
@@ -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();
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
index 56490a2..fa03258 100644
--- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
+++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
@@ -16,14 +16,19 @@ 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) {
for (int index = 0; index < vLibraryClass.size(); index++) {
if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {
@@ -32,7 +37,7 @@ public class LibraryClassVector {
}
return -1;
}
-
+
public LibraryClassIdentification getLibraryClass(int index) {
if (index > -1) {
return vLibraryClass.elementAt(index);
@@ -40,24 +45,24 @@ public class LibraryClassVector {
return null;
}
}
-
+
public void addLibraryClass(LibraryClassIdentification lib) {
if (findLibraryClass(lib) == -1) {
vLibraryClass.addElement(lib);
}
}
-
+
public void setLibraryClass(LibraryClassIdentification lib, int index) {
vLibraryClass.setElementAt(lib, index);
}
-
+
public void removeLibraryClass(LibraryClassIdentification lib) {
int index = findLibraryClass(lib);
if (index > -1) {
vLibraryClass.removeElementAt(index);
}
}
-
+
public void removeLibraryClass(int index) {
if (index > -1 && index < this.size()) {
vLibraryClass.removeElementAt(index);
@@ -71,7 +76,7 @@ public class LibraryClassVector {
public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {
vLibraryClass = libraryClass;
}
-
+
public Vector<String> getLibraryClassName() {
Vector<String> v = new Vector<String>();
for (int index = 0; index < this.vLibraryClass.size(); index++) {
@@ -79,11 +84,11 @@ public class LibraryClassVector {
}
return v;
}
-
+
public int size() {
return this.vLibraryClass.size();
}
-
+
public Vector<String> toStringVector(int index) {
Vector<String> v = new Vector<String>();
v.addElement(getLibraryClass(index).getLibraryClassName());
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 c475b4a..0c8d663 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,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;
@@ -213,7 +215,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 +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);
}
@@ -329,22 +332,27 @@ 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<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());
@@ -393,7 +401,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();
@@ -499,6 +507,32 @@ public class LibraryClassDefsDlg extends IDialog {
}
//
+ // 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
//
// if (!isEmpty(this.jTextFieldRecommendedInstanceVersion.getText())) {