]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1.change GlobalData to WorkspaceProfile.
authorjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 19 Aug 2006 01:33:26 +0000 (01:33 +0000)
committerjlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524>
Sat, 19 Aug 2006 01:33:26 +0000 (01:33 +0000)
2.change pcd adding rule to use existing item type and value for the same pcd entry.
3.focus on added modules in sorted display.
4.fix the bug of not editable value if change item type to fixed at build.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1326 6f19259b-4bc3-4df7-8a09-765794883524

13 files changed:
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdDynamicPcdBuildDefinitions.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/TableSorter.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/Spd.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/SurfaceAreaQuery.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java [new file with mode: 0644]
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/id/ModuleIdentification.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/id/PackageIdentification.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/id/PlatformIdentification.java

index d1363f7cbd02c989d004c2a51176f1f69cebb739..2a52e3121e324360eb5a581be754f6e433417d3f 100644 (file)
@@ -52,7 +52,7 @@ import org.tianocore.frameworkwizard.common.ui.IInternalFrame;
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
 import org.tianocore.frameworkwizard.platform.ui.ListEditor;\r
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
 import org.tianocore.frameworkwizard.platform.ui.ListEditor;\r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
@@ -920,19 +920,19 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     private void getLibInstances(String libClass){\r
         libNameGuidMap.clear();\r
         try {\r
     private void getLibInstances(String libClass){\r
         libNameGuidMap.clear();\r
         try {\r
-            GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
+            WorkspaceProfile.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
         \r
         \r
-            Set<PackageIdentification> spi = GlobalData.getPackageList();\r
+            Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
             Iterator ispi = spi.iterator();\r
             \r
             while (ispi.hasNext()) {\r
                 PackageIdentification pi = (PackageIdentification) ispi.next();\r
 \r
             Iterator ispi = spi.iterator();\r
             \r
             while (ispi.hasNext()) {\r
                 PackageIdentification pi = (PackageIdentification) ispi.next();\r
 \r
-                Set<ModuleIdentification> smi = GlobalData.getModules(pi);\r
+                Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);\r
                 Iterator ismi = smi.iterator();\r
                 while (ismi.hasNext()) {\r
                     ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
                 Iterator ismi = smi.iterator();\r
                 while (ismi.hasNext()) {\r
                     ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
-                    Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
+                    Map<String, XmlObject> m = WorkspaceProfile.getNativeMsa(mi);\r
                     SurfaceAreaQuery.setDoc(m);\r
                     Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
                     for (int i = 0; i < classProduced.size(); ++i) {\r
                     SurfaceAreaQuery.setDoc(m);\r
                     Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
                     for (int i = 0; i < classProduced.size(); ++i) {\r
index c3a71e8d87752e9e83f7bfc3d60b29f19a8119ed..76a4dea0499b891532359cde4a1befc6b5cfc0d0 100644 (file)
@@ -909,8 +909,8 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{
             JOptionPane.showMessageDialog(frame, "C_Name is NOT C_NameType.");\r
             return false;\r
         }\r
             JOptionPane.showMessageDialog(frame, "C_Name is NOT C_NameType.");\r
             return false;\r
         }\r
-        if (!(DataValidation.isHexDoubleWordDataType(row[1].toString()) || \r
-                        DataValidation.isInt(row[1].toString(), 0, 0xffffffff))) {\r
+        if (!DataValidation.isHexDoubleWordDataType(row[1].toString()) && \r
+                        !DataValidation.isInt(row[1].toString(), Integer.MIN_VALUE, Integer.MAX_VALUE)) {\r
             JOptionPane.showMessageDialog(frame, "Token is NOT correct.");\r
             return false;\r
         }\r
             JOptionPane.showMessageDialog(frame, "Token is NOT correct.");\r
             return false;\r
         }\r
index 416889aba5db236ff45418fa4a50dc5a94b982ab..23378ccbb45eae396ae5ed4d403880efdaa97568 100644 (file)
@@ -481,6 +481,12 @@ public class FpdDynamicPcdBuildDefinitions extends IInternalFrame {
                         return;\r
                     }\r
                     else{\r
                         return;\r
                     }\r
                     else{\r
+                        jTextFieldDefaultValue.setText("");\r
+                        jTextFieldVpdOffset.setText("");\r
+                        jTextFieldVarName.setText("");\r
+                        jTextFieldVarGuid.setText("");\r
+                        jTextFieldVarOffset.setText("");\r
+                        jTextFieldHiiDefaultValue.setText("");\r
                         int selected = lsm.getMinSelectionIndex();\r
                         displaySkuInfoDetails(selected);\r
                     }\r
                         int selected = lsm.getMinSelectionIndex();\r
                         displaySkuInfoDetails(selected);\r
                     }\r
index 2b1cffe8909f5299e4999bf2040d3208940666f2..a11a63598e606fe55739cf96a4f496afa7d74248 100644 (file)
@@ -57,7 +57,8 @@ import org.tianocore.LicenseDocument;
 import org.tianocore.PlatformHeaderDocument;\r
 import org.tianocore.SkuInfoDocument;\r
 import org.tianocore.UserDefinedAntTasksDocument;\r
 import org.tianocore.PlatformHeaderDocument;\r
 import org.tianocore.SkuInfoDocument;\r
 import org.tianocore.UserDefinedAntTasksDocument;\r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
+import org.tianocore.UserExtensionsDocument;\r
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
@@ -88,6 +89,8 @@ public class FpdFileContents {
     \r
     private HashMap<String, ArrayList<String>> dynPcdMap = null;\r
     \r
     \r
     private HashMap<String, ArrayList<String>> dynPcdMap = null;\r
     \r
+    private HashMap<String, String> defaultPcdValue = new HashMap<String, String>();\r
+    \r
     /**\r
      * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.\r
      */\r
     /**\r
      * look through all pcd data in all ModuleSA, create pcd -> ModuleSA mappings.\r
      */\r
@@ -329,19 +332,19 @@ public class FpdFileContents {
         int libCount = getLibraryInstancesCount(moduleKey);\r
         String[][] saaLib = new String[libCount][5];\r
         getLibraryInstances(moduleKey, saaLib);\r
         int libCount = getLibraryInstancesCount(moduleKey);\r
         String[][] saaLib = new String[libCount][5];\r
         getLibraryInstances(moduleKey, saaLib);\r
-        ModuleIdentification mi = GlobalData.getModuleId(moduleKey);\r
+        ModuleIdentification mi = WorkspaceProfile.getModuleId(moduleKey);\r
         Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r
         vMi.add(mi);\r
         try {\r
     nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {\r
         Vector<ModuleIdentification> vMi = new Vector<ModuleIdentification>();\r
         vMi.add(mi);\r
         try {\r
     nextPcd:for (int i = 0; i < saaModuleSaPcd.length; ++i) {\r
-                if (GlobalData.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], mi)){\r
+                if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], mi)){\r
                     continue;\r
                 }\r
                 for (int j = 0; j < saaLib.length; ++j) {\r
                     String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];\r
                     continue;\r
                 }\r
                 for (int j = 0; j < saaLib.length; ++j) {\r
                     String libKey = saaLib[j][1] + " " + saaLib[j][2] + " " + saaLib[j][3] + " " + saaLib[j][4];\r
-                    ModuleIdentification libMi = GlobalData.getModuleId(libKey);\r
+                    ModuleIdentification libMi = WorkspaceProfile.getModuleId(libKey);\r
                     vMi.add(libMi);\r
                     vMi.add(libMi);\r
-                    if (GlobalData.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], libMi)) {\r
+                    if (WorkspaceProfile.pcdInMsa(saaModuleSaPcd[i][0], saaModuleSaPcd[i][1], libMi)) {\r
                         continue nextPcd;\r
                     }\r
                 }\r
                         continue nextPcd;\r
                     }\r
                 }\r
@@ -358,7 +361,7 @@ public class FpdFileContents {
         try {\r
        \r
             for (int i = 0; i < vMi.size(); ++i) {\r
         try {\r
        \r
             for (int i = 0; i < vMi.size(); ++i) {\r
-                ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) GlobalData\r
+                ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile\r
                                                                                                                           .getModuleXmlObject(vMi\r
                                                                                                                                                  .get(i));\r
                 if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {\r
                                                                                                                           .getModuleXmlObject(vMi\r
                                                                                                                                                  .get(i));\r
                 if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {\r
@@ -428,6 +431,7 @@ public class FpdFileContents {
         }\r
 \r
         if (al.size() == 0) {\r
         }\r
 \r
         if (al.size() == 0) {\r
+            defaultPcdValue.remove(pcdKey);\r
             dynPcdMap.remove(pcdKey);\r
             String[] s1 = pcdKey.split(" ");\r
             removeDynamicPcdBuildData(s1[0], s1[1]);\r
             dynPcdMap.remove(pcdKey);\r
             String[] s1 = pcdKey.split(" ");\r
             removeDynamicPcdBuildData(s1[0], s1[1]);\r
@@ -516,6 +520,7 @@ public class FpdFileContents {
                         pcdData.setMaxDatumSize(new Integer(maxSize));\r
                     }\r
                     pcdData.setValue(value);\r
                         pcdData.setMaxDatumSize(new Integer(maxSize));\r
                     }\r
                     pcdData.setValue(value);\r
+                    defaultPcdValue.put(cName + " " + tsGuid, value);\r
                     break;\r
                 }\r
             }\r
                     break;\r
                 }\r
             }\r
@@ -533,7 +538,7 @@ public class FpdFileContents {
     public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String tsGuid, String[] sa) throws Exception{\r
         try {\r
            \r
     public boolean getPcdBuildDataInfo(ModuleIdentification mi, String cName, String tsGuid, String[] sa) throws Exception{\r
         try {\r
            \r
-            ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r
+            ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);\r
             if (msa.getPcdCoded() == null) {\r
                 return false;\r
             }\r
             if (msa.getPcdCoded() == null) {\r
                 return false;\r
             }\r
@@ -586,7 +591,7 @@ public class FpdFileContents {
      */\r
     public void removePcdData(String moduleKey, ModuleIdentification consumer) {\r
         try {\r
      */\r
     public void removePcdData(String moduleKey, ModuleIdentification consumer) {\r
         try {\r
-            ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(consumer);\r
+            ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(consumer);\r
             if (msa.getPcdCoded() == null) {\r
                 return;\r
             }\r
             if (msa.getPcdCoded() == null) {\r
                 return;\r
             }\r
@@ -704,7 +709,7 @@ public class FpdFileContents {
         XmlCursor cursor = instance.newCursor();\r
         try{\r
             String comment = "Pkg: " + pn + " Mod: " + mn \r
         XmlCursor cursor = instance.newCursor();\r
         try{\r
             String comment = "Pkg: " + pn + " Mod: " + mn \r
-                + " Path: " + GlobalData.getMsaFile(libMi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+                + " Path: " + WorkspaceProfile.getMsaFile(libMi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
             cursor.insertComment(comment);\r
         }\r
         catch (Exception e){\r
             cursor.insertComment(comment);\r
         }\r
         catch (Exception e){\r
@@ -888,7 +893,7 @@ public class FpdFileContents {
                 moduleSa = genModuleSA(mi, arch);\r
             }\r
             \r
                 moduleSa = genModuleSA(mi, arch);\r
             }\r
             \r
-            ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r
+            ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);\r
             if (msa.getPcdCoded() == null) {\r
                 return;\r
             }\r
             if (msa.getPcdCoded() == null) {\r
                 return;\r
             }\r
@@ -932,7 +937,7 @@ public class FpdFileContents {
         Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
         PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;\r
         for (int i = 0; i < depPkgs.length; ++i) {\r
         Map<String, XmlObject> m = new HashMap<String, XmlObject>();\r
         PcdDeclarationsDocument.PcdDeclarations.PcdEntry spdPcd = null;\r
         for (int i = 0; i < depPkgs.length; ++i) {\r
-            m.put("PackageSurfaceArea", GlobalData.getPackageXmlObject(depPkgs[i]));\r
+            m.put("PackageSurfaceArea", WorkspaceProfile.getPackageXmlObject(depPkgs[i]));\r
             SurfaceAreaQuery.setDoc(m);\r
             XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations();\r
             if (xo == null) {\r
             SurfaceAreaQuery.setDoc(m);\r
             XmlObject[] xo = SurfaceAreaQuery.getSpdPcdDeclarations();\r
             if (xo == null) {\r
@@ -958,12 +963,12 @@ public class FpdFileContents {
     }\r
     \r
     private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {\r
     }\r
     \r
     private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {\r
-        PackageIdentification pi = GlobalData.getPackageForModule(mi);\r
+        PackageIdentification pi = WorkspaceProfile.getPackageForModule(mi);\r
         ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();\r
         XmlCursor cursor = msa.newCursor();\r
         try{\r
             String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: "\r
         ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();\r
         XmlCursor cursor = msa.newCursor();\r
         try{\r
             String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: "\r
-                            + GlobalData.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
+                            + WorkspaceProfile.getMsaFile(mi).getPath().substring(System.getenv("WORKSPACE").length() + 1);\r
             cursor.insertComment(comment);\r
         }\r
         catch(Exception e){\r
             cursor.insertComment(comment);\r
         }\r
         catch(Exception e){\r
@@ -998,41 +1003,19 @@ public class FpdFileContents {
         if (pcdConsumer == null) {\r
             pcdConsumer = new ArrayList<String>();\r
         }\r
         if (pcdConsumer == null) {\r
             pcdConsumer = new ArrayList<String>();\r
         }\r
+        //\r
+        // Using existing Pcd type, if this pcd already exists in other ModuleSA\r
+        //\r
+        if (pcdConsumer.size() > 0) {\r
+            String[] valPart = pcdConsumer.get(0).split(" ");\r
+            itemType = valPart[5];\r
+        }\r
         String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() \r
         + " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList())\r
         + " " + itemType;\r
         pcdConsumer.add(listValue);\r
         dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);\r
         String listValue = moduleSa.getModuleGuid() + " " + moduleSa.getModuleVersion() \r
         + " " + moduleSa.getPackageGuid() + " " + moduleSa.getPackageVersion() + " " + listToString(moduleSa.getSupArchList())\r
         + " " + itemType;\r
         pcdConsumer.add(listValue);\r
         dynPcdMap.put(cName + " " + tsGuid, pcdConsumer);\r
-        //\r
-        // Special dynamic type, if this pcd already exists in other ModuleSA\r
-        //\r
-        /* Comment out Item type checking temporarily.\r
-        if (itemType.equals("DYNAMIC")) {\r
-            \r
-            ListIterator li = pcdConsumer.listIterator();\r
-            while(li.hasNext()) {\r
-                String value = li.next().toString();\r
-                String[] valuePart= value.split(" ");\r
-                if (!valuePart[5].equals("DYNAMIC")) {\r
-                    //ToDo error for same pcd, other type than dynamic\r
-                    pcdConsumer.remove(listValue);\r
-                    throw new PcdItemTypeConflictException(cName, value);\r
-                }\r
-            }\r
-        }\r
-        else {\r
-            ListIterator li = pcdConsumer.listIterator();\r
-            while(li.hasNext()) {\r
-                String value = li.next().toString();\r
-                String[] valuePart= value.split(" ");\r
-                if (valuePart[5].equals("DYNAMIC")) {\r
-                    //ToDo error for same pcd, other type than non-dynamic\r
-                    pcdConsumer.remove(listValue);\r
-                    throw new PcdItemTypeConflictException(cName, value);\r
-                }\r
-            }\r
-        }\r
-        */\r
+        \r
         PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();\r
         fpdPcd.setCName(cName);\r
         fpdPcd.setToken(token);\r
         PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData fpdPcd = moduleSa.getPcdBuildDefinition().addNewPcdData();\r
         fpdPcd.setCName(cName);\r
         fpdPcd.setToken(token);\r
@@ -1054,6 +1037,16 @@ public class FpdFileContents {
                 fpdPcd.setValue("");\r
             }\r
         }\r
                 fpdPcd.setValue("");\r
             }\r
         }\r
+        //\r
+        // Using existing pcd value, if this pcd already exists in other moduleSa.\r
+        //\r
+        if (defaultPcdValue.get(cName + " " + tsGuid) == null) {\r
+            defaultPcdValue.put(cName + " " + tsGuid, fpdPcd.getValue());\r
+        }\r
+        else {\r
+            fpdPcd.setValue(defaultPcdValue.get(cName + " " + tsGuid));\r
+        }\r
+        \r
         if (dataType.equals("UINT8")){\r
             fpdPcd.setMaxDatumSize(1);\r
         }\r
         if (dataType.equals("UINT8")){\r
             fpdPcd.setMaxDatumSize(1);\r
         }\r
@@ -1085,44 +1078,7 @@ public class FpdFileContents {
                 addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);\r
             }\r
         }\r
                 addDynamicPcdBuildData(cName, token, tsGuid, itemType, dataType, defaultVal);\r
             }\r
         }\r
-        else {\r
-            /*\r
-            if (defaultVal != null){\r
-                fpdPcd.setValue(defaultVal);\r
-            }\r
-            else {\r
-                if (dataType.equals("UINT8") || dataType.equals("UINT16") || dataType.equals("UINT32") || dataType.equals("UINT64")) {\r
-                    fpdPcd.setValue("0");\r
-                }\r
-                if (dataType.equals("BOOLEAN")){\r
-                    fpdPcd.setValue("false");\r
-                }\r
-                if (dataType.equals("VOID*")) {\r
-                    fpdPcd.setValue("");\r
-                }\r
-            }\r
-            \r
-            if (dataType.equals("UINT8")){\r
-                fpdPcd.setMaxDatumSize(1);\r
-            }\r
-            if (dataType.equals("UINT16")) {\r
-                fpdPcd.setMaxDatumSize(2);\r
-            }\r
-            if (dataType.equals("UINT32")) {\r
-                fpdPcd.setMaxDatumSize(4);\r
-            }\r
-            if (dataType.equals("UINT64")){\r
-                fpdPcd.setMaxDatumSize(8);\r
-            }\r
-            if (dataType.equals("BOOLEAN")){\r
-                fpdPcd.setMaxDatumSize(1);\r
-            }\r
-            if (dataType.equals("VOID*")) {\r
-                int maxSize = setMaxSizeForPointer(fpdPcd.getValue());\r
-                fpdPcd.setMaxDatumSize(maxSize);\r
-            }\r
-            */\r
-        }\r
+        \r
     }\r
     \r
     public int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{\r
     }\r
     \r
     public int setMaxSizeForPointer(String datum) throws PcdValueMalFormed{\r
@@ -1529,6 +1485,92 @@ public class FpdFileContents {
         return fpdBuildOpts;\r
     }\r
     \r
         return fpdBuildOpts;\r
     }\r
     \r
+    public void genBuildOptionsUserExtensions(String fvName, String infName, String outputFileName, String[][] includeModules) {\r
+        UserExtensionsDocument.UserExtensions userExts = getfpdBuildOpts().addNewUserExtensions();\r
+        userExts.setUserID("IMAGES");\r
+        userExts.setIdentifier(new BigInteger("1"));\r
+        XmlCursor cursor = userExts.newCursor();\r
+        cursor.toEndToken();\r
+        \r
+        cursor.beginElement("FvName");\r
+        cursor.insertChars(fvName);\r
+        cursor.toNextToken();\r
+        \r
+        cursor.beginElement("InfFileName");\r
+        cursor.insertChars(infName);\r
+        cursor.toNextToken();\r
+        \r
+        cursor.beginElement("IncludeModules");\r
+        for (int i = 0; i < includeModules.length; ++i) {\r
+            cursor.beginElement("Module");\r
+            cursor.insertAttributeWithValue("ModuleGuid", includeModules[i][0]);\r
+            cursor.insertAttributeWithValue("BaseName", includeModules[i][1]);\r
+            cursor.toEndToken();\r
+            cursor.toNextToken();\r
+        }\r
+        cursor.dispose();\r
+    }\r
+    \r
+    public int getUserExtsIncModCount (String fvName) {\r
+        if (getfpdBuildOpts().getUserExtensionsList() == null) {\r
+            return -1;\r
+        }\r
+        ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();\r
+        while (li.hasNext()) {\r
+            UserExtensionsDocument.UserExtensions ues = li.next();\r
+            if (!ues.getUserID().equals("IMAGES")) {\r
+                continue;\r
+            }\r
+            XmlCursor cursor = ues.newCursor();\r
+            cursor.toFirstChild();\r
+            String elementName = cursor.getTextValue();\r
+            if (elementName.equals(fvName)) {\r
+                cursor.toNextSibling(new QName("", "IncludeModules"));\r
+                if (cursor.toFirstChild()) {\r
+                    int i = 1;\r
+                    for (i = 1; cursor.toNextSibling(); ++i);\r
+                    cursor.dispose();\r
+                    return i;\r
+                }\r
+                cursor.dispose();\r
+                return 0;\r
+            }\r
+            cursor.dispose();\r
+        }\r
+        return -1;\r
+    }\r
+    \r
+    public void getUserExtsIncMods(String fvName, String[][] saa) {\r
+        if (getfpdBuildOpts().getUserExtensionsList() == null) {\r
+            return;\r
+        }\r
+        ListIterator<UserExtensionsDocument.UserExtensions> li = getfpdBuildOpts().getUserExtensionsList().listIterator();\r
+        while (li.hasNext()) {\r
+            UserExtensionsDocument.UserExtensions ues = li.next();\r
+            if (!ues.getUserID().equals("IMAGES")) {\r
+                continue;\r
+            }\r
+            XmlCursor cursor = ues.newCursor();\r
+            cursor.toFirstChild();\r
+            String elementName = cursor.getTextValue();\r
+            if (elementName.equals(fvName)) {\r
+                cursor.toNextSibling(new QName("", "IncludeModules"));\r
+                if (cursor.toFirstChild()) {\r
+                    int i = 0;\r
+                    do {\r
+                        saa[i][0] = cursor.getAttributeText(new QName("ModuleGuid"));\r
+                        saa[i][1] = cursor.getAttributeText(new QName("BaseName"));\r
+                        ++i;\r
+                    }while (cursor.toNextSibling());\r
+                }\r
+                cursor.dispose();\r
+                return;\r
+            }\r
+            cursor.dispose();\r
+        }\r
+        \r
+    }\r
+    \r
     public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {\r
         UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r
         if (udats == null) {\r
     public void genBuildOptionsUserDefAntTask (String id, String fileName, String execOrder) {\r
         UserDefinedAntTasksDocument.UserDefinedAntTasks udats = getfpdBuildOpts().getUserDefinedAntTasks();\r
         if (udats == null) {\r
@@ -2637,7 +2679,7 @@ class PcdItemTypeConflictException extends Exception {
     private String details = null;\r
     \r
     PcdItemTypeConflictException(String pcdName, String info){\r
     private String details = null;\r
     \r
     PcdItemTypeConflictException(String pcdName, String info){\r
-        ModuleIdentification mi = GlobalData.getModuleId(info);\r
+        ModuleIdentification mi = WorkspaceProfile.getModuleId(info);\r
         details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();\r
     }\r
     \r
         details = pcdName + " ItemType Conflicts with " + mi.getName() + " in Pkg " + mi.getPackage().getName();\r
     }\r
     \r
index 06d0d0da1942db92e78407a9d39184f11b6362a5..e0c1167925bb07095607dfa49e7527fc0e78d989 100644 (file)
@@ -16,7 +16,7 @@ import javax.swing.table.DefaultTableModel;
 import org.tianocore.PlatformSurfaceAreaDocument;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
 import org.tianocore.PlatformSurfaceAreaDocument;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
 \r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
 \r
@@ -326,7 +326,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     ModuleIdentification mi = miList.get(selectedRow);\r
                     Vector<String> vArchs = null;\r
                     try {\r
                     ModuleIdentification mi = miList.get(selectedRow);\r
                     Vector<String> vArchs = null;\r
                     try {\r
-                        vArchs = GlobalData.getModuleSupArchs(mi);\r
+                        vArchs = WorkspaceProfile.getModuleSupArchs(mi);\r
                     }\r
                     catch (Exception exp) {\r
                         JOptionPane.showMessageDialog(frame, exp.getMessage());\r
                     }\r
                     catch (Exception exp) {\r
                         JOptionPane.showMessageDialog(frame, exp.getMessage());\r
@@ -418,7 +418,9 @@ public class FpdFrameworkModules extends IInternalFrame {
                         s += " was added Successfully.";\r
                     }\r
                     JOptionPane.showMessageDialog(frame, s);\r
                         s += " was added Successfully.";\r
                     }\r
                     JOptionPane.showMessageDialog(frame, s);\r
-                    jTableFpdModules.changeSelection(modelFpdModules.getRowCount() - 1, 0, false, false);\r
+                    TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel();\r
+                    int viewIndex = sorterFpdModules.getModelToView()[modelFpdModules.getRowCount() - 1];\r
+                    jTableFpdModules.changeSelection(viewIndex, 0, false, false);\r
                 }\r
             });\r
         }\r
                 }\r
             });\r
         }\r
@@ -591,7 +593,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     String pg = sa[ffcPkgGuid];\r
                     String pv = sa[ffcPkgVer];\r
                     String arch = sa[ffcModArch];\r
                     String pg = sa[ffcPkgGuid];\r
                     String pv = sa[ffcPkgVer];\r
                     String arch = sa[ffcModArch];\r
-                    ModuleIdentification mi = GlobalData.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);\r
+                    ModuleIdentification mi = WorkspaceProfile.getModuleId(mg + " " + mv + " " + pg + " " + pv + " " + arch);\r
                     mv = mi.getVersion();\r
                     pv = mi.getPackage().getVersion();\r
                     modelFpdModules.removeRow(selectedRow);\r
                     mv = mi.getVersion();\r
                     pv = mi.getPackage().getVersion();\r
                     modelFpdModules.removeRow(selectedRow);\r
@@ -644,7 +646,7 @@ public class FpdFrameworkModules extends IInternalFrame {
 \r
     private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
         try {\r
 \r
     private void init(PlatformSurfaceAreaDocument.PlatformSurfaceArea fpd) {\r
         try {\r
-            GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
+            WorkspaceProfile.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
         }\r
         catch(Exception e){\r
             JOptionPane.showMessageDialog(frame, "Error occurred when getting module data.");\r
         }\r
         catch(Exception e){\r
             JOptionPane.showMessageDialog(frame, "Error occurred when getting module data.");\r
@@ -663,7 +665,7 @@ public class FpdFrameworkModules extends IInternalFrame {
             String[][] saa = new String[ffc.getFrameworkModulesCount()][5];\r
             ffc.getFrameworkModulesInfo(saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
             String[][] saa = new String[ffc.getFrameworkModulesCount()][5];\r
             ffc.getFrameworkModulesInfo(saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
-                ModuleIdentification mi = GlobalData.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "\r
+                ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][ffcModGuid] + " " + saa[i][ffcModVer] + " "\r
                                                                  + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);\r
                 String[] row = { "", "", "", "", "", "", "" };\r
                 if (mi != null) {\r
                                                                  + saa[i][ffcPkgGuid] + " " + saa[i][ffcPkgVer]);\r
                 String[] row = { "", "", "", "", "", "", "" };\r
                 if (mi != null) {\r
@@ -674,14 +676,13 @@ public class FpdFrameworkModules extends IInternalFrame {
                     row[pkgVerColForFpdModTable] = mi.getPackage().getVersion();\r
                     row[archColForFpdModTable] = saa[i][ffcModArch];\r
                     try {\r
                     row[pkgVerColForFpdModTable] = mi.getPackage().getVersion();\r
                     row[archColForFpdModTable] = saa[i][ffcModArch];\r
                     try {\r
-                        row[pathColForFpdModTable] = GlobalData.getMsaFile(mi).getPath().substring(\r
+                        row[pathColForFpdModTable] = WorkspaceProfile.getMsaFile(mi).getPath().substring(\r
                                                                                       System.getenv("WORKSPACE")\r
                                                                                             .length() + 1);\r
                     } catch (Exception e) {\r
                         JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage());\r
                     }\r
                     \r
                                                                                       System.getenv("WORKSPACE")\r
                                                                                             .length() + 1);\r
                     } catch (Exception e) {\r
                         JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage());\r
                     }\r
                     \r
-                    modelFpdModules.addRow(row);\r
                     String fpdMsaKey = saa[i][ffcModGuid] + row[modVerColForFpdModTable]\r
                                                                 + saa[i][ffcPkgGuid] + row[pkgVerColForFpdModTable];\r
                     ArrayList<String> al = fpdMsa.get(fpdMsaKey);\r
                     String fpdMsaKey = saa[i][ffcModGuid] + row[modVerColForFpdModTable]\r
                                                                 + saa[i][ffcPkgGuid] + row[pkgVerColForFpdModTable];\r
                     ArrayList<String> al = fpdMsa.get(fpdMsaKey);\r
@@ -691,7 +692,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                     }\r
                     al.add(saa[i][ffcModArch]);\r
                 }\r
                     }\r
                     al.add(saa[i][ffcModArch]);\r
                 }\r
-                \r
+                modelFpdModules.addRow(row);\r
 \r
             }\r
             TableSorter sorter = (TableSorter)jTableFpdModules.getModel();\r
 \r
             }\r
             TableSorter sorter = (TableSorter)jTableFpdModules.getModel();\r
@@ -707,14 +708,14 @@ public class FpdFrameworkModules extends IInternalFrame {
         if (miList == null) {\r
             miList = new ArrayList<ModuleIdentification>();\r
         }\r
         if (miList == null) {\r
             miList = new ArrayList<ModuleIdentification>();\r
         }\r
-        Set<PackageIdentification> spi = GlobalData.getPackageList();\r
+        Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
         Iterator ispi = spi.iterator();\r
 \r
         while (ispi.hasNext()) {\r
             PackageIdentification pi = (PackageIdentification) ispi.next();\r
             String[] s = { "", "", "", "", "", "" };\r
 \r
         Iterator ispi = spi.iterator();\r
 \r
         while (ispi.hasNext()) {\r
             PackageIdentification pi = (PackageIdentification) ispi.next();\r
             String[] s = { "", "", "", "", "", "" };\r
 \r
-            Set<ModuleIdentification> smi = GlobalData.getModules(pi);\r
+            Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);\r
             Iterator ismi = smi.iterator();\r
             while (ismi.hasNext()) {\r
                 ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
             Iterator ismi = smi.iterator();\r
             while (ismi.hasNext()) {\r
                 ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
@@ -724,7 +725,7 @@ public class FpdFrameworkModules extends IInternalFrame {
                 s[pkgNameColForAllModTable] = pi.getName();\r
                 s[pkgVerColForAllModTable] = pi.getVersion();\r
                 try {\r
                 s[pkgNameColForAllModTable] = pi.getName();\r
                 s[pkgVerColForAllModTable] = pi.getVersion();\r
                 try {\r
-                    s[pathColForAllModTable] = GlobalData.getMsaFile(mi).getPath()\r
+                    s[pathColForAllModTable] = WorkspaceProfile.getMsaFile(mi).getPath()\r
                                             .substring(System.getenv("WORKSPACE").length() + 1);\r
                 } catch (Exception e) {\r
                     JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage());\r
                                             .substring(System.getenv("WORKSPACE").length() + 1);\r
                 } catch (Exception e) {\r
                     JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage());\r
index a34fa5a28a7e625f499992241d9cfcccedfa6eb7..ed3b6e20297bbcea4b09bf9c5d18b647dc0a7320 100644 (file)
@@ -25,7 +25,7 @@ import javax.swing.table.TableModel;
 \r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
 \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
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
 import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
 import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
@@ -151,6 +151,10 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         // display pcd for key.\r
         //\r
         model.setRowCount(0);\r
         // display pcd for key.\r
         //\r
         model.setRowCount(0);\r
+        jTextAreaPcdHelp.setText("");\r
+        jComboBoxItemType.setSelectedIndex(-1);\r
+        jTextFieldMaxDatumSize.setText("");\r
+        jTextFieldPcdDefault.setText("");\r
         int pcdCount = ffc.getPcdDataCount(i);\r
         if (pcdCount != 0) {\r
             String[][] saa = new String[pcdCount][7];\r
         int pcdCount = ffc.getPcdDataCount(i);\r
         if (pcdCount != 0) {\r
             String[][] saa = new String[pcdCount][7];\r
@@ -175,7 +179,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
             String[][] saa = new String[instanceCount][5];\r
             ffc.getLibraryInstances(key, saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
             String[][] saa = new String[instanceCount][5];\r
             ffc.getLibraryInstances(key, saa);\r
             for (int i = 0; i < saa.length; ++i) {\r
-                ModuleIdentification mi = GlobalData.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
+                ModuleIdentification mi = WorkspaceProfile.getModuleId(saa[i][1] + " " + saa[i][2] + " " + saa[i][3] + " " + saa[i][4]);\r
                 if (mi != null) {\r
                     saa[i][0] = mi.getName();\r
                     saa[i][2] = mi.getVersion();\r
                 if (mi != null) {\r
                     saa[i][0] = mi.getName();\r
                     saa[i][2] = mi.getVersion();\r
@@ -221,7 +225,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     }\r
     \r
     private void resolveLibraryInstances(String key) {\r
     }\r
     \r
     private void resolveLibraryInstances(String key) {\r
-        ModuleIdentification mi = GlobalData.getModuleId(key);\r
+        ModuleIdentification mi = WorkspaceProfile.getModuleId(key);\r
         PackageIdentification[] depPkgList = null;\r
         try{\r
             //\r
         PackageIdentification[] depPkgList = null;\r
         try{\r
             //\r
@@ -288,7 +292,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         ArrayList<String> al = new ArrayList<String>();\r
         \r
         for (int i = 0; i < depPkgList.length; ++i) {\r
         ArrayList<String> al = new ArrayList<String>();\r
         \r
         for (int i = 0; i < depPkgList.length; ++i) {\r
-            Set<ModuleIdentification> smi = GlobalData.getModules(depPkgList[i]);\r
+            Set<ModuleIdentification> smi = WorkspaceProfile.getModules(depPkgList[i]);\r
             Iterator ismi = smi.iterator();\r
             while(ismi.hasNext()) {\r
                 ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
             Iterator ismi = smi.iterator();\r
             while(ismi.hasNext()) {\r
                 ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
@@ -319,7 +323,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
     }\r
     \r
     private void removeInstance(String key) {\r
     }\r
     \r
     private void removeInstance(String key) {\r
-        ModuleIdentification mi = GlobalData.getModuleId(key); \r
+        ModuleIdentification mi = WorkspaceProfile.getModuleId(key); \r
         //\r
         // remove pcd information of instance from current ModuleSA\r
         //\r
         //\r
         // remove pcd information of instance from current ModuleSA\r
         //\r
@@ -629,11 +633,11 @@ public class FpdModuleSA extends JDialog implements ActionListener {
         ffc.getLibraryInstances(moduleKey, saa);\r
         \r
         try{\r
         ffc.getLibraryInstances(moduleKey, saa);\r
         \r
         try{\r
-            if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(moduleKey), cName, tsGuid, sa)) {\r
+            if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(moduleKey), cName, tsGuid, sa)) {\r
                 return;\r
             }\r
             for (int j = 0; j < saa.length; ++j) {\r
                 return;\r
             }\r
             for (int j = 0; j < saa.length; ++j) {\r
-                if (ffc.getPcdBuildDataInfo(GlobalData.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),\r
+                if (ffc.getPcdBuildDataInfo(WorkspaceProfile.getModuleId(saa[j][1] + " " + saa[j][2] + " " + saa[j][3] + " " + saa[j][4]),\r
                                             cName, tsGuid, sa)) {\r
                     return;\r
                 }\r
                                             cName, tsGuid, sa)) {\r
                     return;\r
                 }\r
@@ -841,8 +845,8 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                         while(li.hasNext()) {\r
                             String instance = li.next();\r
                             String[] s = {"", "", "", "", ""};\r
                         while(li.hasNext()) {\r
                             String instance = li.next();\r
                             String[] s = {"", "", "", "", ""};\r
-                            if (GlobalData.getModuleId(instance) != null) {\r
-                                s[0] = GlobalData.getModuleId(instance).getName();\r
+                            if (WorkspaceProfile.getModuleId(instance) != null) {\r
+                                s[0] = WorkspaceProfile.getModuleId(instance).getName();\r
                             }\r
                             \r
                             String[] instancePart = instance.split(" ");\r
                             }\r
                             \r
                             String[] instancePart = instance.split(" ");\r
@@ -981,7 +985,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
                     libInstanceTableModel.getValueAt(row, 2) + " " +\r
                     libInstanceTableModel.getValueAt(row, 3) + " " +\r
                     libInstanceTableModel.getValueAt(row, 4);\r
                     libInstanceTableModel.getValueAt(row, 2) + " " +\r
                     libInstanceTableModel.getValueAt(row, 3) + " " +\r
                     libInstanceTableModel.getValueAt(row, 4);\r
-                    ModuleIdentification libMi = GlobalData.getModuleId(instanceValue);\r
+                    ModuleIdentification libMi = WorkspaceProfile.getModuleId(instanceValue);\r
                     ffc.genLibraryInstance(libMi, moduleKey);\r
                     //\r
                     // Add pcd information of selected instance to current moduleSA\r
                     ffc.genLibraryInstance(libMi, moduleKey);\r
                     //\r
                     // Add pcd information of selected instance to current moduleSA\r
@@ -1438,6 +1442,10 @@ private JComboBox getJComboBoxItemType() {
                 if (jComboBoxItemType.getItemCount() == 3) {\r
                     if (!jComboBoxItemType.getSelectedItem().equals("DYNAMIC")) {\r
                         pcdDynamicToNonDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+"");\r
                 if (jComboBoxItemType.getItemCount() == 3) {\r
                     if (!jComboBoxItemType.getSelectedItem().equals("DYNAMIC")) {\r
                         pcdDynamicToNonDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+"");\r
+                        if (jComboBoxItemType.getSelectedItem().equals("FIXED_AT_BUILD")) {\r
+                            jTextFieldPcdDefault.setText("");\r
+                            jTextFieldPcdDefault.setEnabled(true);\r
+                        }\r
                     }\r
                     else{\r
                         pcdNonDynamicToDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+"");\r
                     }\r
                     else{\r
                         pcdNonDynamicToDynamic(jTablePcd.getValueAt(row, 0)+"", jTablePcd.getValueAt(row, 1)+"");\r
index d7f1f13e10a4f68677e75e3c70a3175c0c185b76..2453f12a1cf91f7dc45acfb440a0fc6f64013169 100644 (file)
@@ -158,7 +158,7 @@ public class TableSorter extends AbstractTableModel {
         return getViewToModel()[viewIndex].modelIndex;
     }
 
         return getViewToModel()[viewIndex].modelIndex;
     }
 
-    private int[] getModelToView() {
+    public int[] getModelToView() {
         if (modelToView == null) {
             int n = getViewToModel().length;
             modelToView = new int[n];
         if (modelToView == null) {
             int n = getViewToModel().length;
             modelToView = new int[n];
index 914c5bf1cd34b038f2c3c2d10f4b55620f7f64e3..0a8f3356fd9f676564426d498142979e55b220fb 100644 (file)
@@ -79,7 +79,7 @@ public class Spd {
                 if (!msaFile.exists()) {\r
                     continue;\r
                 }\r
                 if (!msaFile.exists()) {\r
                     continue;\r
                 }\r
-                Map<String, XmlObject> msaDoc = GlobalData.getNativeMsa( msaFile );\r
+                Map<String, XmlObject> msaDoc = WorkspaceProfile.getNativeMsa( msaFile );\r
                 SurfaceAreaQuery.push(msaDoc);\r
                 ModuleIdentification moduleId = SurfaceAreaQuery.getMsaHeader();\r
                 SurfaceAreaQuery.pop();\r
                 SurfaceAreaQuery.push(msaDoc);\r
                 ModuleIdentification moduleId = SurfaceAreaQuery.getMsaHeader();\r
                 SurfaceAreaQuery.pop();\r
index 7e709706f4b71c87be9a9ef5e082db6166d969c7..ac081431a6eacfe05b7f35f4cb0a72d3e0d189df 100644 (file)
@@ -349,7 +349,7 @@ public class SurfaceAreaQuery {
                String packageGuid = null;\r
                String packageVersion = null;\r
 \r
                String packageGuid = null;\r
                String packageVersion = null;\r
 \r
-        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) GlobalData.getModuleXmlObject(mi);\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea) WorkspaceProfile.getModuleXmlObject(mi);\r
         if (msa.getPackageDependencies() == null) {\r
             return new PackageIdentification[0];\r
         }\r
         if (msa.getPackageDependencies() == null) {\r
             return new PackageIdentification[0];\r
         }\r
@@ -365,7 +365,7 @@ public class SurfaceAreaQuery {
                        packageGuid = item.getPackageGuid();\r
                        packageVersion = item.getPackageVersion();\r
 \r
                        packageGuid = item.getPackageGuid();\r
                        packageVersion = item.getPackageVersion();\r
 \r
-            Set<PackageIdentification> spi = GlobalData.getPackageList();\r
+            Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
             Iterator<PackageIdentification> ispi = spi.iterator();\r
             String ver = "";\r
             while(ispi.hasNext()) {\r
             Iterator<PackageIdentification> ispi = spi.iterator();\r
             String ver = "";\r
             while(ispi.hasNext()) {\r
@@ -404,7 +404,7 @@ public class SurfaceAreaQuery {
         * @returns null if nothing is there\r
         */\r
        public static Vector<String> getLibraryClasses(String usage, ModuleIdentification mi) throws Exception{\r
         * @returns null if nothing is there\r
         */\r
        public static Vector<String> getLibraryClasses(String usage, ModuleIdentification mi) throws Exception{\r
-        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi);\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)WorkspaceProfile.getModuleXmlObject(mi);\r
         Vector<String> libraryClassName = new Vector<String>();\r
         if (msa.getLibraryClassDefinitions() == null) {\r
             return libraryClassName;\r
         Vector<String> libraryClassName = new Vector<String>();\r
         if (msa.getLibraryClassDefinitions() == null) {\r
             return libraryClassName;\r
@@ -1018,7 +1018,7 @@ public class SurfaceAreaQuery {
                if (returns == null) {\r
                        return packageIncludeMap;\r
                }\r
                if (returns == null) {\r
                        return packageIncludeMap;\r
                }\r
-               GlobalData.log.info("" + returns[0].getClass().getName());\r
+               WorkspaceProfile.log.info("" + returns[0].getClass().getName());\r
                for (int i = 0; i < returns.length; i++) {\r
                        PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i];\r
                        packageIncludeMap.put(includeHeader.getModuleType().toString(),\r
                for (int i = 0; i < returns.length; i++) {\r
                        PackageHeadersDocument.PackageHeaders.IncludePkgHeader includeHeader = (PackageHeadersDocument.PackageHeaders.IncludePkgHeader) returns[i];\r
                        packageIncludeMap.put(includeHeader.getModuleType().toString(),\r
diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/global/WorkspaceProfile.java
new file mode 100644 (file)
index 0000000..007df77
--- /dev/null
@@ -0,0 +1,508 @@
+/** @file\r
+  WorkspaceProfile class. \r
+  \r
+  WorkspaceProfile provide initializing, instoring, querying and update global data.\r
+  It is a bridge to intercommunicate between multiple component, such as AutoGen,\r
+  PCD and so on.   \r
\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+package org.tianocore.frameworkwizard.platform.ui.global;\r
+\r
+import org.apache.xmlbeans.XmlObject;\r
+import org.tianocore.DbPathAndFilename;\r
+import org.tianocore.FrameworkDatabaseDocument;\r
+import org.tianocore.ModuleSurfaceAreaDocument;\r
+import org.tianocore.PcdCodedDocument;\r
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
+import org.tianocore.frameworkwizard.platform.ui.id.FpdModuleIdentification;\r
+import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
+import org.tianocore.frameworkwizard.platform.ui.id.PlatformIdentification;\r
+\r
+import java.io.File;\r
+import java.util.Comparator;\r
+import java.util.HashMap;\r
+import java.util.HashSet;\r
+import java.util.Iterator;\r
+import java.util.List;\r
+import java.util.ListIterator;\r
+import java.util.Map;\r
+import java.util.Set;\r
+import java.util.Vector;\r
+import java.util.logging.Logger;\r
+\r
+/**\r
+  WorkspaceProfile provide initializing, instoring, querying and update global data.\r
+  It is a bridge to intercommunicate between multiple component, such as AutoGen,\r
+  PCD and so on. \r
+  \r
+  <p>Note that all global information are initialized incrementally. All data will \r
+  parse and record only of necessary during build time. </p>\r
+  \r
+  @since GenBuild 1.0\r
+**/\r
+public class WorkspaceProfile {\r
+\r
+\r
+    public static Logger log = Logger.getAnonymousLogger();\r
+    public static KeyComparator comparator = new KeyComparator();\r
+    ///\r
+    /// Record current WORKSPACE Directory\r
+    ///\r
+    private static String workspaceDir = "";\r
+    \r
+    ///\r
+    /// Be used to ensure Global data will be initialized only once.\r
+    ///\r
+//    private static boolean globalFlag = false;\r
+    \r
+    ///\r
+    /// Framework Database information: package list and platform list\r
+    ///\r
+    private static Set<PackageIdentification> packageList = new HashSet<PackageIdentification>();  \r
+\r
+    private static Set<PlatformIdentification> platformList = new HashSet<PlatformIdentification>();\r
+\r
+    ///\r
+    /// Every detail SPD informations: Module list, Library class definition,\r
+    ///   Package header file, GUID/PPI/Protocol definitions\r
+    ///\r
+    private static final Map<PackageIdentification, Spd> spdTable = new HashMap<PackageIdentification, Spd>();\r
+\r
+    ///\r
+    /// Build informations are divided into three parts:\r
+    /// 1. From MSA 2. From FPD 3. From FPD' ModuleSA\r
+    ///\r
+    private static Map<ModuleIdentification, Map<String, XmlObject>> nativeMsa = new HashMap<ModuleIdentification, Map<String, XmlObject>>();\r
+\r
+    private static Map<FpdModuleIdentification, Map<String, XmlObject>> fpdModuleSA= new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r
+\r
+    private static XmlObject fpdBuildOptions;\r
+\r
+    private static XmlObject fpdDynamicPcds;\r
+    \r
+    ///\r
+    /// Parsed modules list\r
+    ///\r
+    private static Map<FpdModuleIdentification, Map<String, XmlObject>> parsedModules = new HashMap<FpdModuleIdentification, Map<String, XmlObject>>();\r
+    \r
+    ///\r
+    /// built modules list with ARCH, TARGET, TOOLCHAIN\r
+    ///\r
+    private static Set<FpdModuleIdentification> builtModules = new HashSet<FpdModuleIdentification>();\r
+    \r
+    /**\r
+      Parse framework database (DB) and all SPD files listed in DB to initialize\r
+      the environment for next build. This method will only be executed only once\r
+      in the whole build process.  \r
+    \r
+      @param workspaceDatabaseFile the file name of framework database\r
+      @param workspaceDir current workspace directory path\r
+      @throws Exception\r
+            Framework Dababase or SPD or MSA file is not valid\r
+    **/\r
+    public synchronized static void initInfo(String workspaceDatabaseFile, String workspaceDir) throws Exception {\r
+        \r
+        //\r
+        // Backup workspace directory. It will be used by other method\r
+        //\r
+        WorkspaceProfile.workspaceDir = workspaceDir.replaceAll("(\\\\)", "/");\r
+        File dbFile = new File(workspaceDir + File.separatorChar + workspaceDatabaseFile);\r
+        try {\r
+            FrameworkDatabaseDocument db = (FrameworkDatabaseDocument) XmlObject.Factory.parse(dbFile);\r
+            //\r
+            // validate FrameworkDatabaseFile\r
+            //\r
+//            if (! db.validate()) {\r
+//                throw new Exception("Framework Database file [" + dbFile.getPath() + "] is invalid.");\r
+//            }\r
+            //\r
+            // Get package list\r
+            //\r
+            packageList.clear();\r
+            List<DbPathAndFilename> packages = db.getFrameworkDatabase().getPackageList().getFilenameList();\r
+            \r
+            Iterator iter = packages.iterator();\r
+            while (iter.hasNext()) {\r
+                DbPathAndFilename dbPath = (DbPathAndFilename)iter.next();\r
+                String fileName = dbPath.getStringValue();\r
+                Spd spd = new Spd(new File(workspaceDir + File.separatorChar + fileName));\r
+                packageList.add(spd.getPackageId());\r
+                spdTable.put(spd.getPackageId(), spd);\r
+            }\r
+\r
+            \r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+            throw new Exception("Parse workspace Database [" + dbFile.getPath() + "] Error.\n" + e.getMessage());\r
+        }\r
+    }\r
+    \r
+    /**\r
+      Get the current WORKSPACE Directory. \r
+      \r
+      @return current workspace directory\r
+    **/\r
+    public synchronized static String getWorkspacePath() {\r
+        return workspaceDir;\r
+    }\r
+\r
+\r
+    /**\r
+      Get the MSA file name with absolute path\r
+     */\r
+    public synchronized static File getMsaFile(ModuleIdentification moduleId) throws Exception {\r
+        File msaFile = null;\r
+        //\r
+        // TBD. Do only when package is null. \r
+        //\r
+        Iterator iter = packageList.iterator();\r
+        while (iter.hasNext()) {\r
+            PackageIdentification packageId = (PackageIdentification)iter.next();\r
+            Spd spd = spdTable.get(packageId);\r
+            msaFile = spd.getModuleFile(moduleId);\r
+            if (msaFile != null ) {\r
+                break ;\r
+            }\r
+        }\r
+        if (msaFile == null){\r
+            throw new Exception("Can't find Module [" + moduleId.getName() + "] in all packages. ");\r
+        }\r
+        else {\r
+            return msaFile;\r
+        }\r
+    }\r
+\r
+    public synchronized static PackageIdentification getPackageForModule(ModuleIdentification moduleId) {\r
+        //\r
+        // If package already defined in module\r
+        //\r
+        if (moduleId.getPackage() != null) {\r
+            return moduleId.getPackage();\r
+        }\r
+        \r
+        PackageIdentification packageId = null;\r
+        Iterator iter = packageList.iterator();\r
+        while (iter.hasNext()) {\r
+            packageId = (PackageIdentification)iter.next();\r
+            \r
+            Spd spd = spdTable.get(packageId);\r
+            if (spd.getModuleFile(moduleId) != null ) {\r
+                moduleId.setPackage(packageId);\r
+                break ;\r
+            }\r
+        }\r
+        if (packageId == null){\r
+            return null;\r
+        }\r
+        else {\r
+            return packageId;\r
+        }\r
+    }\r
+    \r
+    /**\r
+      Difference between build and parse: ToolChain and Target\r
+    **/\r
+    public synchronized static boolean isModuleBuilt(FpdModuleIdentification moduleId) {\r
+        return builtModules.contains(moduleId);\r
+    }\r
+    \r
+    public synchronized static void registerBuiltModule(FpdModuleIdentification fpdModuleId) {\r
+        builtModules.add(fpdModuleId);\r
+    }\r
+\r
+    \r
+    public synchronized static void registerFpdModuleSA(FpdModuleIdentification fpdModuleId, Map<String, XmlObject> doc) throws Exception{\r
+        Map<String, XmlObject> result = new HashMap<String, XmlObject>();\r
+        Set keySet = doc.keySet();\r
+        Iterator iter = keySet.iterator();\r
+        while (iter.hasNext()){\r
+            String key = (String)iter.next();\r
+            XmlObject item = cloneXmlObject(doc.get(key), true);\r
+            result.put(key, item);\r
+        }\r
+        fpdModuleSA.put(fpdModuleId, result);\r
+    }\r
+    \r
+    /**\r
+      Query overrided module surface area information. If current is Package\r
+      or Platform build, also include the information from FPD file. \r
+      \r
+      <p>Note that surface area parsing is incremental. That means the method will \r
+      only parse the MSA and MBD files if necessary. </p>\r
+    \r
+      @param moduleName the base name of the module\r
+      @return the overrided module surface area information\r
+      @throws Exception\r
+              MSA or MBD is not valid\r
+    **/\r
+    public synchronized static Map<String, XmlObject> getDoc(FpdModuleIdentification fpdModuleId) throws Exception {\r
+        if (parsedModules.containsKey(fpdModuleId)) {\r
+            return parsedModules.get(fpdModuleId);\r
+        }\r
+        Map<String, XmlObject> doc = new HashMap<String, XmlObject>();\r
+        ModuleIdentification moduleId = fpdModuleId.getModule();\r
+        //\r
+        // First part: get the MSA files info\r
+        //\r
+        doc = getNativeMsa(moduleId);\r
+        \r
+        //\r
+        // Second part: put build options\r
+        //\r
+        doc.put("BuildOptions", fpdBuildOptions);\r
+        \r
+        //\r
+        // Third part: get Module info from FPD, such as Library instances, PCDs\r
+        //\r
+        if (fpdModuleSA.containsKey(fpdModuleId)){\r
+            //\r
+            // merge module info in FPD to final Doc\r
+            // For Library Module, do nothing here\r
+            //\r
+            doc.putAll(fpdModuleSA.get(fpdModuleId));\r
+        }\r
+        parsedModules.put(fpdModuleId, doc);\r
+        return doc;\r
+    }\r
+\r
+    public synchronized static Map<String, XmlObject> getDoc(ModuleIdentification moduleId, String arch) throws Exception {\r
+        FpdModuleIdentification fpdModuleId = new FpdModuleIdentification(moduleId, arch);\r
+        return getDoc(fpdModuleId);\r
+    }\r
+    /**\r
+      Query the native MSA information with module base name. \r
+      \r
+      <p>Note that MSA parsing is incremental. That means the method will \r
+      only to parse the MSA files when never parsed before. </p>\r
+      \r
+      @param moduleName the base name of the module\r
+      @return the native MSA information\r
+      @throws Exception\r
+              MSA file is not valid\r
+    **/\r
+    public synchronized static Map<String, XmlObject> getNativeMsa(ModuleIdentification moduleId) throws Exception {\r
+        if (nativeMsa.containsKey(moduleId)) {\r
+            return nativeMsa.get(moduleId);\r
+        }\r
+        File msaFile = getMsaFile(moduleId);\r
+        Map<String, XmlObject> msaMap = getNativeMsa(msaFile);\r
+        nativeMsa.put(moduleId, msaMap);\r
+        return msaMap;\r
+    }\r
+    \r
+    public synchronized static Map<String, XmlObject> getNativeMsa(File msaFile) throws Exception {\r
+        \r
+        try {\r
+            ModuleSurfaceAreaDocument doc = (ModuleSurfaceAreaDocument)XmlObject.Factory.parse(msaFile);\r
+            //\r
+            // Validate File if they accord with XML Schema\r
+            //\r
+//            if ( ! doc.validate()){\r
+//                throw new Exception("Module Surface Area file [" + msaFile.getPath() + "] is invalid.");\r
+//            }\r
+            //\r
+            // parse MSA file\r
+            //\r
+            ModuleSurfaceArea msa= doc.getModuleSurfaceArea();\r
+            Map<String, XmlObject> msaMap = new HashMap<String, XmlObject>();\r
+            msaMap.put("ModuleSurfaceArea", msa);\r
+            msaMap.put("MsaHeader", cloneXmlObject(msa.getMsaHeader(), true));\r
+            msaMap.put("LibraryClassDefinitions", cloneXmlObject(msa.getLibraryClassDefinitions(), true));\r
+            msaMap.put("SourceFiles", cloneXmlObject(msa.getSourceFiles(), true));\r
+            msaMap.put("PackageDependencies", cloneXmlObject(msa.getPackageDependencies(), true));\r
+            msaMap.put("Protocols", cloneXmlObject(msa.getProtocols(), true));\r
+            msaMap.put("PPIs", cloneXmlObject(msa.getPPIs(), true));\r
+            msaMap.put("Guids", cloneXmlObject(msa.getGuids(), true));\r
+            msaMap.put("Externs", cloneXmlObject(msa.getExterns(), true));\r
+            return msaMap;\r
+        }\r
+        catch (Exception ex){\r
+            throw new Exception(ex.getMessage());\r
+        }\r
+    }\r
+    \r
+    public static Map<String, XmlObject> getFpdBuildOptions() {\r
+        Map<String, XmlObject> map = new HashMap<String, XmlObject>();\r
+        map.put("BuildOptions", fpdBuildOptions);\r
+        return map;\r
+    }\r
+    \r
+    public static void setFpdBuildOptions(XmlObject fpdBuildOptions) throws Exception{\r
+        WorkspaceProfile.fpdBuildOptions = cloneXmlObject(fpdBuildOptions, true);\r
+    }\r
+\r
+    public static XmlObject getFpdDynamicPcds() {\r
+        return fpdDynamicPcds;\r
+    }\r
+\r
+    public static void setFpdDynamicPcds(XmlObject fpdDynamicPcds) {\r
+        WorkspaceProfile.fpdDynamicPcds = fpdDynamicPcds;\r
+    }\r
+\r
+    //////////////////////////////////////////////\r
+    //////////////////////////////////////////////\r
+    \r
+    public static Set<ModuleIdentification> getModules(PackageIdentification packageId){\r
+        Spd spd = spdTable.get(packageId);\r
+        if (spd == null ) {\r
+            Set<ModuleIdentification> dummy = new HashSet<ModuleIdentification>();\r
+            return dummy;\r
+        }\r
+        else {\r
+            return spd.getModules();\r
+        }\r
+    }\r
+\r
+    public synchronized static PlatformIdentification getPlatform(String name) throws Exception {\r
+        Iterator iter = platformList.iterator();\r
+        while(iter.hasNext()){\r
+            PlatformIdentification platformId = (PlatformIdentification)iter.next();\r
+            if (platformId.getName().equalsIgnoreCase(name)) {\r
+                WorkspaceProfile.log.info("Platform: " + platformId + platformId.getFpdFile());\r
+                return platformId;\r
+            }\r
+        }\r
+        throw new Exception("Can't find platform [" + name + "] in current workspace. ");\r
+    }\r
+    \r
+    public synchronized static File getPackageFile(PackageIdentification packageId) throws Exception {\r
+        Iterator iter = packageList.iterator();\r
+        while(iter.hasNext()){\r
+            PackageIdentification packageItem = (PackageIdentification)iter.next();\r
+            if (packageItem.equals(packageId)) {\r
+                packageId.setName(packageItem.getName());\r
+                return packageItem.getSpdFile();\r
+            }\r
+        }\r
+        throw new Exception("Can't find " + packageId + " in current workspace. ");\r
+    }\r
+    \r
+    public synchronized static File getModuleFile(ModuleIdentification moduleId) throws Exception {\r
+        PackageIdentification packageId = getPackageForModule(moduleId);\r
+        moduleId.setPackage(packageId);\r
+        Spd spd = spdTable.get(packageId);\r
+        return spd.getModuleFile(moduleId);\r
+    }\r
+    //\r
+    // expanded by FrameworkWizard\r
+    //\r
+    public synchronized static XmlObject getModuleXmlObject(ModuleIdentification moduleId) throws Exception {\r
+        PackageIdentification packageId = getPackageForModule(moduleId);\r
+        moduleId.setPackage(packageId);\r
+        Spd spd = spdTable.get(packageId);\r
+        return spd.msaDocMap.get(moduleId);\r
+    }\r
+    \r
+    public synchronized static XmlObject getPackageXmlObject(PackageIdentification packageId) {\r
+        Spd spd = spdTable.get(packageId);\r
+        if (spd != null){\r
+            return spd.spdDocMap.get("PackageSurfaceArea");\r
+        }\r
+        return null;\r
+    }\r
+    \r
+    public synchronized static Set<PackageIdentification> getPackageList(){\r
+        return packageList;\r
+    }\r
+    ///// remove!!\r
+    private static XmlObject cloneXmlObject(XmlObject object, boolean deep) throws Exception {\r
+        if ( object == null) {\r
+            return null;\r
+        }\r
+        XmlObject result = null;\r
+        try {\r
+            result = XmlObject.Factory.parse(object.getDomNode()\r
+                            .cloneNode(deep));\r
+        } catch (Exception ex) {\r
+            throw new Exception(ex.getMessage());\r
+        }\r
+        return result;\r
+    }\r
+\r
+    public static ModuleIdentification getModuleId(String key){\r
+        //\r
+        // Get ModuleGuid, ModuleVersion, PackageGuid, PackageVersion, Arch into string array.\r
+        //\r
+        String[] keyPart = key.split(" ");\r
+        Set<PackageIdentification> spi = WorkspaceProfile.getPackageList();\r
+        Iterator ispi = spi.iterator();\r
+        \r
+        while(ispi.hasNext()) {\r
+            PackageIdentification pi = (PackageIdentification)ispi.next();\r
+            if ( !pi.getGuid().equalsIgnoreCase(keyPart[2])){ \r
+\r
+                continue;\r
+            }\r
+            if (keyPart[3] != null && keyPart[3].length() > 0 && !keyPart[3].equals("null")){\r
+                if(!pi.getVersion().equals(keyPart[3])){\r
+                    continue;\r
+                }\r
+            }\r
+            Set<ModuleIdentification> smi = WorkspaceProfile.getModules(pi);\r
+            Iterator ismi = smi.iterator();\r
+            while(ismi.hasNext()) {\r
+                ModuleIdentification mi = (ModuleIdentification)ismi.next();\r
+                if (mi.getGuid().equalsIgnoreCase(keyPart[0])){\r
+                    if (keyPart[1] != null && keyPart[1].length() > 0 && !keyPart[1].equals("null")){\r
+                        if(!mi.getVersion().equals(keyPart[1])){\r
+                            continue;\r
+                        }\r
+                    }\r
+\r
+                    return mi;\r
+                }\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+    \r
+    public static Vector<String> getModuleSupArchs(ModuleIdentification mi) throws Exception {\r
+        Vector<String> vArchs = null;\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);\r
+        if (msa.getModuleDefinitions() == null || msa.getModuleDefinitions().getSupportedArchitectures() == null) {\r
+            return vArchs;\r
+        }\r
+        ListIterator li = msa.getModuleDefinitions().getSupportedArchitectures().listIterator();\r
+        while (li.hasNext()) {\r
+            if (vArchs == null) {\r
+                vArchs = new Vector<String>();\r
+            }\r
+            vArchs.add((String)li.next());\r
+        }\r
+        \r
+        return vArchs;\r
+    }\r
+    \r
+    public static boolean pcdInMsa (String cName, String tsGuid, ModuleIdentification mi) throws Exception {\r
+        ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)getModuleXmlObject(mi);\r
+        if (msa.getPcdCoded() == null || msa.getPcdCoded().getPcdEntryList() == null) {\r
+            return false;\r
+        }\r
+        ListIterator li = msa.getPcdCoded().getPcdEntryList().listIterator();\r
+        while (li.hasNext()) {\r
+            PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();\r
+            if (msaPcd.getCName().equals(cName) && msaPcd.getTokenSpaceGuidCName().equals(tsGuid)) {\r
+                return true;\r
+            }\r
+        }\r
+        return false;\r
+    }\r
+    \r
+}\r
+\r
+final class KeyComparator implements Comparator<String> {\r
+    public int compare(String x, String y) {\r
+        return x.compareToIgnoreCase(y);\r
+    }\r
+    \r
+}\r
+\r
index 7409f9a886a9cc8fb0d6ea6cc25e4c72aca3e8a4..913a65a45e1db283faa069036fc4f6665697db3d 100644 (file)
@@ -2,7 +2,7 @@ package org.tianocore.frameworkwizard.platform.ui.id;
 \r
 import java.io.File;\r
 \r
 \r
 import java.io.File;\r
 \r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 \r
 public class ModuleIdentification extends Identification {\r
     \r
 \r
 public class ModuleIdentification extends Identification {\r
     \r
@@ -34,7 +34,7 @@ public class ModuleIdentification extends Identification {
 \r
     private void prepareMsaFile()throws Exception{\r
         if (msaFile == null) {\r
 \r
     private void prepareMsaFile()throws Exception{\r
         if (msaFile == null) {\r
-            msaFile = GlobalData.getModuleFile(this);\r
+            msaFile = WorkspaceProfile.getModuleFile(this);\r
         }\r
     }\r
     public void setMsaFile(File msaFile) {\r
         }\r
     }\r
     public void setMsaFile(File msaFile) {\r
index 9ba5511e66687a9d82b2139ea57de8e60f5261d7..2f42e6f83666677c6c8c29404d41c39d3c8224b4 100644 (file)
@@ -1,7 +1,7 @@
 package org.tianocore.frameworkwizard.platform.ui.id;\r
 import java.io.File;\r
 \r
 package org.tianocore.frameworkwizard.platform.ui.id;\r
 import java.io.File;\r
 \r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 \r
 public class PackageIdentification extends Identification{\r
     \r
 \r
 public class PackageIdentification extends Identification{\r
     \r
@@ -48,12 +48,12 @@ public class PackageIdentification extends Identification{
     \r
     public String getPackageRelativeDir()throws Exception{\r
         prepareSpdFile();\r
     \r
     public String getPackageRelativeDir()throws Exception{\r
         prepareSpdFile();\r
-        return spdFile.getParent().substring(GlobalData.getWorkspacePath().length() + 1);\r
+        return spdFile.getParent().substring(WorkspaceProfile.getWorkspacePath().length() + 1);\r
     }\r
     \r
     private void prepareSpdFile() throws Exception{\r
         if (spdFile == null) {\r
     }\r
     \r
     private void prepareSpdFile() throws Exception{\r
         if (spdFile == null) {\r
-            spdFile = GlobalData.getPackageFile(this);\r
+            spdFile = WorkspaceProfile.getPackageFile(this);\r
         }\r
     }\r
 }\r
         }\r
     }\r
 }\r
index 499c66939deff7be29d8aeef94b73348ca6146a1..d01c475e760f08a05c27b230dfd594fcbad32fee 100644 (file)
@@ -1,7 +1,7 @@
 package org.tianocore.frameworkwizard.platform.ui.id;\r
 import java.io.File;\r
 \r
 package org.tianocore.frameworkwizard.platform.ui.id;\r
 import java.io.File;\r
 \r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
+import org.tianocore.frameworkwizard.platform.ui.global.WorkspaceProfile;\r
 \r
 public class PlatformIdentification extends Identification{\r
     \r
 \r
 public class PlatformIdentification extends Identification{\r
     \r
@@ -34,6 +34,6 @@ public class PlatformIdentification extends Identification{
     }\r
     \r
     public String getPlatformRelativeDir(){\r
     }\r
     \r
     public String getPlatformRelativeDir(){\r
-        return fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
+        return fpdFile.getParent().substring(WorkspaceProfile.getWorkspacePath().length());\r
     }\r
 }
\ No newline at end of file
     }\r
 }
\ No newline at end of file