Fix EDKT191.
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 17 Aug 2006 03:11:55 +0000 (03:11 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 17 Aug 2006 03:11:55 +0000 (03:11 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1301 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java

index 0ed5768..d1363f7 100644 (file)
@@ -934,9 +934,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
                     ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
                     Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
                     SurfaceAreaQuery.setDoc(m);\r
-                    String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");\r
-                    for (int i = 0; i < classProduced.length; ++i) {\r
-                        if (classProduced[i].equals(libClass)) {\r
+                    Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
+                    for (int i = 0; i < classProduced.size(); ++i) {\r
+                        if (classProduced.get(i).equals(libClass)) {\r
                             libNameGuidMap.put(mi.getName(), mi.getGuid());\r
                         }\r
                     }\r
index 3d3e8f3..2b1cffe 100644 (file)
@@ -379,7 +379,7 @@ public class FpdFileContents {
                     Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
                     m.put("ModuleSurfaceArea", msa);\r
                     SurfaceAreaQuery.setDoc(m);\r
-                    PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r
+                    PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, vMi.get(i));\r
                     PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = LookupPcdDeclaration(msaPcd, depPkgs);\r
                     if (spdPcd == null) {\r
                         //\r
@@ -541,7 +541,7 @@ public class FpdFileContents {
             Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
             m.put("ModuleSurfaceArea", msa);\r
             SurfaceAreaQuery.setDoc(m);\r
-            PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r
+            PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);\r
             //\r
             // First look through MSA pcd entries.\r
             //\r
@@ -896,7 +896,7 @@ public class FpdFileContents {
             Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
             m.put("ModuleSurfaceArea", msa);\r
             SurfaceAreaQuery.setDoc(m);\r
-            PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null);\r
+            PackageIdentification[] depPkgs = SurfaceAreaQuery.getDependencePkg(null, mi);\r
             //\r
             // Implementing InitializePlatformPcdBuildDefinitions\r
             //\r
index 440e421..06d0d0d 100644 (file)
@@ -579,6 +579,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     if (selectedRow < 0) {\r
                         return;\r
                     }\r
+                    docConsole.setSaved(false);\r
 \r
                     TableSorter sorter = (TableSorter) jTableFpdModules.getModel();\r
                     selectedRow = sorter.modelIndex(selectedRow);\r
@@ -606,7 +607,6 @@ public class FpdFrameworkModules extends IInternalFrame {
                         }\r
                     }\r
 \r
-                    docConsole.setSaved(false);\r
                     ffc.removeModuleSA(selectedRow);\r
                 }\r
             });\r
index 27533b4..a34fa5a 100644 (file)
@@ -23,7 +23,6 @@ import javax.swing.event.TableModelListener;
 import javax.swing.table.DefaultTableModel;\r
 import javax.swing.table.TableModel;\r
 \r
-import org.apache.xmlbeans.XmlObject;\r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
@@ -38,7 +37,6 @@ import java.util.ArrayList;
 import java.util.HashMap;\r
 import java.util.Iterator;\r
 import java.util.ListIterator;\r
-import java.util.Map;\r
 import java.util.Set;\r
 import java.util.Vector;\r
 \r
@@ -226,37 +224,35 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         ModuleIdentification mi = GlobalData.getModuleId(key);\r
         PackageIdentification[] depPkgList = null;\r
         try{\r
-            Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
-            SurfaceAreaQuery.setDoc(m);\r
             //\r
             // Get dependency pkg list into which we will search lib instances.\r
             //\r
-            depPkgList = SurfaceAreaQuery.getDependencePkg(null);\r
+            depPkgList = SurfaceAreaQuery.getDependencePkg(null, mi);\r
             //\r
             // Get the lib class consumed, produced by this module itself.\r
             //\r
-            String[] classConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED");\r
+            Vector<String> vClassConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);\r
             \r
             if (this.classConsumed == null) {\r
                 this.classConsumed = new HashMap<String, ArrayList<String>>();\r
             }\r
             \r
-            for(int i = 0; i < classConsumed.length; ++i){\r
-                ArrayList<String> consumedBy = this.classConsumed.get(classConsumed[i]);\r
+            for(int i = 0; i < vClassConsumed.size(); ++i){\r
+                ArrayList<String> consumedBy = this.classConsumed.get(vClassConsumed.get(i));\r
                 if (consumedBy == null) {\r
                     consumedBy = new ArrayList<String>();\r
                 }\r
                 consumedBy.add(key);\r
-                this.classConsumed.put(classConsumed[i], consumedBy);\r
+                this.classConsumed.put(vClassConsumed.get(i), consumedBy);\r
             }\r
             \r
-            String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");\r
+            Vector<String> vClassProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
             if (this.classProduced == null) {\r
                 this.classProduced = new ArrayList<String>();\r
             }\r
-            for(int i = 0; i < classProduced.length; ++i){\r
-                if (!this.classProduced.contains(classProduced[i])){\r
-                    this.classProduced.add(classProduced[i]);\r
+            for(int i = 0; i < vClassProduced.size(); ++i){\r
+                if (!this.classProduced.contains(vClassProduced.get(i))){\r
+                    this.classProduced.add(vClassProduced.get(i));\r
                 }\r
             }\r
             \r
@@ -362,10 +358,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     private String[] getClassProduced(ModuleIdentification mi){\r
         \r
         try{\r
-            Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
-            SurfaceAreaQuery.setDoc(m);\r
-            String[] clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED");\r
-            return clsProduced;\r
+            Vector<String> clsProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
+            String[] sClassProduced = new String[clsProduced.size()];\r
+            for (int i = 0; i < clsProduced.size(); ++i) {\r
+                sClassProduced[i] = clsProduced.get(i);\r
+            }\r
+            return sClassProduced;\r
             \r
         }catch (Exception e) {\r
             e.printStackTrace();\r
@@ -376,16 +374,17 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     \r
     private String[] getClassConsumed(ModuleIdentification mi){\r
         \r
-        String[] clsConsumed = null;\r
         try{\r
-            Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
-            SurfaceAreaQuery.setDoc(m);\r
-            clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED");\r
-            \r
+            Vector<String> clsConsumed = SurfaceAreaQuery.getLibraryClasses("ALWAYS_CONSUMED", mi);\r
+            String[] sClassConsumed = new String[clsConsumed.size()];\r
+            for (int i = 0; i < clsConsumed.size(); ++i) {\r
+                sClassConsumed[i] = clsConsumed.get(i);\r
+            }\r
+            return sClassConsumed;\r
         }catch (Exception e) {\r
             e.printStackTrace();\r
         }\r
-        return clsConsumed;\r
+        return new String[0];\r
     }\r
     \r
     private void showClassToResolved(){\r
@@ -397,12 +396,12 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         while(li.hasNext()){\r
             \r
             String[] s = {li.next()};\r
-            if (classConsumed.get(s[0]) == null) {\r
-                continue;\r
-            }\r
-            if (classConsumed.get(s[0]).size() == 0) {\r
-                continue;\r
-            }\r
+//            if (classConsumed.get(s[0]) == null) {\r
+//                continue;\r
+//            }\r
+//            if (classConsumed.get(s[0]).size() == 0) {\r
+//                continue;\r
+//            }\r
             if (!classProduced.contains(s[0])){\r
                 libClassTableModel.addRow(s);\r
             }\r
index 11a2783..7e70970 100644 (file)
@@ -21,6 +21,7 @@ import java.util.List;
 import java.util.Map;\r
 import java.util.Set;\r
 import java.util.Stack;\r
+import java.util.Vector;\r
 import java.util.regex.Matcher;\r
 import java.util.regex.Pattern;\r
 \r
@@ -37,6 +38,7 @@ import org.tianocore.LibrariesDocument;
 import org.tianocore.LibraryClassDeclarationsDocument;\r
 import org.tianocore.LibraryClassDocument;\r
 import org.tianocore.ModuleSADocument;\r
+import org.tianocore.ModuleSurfaceAreaDocument;\r
 import org.tianocore.ModuleTypeDef;\r
 import org.tianocore.MsaFilesDocument;\r
 import org.tianocore.MsaHeaderDocument;\r
@@ -341,22 +343,22 @@ public class SurfaceAreaQuery {
         * @returns package name list if elements are found at the known xpath\r
         * @returns null if nothing is there\r
         */\r
-       public static PackageIdentification[] getDependencePkg(String arch) {\r
-               String[] xPath;\r
+\r
+       public static PackageIdentification[] getDependencePkg(String arch, ModuleIdentification mi) throws Exception{\r
+               \r
                String packageGuid = null;\r
                String packageVersion = null;\r
 \r
-               if (arch == null || arch.equals("")) {\r
-                       xPath = new String[] { "/PackageDependencies/Package" };\r
-               } else {\r
-                       xPath = new String[] { "/PackageDependencies/Package[not(@SupArchList) or @SupArchList='"\r
-                                       + arch + "']" };\r
-               }\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) GlobalData.getModuleXmlObject(mi);\r
+        if (msa.getPackageDependencies() == null) {\r
+            return new PackageIdentification[0];\r
+        }\r
+        int size = msa.getPackageDependencies().getPackageList().size();\r
+        XmlObject[] returns = new XmlObject[size];\r
+        for (int i = 0; i < size; ++i) {\r
+            returns[i] = msa.getPackageDependencies().getPackageList().get(i);\r
+        }\r
 \r
-               XmlObject[] returns = get("ModuleSurfaceArea", xPath);\r
-               if (returns == null) {\r
-                       return new PackageIdentification[0];\r
-               }\r
                PackageIdentification[] packageIdList = new PackageIdentification[returns.length];\r
                for (int i = 0; i < returns.length; i++) {\r
                        PackageDependenciesDocument.PackageDependencies.Package item = (PackageDependenciesDocument.PackageDependencies.Package) returns[i];\r
@@ -401,25 +403,22 @@ public class SurfaceAreaQuery {
         *          xpath\r
         * @returns null if nothing is there\r
         */\r
-       public static String[] getLibraryClasses(String usage) {\r
-               String[] xPath;\r
-\r
-               if (usage == null || usage.equals("")) {\r
-                       xPath = new String[] { "/LibraryClass" };\r
-               } else {\r
-                       xPath = new String[] { "/LibraryClass[@Usage='" + usage + "']" };\r
-               }\r
-\r
-               XmlObject[] returns = get("LibraryClassDefinitions", xPath);\r
-               if (returns == null || returns.length == 0) {\r
-                       return new String[0];\r
-               }\r
-\r
-               LibraryClassDocument.LibraryClass[] libraryClassList = (LibraryClassDocument.LibraryClass[]) returns;\r
-               String[] libraryClassName = new String[libraryClassList.length];\r
-               for (int i = 0; i < libraryClassList.length; i++) {\r
-                       libraryClassName[i] = libraryClassList[i].getKeyword();\r
+       public static Vector<String> getLibraryClasses(String usage, ModuleIdentification mi) throws Exception{\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r
+        Vector<String> libraryClassName = new Vector<String>();\r
+        if (msa.getLibraryClassDefinitions() == null) {\r
+            return libraryClassName;\r
+        }\r
+        \r
+        int size = msa.getLibraryClassDefinitions().getLibraryClassList().size();\r
+               \r
+               for (int i = 0; i < size; i++) {\r
+            LibraryClassDocument.LibraryClass libClass = msa.getLibraryClassDefinitions().getLibraryClassList().get(i);\r
+            if (usage.equals(libClass.getUsage().toString())) {\r
+                libraryClassName.add(libClass.getKeyword());\r
+            }\r
                }\r
+        \r
                return libraryClassName;\r
        }\r
 \r