]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Fix EDKT303: Give warning if no library instances that support the required the...
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 13 Oct 2006 03:13:19 +0000 (03:13 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 13 Oct 2006 03:13:19 +0000 (03:13 +0000)
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

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java

index b833ba68e84c4f9c7734e17b9bd8ae122f752777..08bae58d2b6c15365f829c73e6e374316ef79e42 100644 (file)
@@ -834,7 +834,7 @@ public class Find {
             }\r
 \r
             //\r
-            // Get the sting "PackageName.ModuleName" \r
+            // Get the string "PackageName.ModuleName" \r
             //\r
             String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR\r
                          + lcvId.getBelongModule().getName();\r
index 56490a284fcbb1360d1e1c01b884cd4333da4e0b..fa03258bdc33ef86643200b2c24d04becc21404a 100644 (file)
@@ -16,14 +16,19 @@ package org.tianocore.frameworkwizard.module.Identifications.LibraryClass;
 \r
 import java.util.Vector;\r
 \r
-\r
 public class LibraryClassVector {\r
     private Vector<LibraryClassIdentification> vLibraryClass = new Vector<LibraryClassIdentification>();\r
-    \r
+\r
     public int findLibraryClass(LibraryClassIdentification lib) {\r
-        return findLibraryClass(lib.getLibraryClassName());\r
+        for (int index = 0; index < vLibraryClass.size(); index++) {\r
+            if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())\r
+                && vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {\r
+                return index;\r
+            }\r
+        }\r
+        return -1;\r
     }\r
-    \r
+\r
     public int findLibraryClass(String name) {\r
         for (int index = 0; index < vLibraryClass.size(); index++) {\r
             if (vLibraryClass.elementAt(index).getLibraryClassName().equals(name)) {\r
@@ -32,7 +37,7 @@ public class LibraryClassVector {
         }\r
         return -1;\r
     }\r
-    \r
+\r
     public LibraryClassIdentification getLibraryClass(int index) {\r
         if (index > -1) {\r
             return vLibraryClass.elementAt(index);\r
@@ -40,24 +45,24 @@ public class LibraryClassVector {
             return null;\r
         }\r
     }\r
-    \r
+\r
     public void addLibraryClass(LibraryClassIdentification lib) {\r
         if (findLibraryClass(lib) == -1) {\r
             vLibraryClass.addElement(lib);\r
         }\r
     }\r
-    \r
+\r
     public void setLibraryClass(LibraryClassIdentification lib, int index) {\r
         vLibraryClass.setElementAt(lib, index);\r
     }\r
-    \r
+\r
     public void removeLibraryClass(LibraryClassIdentification lib) {\r
         int index = findLibraryClass(lib);\r
         if (index > -1) {\r
             vLibraryClass.removeElementAt(index);\r
         }\r
     }\r
-    \r
+\r
     public void removeLibraryClass(int index) {\r
         if (index > -1 && index < this.size()) {\r
             vLibraryClass.removeElementAt(index);\r
@@ -71,7 +76,7 @@ public class LibraryClassVector {
     public void setVLibraryClass(Vector<LibraryClassIdentification> libraryClass) {\r
         vLibraryClass = libraryClass;\r
     }\r
-    \r
+\r
     public Vector<String> getLibraryClassName() {\r
         Vector<String> v = new Vector<String>();\r
         for (int index = 0; index < this.vLibraryClass.size(); index++) {\r
@@ -79,11 +84,11 @@ public class LibraryClassVector {
         }\r
         return v;\r
     }\r
-    \r
+\r
     public int size() {\r
         return this.vLibraryClass.size();\r
     }\r
-    \r
+\r
     public Vector<String> toStringVector(int index) {\r
         Vector<String> v = new Vector<String>();\r
         v.addElement(getLibraryClass(index).getLibraryClassName());\r
index c475b4ab1bdcbeff159832fa15d0ca4454fcfc3e..0c8d66343427db8aa3e63f6c5a2d953cc2378ac6 100644 (file)
@@ -30,6 +30,7 @@ import org.tianocore.frameworkwizard.common.DataValidation;
 import org.tianocore.frameworkwizard.common.EnumerationData;\r
 import org.tianocore.frameworkwizard.common.Log;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
+import org.tianocore.frameworkwizard.common.find.Find;\r
 import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r
 import org.tianocore.frameworkwizard.common.ui.IDialog;\r
 import org.tianocore.frameworkwizard.common.ui.IFrame;\r
@@ -37,6 +38,7 @@ import org.tianocore.frameworkwizard.common.ui.StarLabel;
 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;\r
 import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
 import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
 \r
@@ -213,7 +215,7 @@ public class LibraryClassDefsDlg extends IDialog {
     private JTextField getJTextFieldFeatureFlag() {\r
         if (jTextFieldFeatureFlag == null) {\r
             jTextFieldFeatureFlag = new JTextField();\r
-            jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168,197,320,20));\r
+            jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 197, 320, 20));\r
             jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(320, 20));\r
             jTextFieldFeatureFlag.setToolTipText("Postfix expression that must evaluate to TRUE or FALSE");\r
             jTextFieldFeatureFlag.setEnabled(false);\r
@@ -304,7 +306,8 @@ public class LibraryClassDefsDlg extends IDialog {
      This is the default constructor\r
      \r
      **/\r
-    public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame, ModuleIdentification mid) {\r
+    public LibraryClassDefsDlg(LibraryClassIdentification inLibraryClassIdentification, IFrame iFrame,\r
+                               ModuleIdentification mid) {\r
         super(iFrame, true);\r
         init(inLibraryClassIdentification, mid);\r
     }\r
@@ -329,22 +332,27 @@ public class LibraryClassDefsDlg extends IDialog {
     private void init(LibraryClassIdentification inLibraryClassIdentification, ModuleIdentification mid) {\r
         init();\r
         this.lcid = inLibraryClassIdentification;\r
-        \r
+\r
         //\r
         // Init arch with module's arch\r
         //\r
         this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));\r
-        \r
+\r
         //\r
         // Get defined library classes from dependent packages\r
         //\r
         Vector<PackageIdentification> vpid = wt.getPackageDependenciesOfModule(mid);\r
         if (vpid.size() <= 0) {\r
-            Log.wrn("Init Library Class", "This module hasn't defined any package dependency, so there is no library class can be added");\r
+            Log.wrn("Init Library Class",\r
+                    "This module hasn't defined any package dependency, so there is no library class can be added");\r
         }\r
-        \r
-        Tools.generateComboBoxByVector(this.jComboBoxLibraryClassName,\r
-                                       wt.getAllLibraryClassDefinitionsFromPackages(wt.getPackageDependenciesOfModule(mid)));\r
+\r
+        Tools\r
+             .generateComboBoxByVector(\r
+                                       this.jComboBoxLibraryClassName,\r
+                                       wt\r
+                                         .getAllLibraryClassDefinitionsFromPackages(wt\r
+                                                                                      .getPackageDependenciesOfModule(mid)));\r
 \r
         if (lcid != null) {\r
             this.jComboBoxLibraryClassName.setSelectedItem(lcid.getLibraryClassName());\r
@@ -393,7 +401,7 @@ public class LibraryClassDefsDlg extends IDialog {
             jLabelArch.setBounds(new java.awt.Rectangle(12, 87, 168, 20));\r
             jLabelArch.setText("Supported Architectures");\r
             jLabelFeatureFlag = new JLabel();\r
-            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12,197,168,20));\r
+            jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 197, 168, 20));\r
             jLabelFeatureFlag.setText("Feature Flag Expression");\r
             jLabelFeatureFlag.setEnabled(false);\r
             jLabelRecommendedInstanceGuid = new JLabel();\r
@@ -498,6 +506,32 @@ public class LibraryClassDefsDlg extends IDialog {
             return false;\r
         }\r
 \r
+        //\r
+        // Check if the library is produced\r
+        //\r
+        String strUsage = this.jComboBoxUsage.getSelectedItem().toString();\r
+        //\r
+        // Check only when the library class is consumed\r
+        //\r
+        if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
+            LibraryClassVector v = Find.getAllLibraryClassVector();\r
+            boolean isFind = false;\r
+            for (int index = 0; index < v.size(); index++) {\r
+                LibraryClassIdentification lid = v.getLibraryClass(index);\r
+                if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {\r
+                    if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
+                        || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
+                        isFind = true;\r
+                        break;\r
+                    }\r
+                }\r
+            }\r
+            if (!isFind) {\r
+                Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet.");\r
+                return false;\r
+            }\r
+        }\r
+        \r
         //\r
         // Check RecommendedInstanceVersion\r
         //\r