]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java
1. Fix EDKT281 there are too many values in the list of Hob's Guid C Name. only the...
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / workspace / WorkspaceTools.java
index dda8844495e07b054947554a0aac52a34e713343..4e40d59efc16f54fd5d0db2018ae14ba5be93434 100644 (file)
@@ -22,186 +22,147 @@ import java.util.Vector;
 import org.apache.xmlbeans.XmlCursor;\r
 import org.apache.xmlbeans.XmlException;\r
 import org.tianocore.DbPathAndFilename;\r
-import org.tianocore.FrameworkDatabaseDocument.FrameworkDatabase;\r
 import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.MsaFilesDocument.MsaFiles;\r
-import org.tianocore.MsaHeaderDocument.MsaHeader;\r
+import org.tianocore.PackageDependenciesDocument.PackageDependencies;\r
 import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
-import org.tianocore.PlatformHeaderDocument.PlatformHeader;\r
 import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
 import org.tianocore.SourceFilesDocument.SourceFiles;\r
-import org.tianocore.SpdHeaderDocument.SpdHeader;\r
 import org.tianocore.frameworkwizard.common.DataType;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
 import org.tianocore.frameworkwizard.common.Log;\r
+import org.tianocore.frameworkwizard.common.OpenFile;\r
 import org.tianocore.frameworkwizard.common.SaveFile;\r
+import org.tianocore.frameworkwizard.common.Sort;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
-import org.tianocore.frameworkwizard.common.Identifications.OpenFile;\r
 import org.tianocore.frameworkwizard.far.FarHeader;\r
 import org.tianocore.frameworkwizard.far.FarIdentification;\r
 import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.PcdCoded.PcdVector;\r
 import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
 import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
 \r
 public class WorkspaceTools {\r
-    //\r
-    // Define class members\r
-    //\r
-    private FrameworkDatabase fdb = null;\r
 \r
-    private Vector<ModuleIdentification> vModuleList = new Vector<ModuleIdentification>();\r
+    public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {\r
+        //FrameworkDatabase fdb = openFrameworkDb();\r
 \r
-    private Vector<PackageIdentification> vPackageList = new Vector<PackageIdentification>();\r
+        for (int i = 0; i < packageList.size(); i++) {\r
+            DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
+            item.setFarGuid(far.getGuidValue());\r
+            item.setStringValue(packageList.get(i));\r
+            GlobalData.fdb.getPackageList().getFilenameList().add(item);\r
+        }\r
 \r
-    private Vector<PlatformIdentification> vPlatformList = new Vector<PlatformIdentification>();\r
+        for (int i = 0; i < platformList.size(); i++) {\r
+            DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
+            item.setFarGuid(far.getGuidValue());\r
+            item.setStringValue(platformList.get(i));\r
+            GlobalData.fdb.getPlatformList().getFilenameList().add(item);\r
+        }\r
+\r
+        DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();\r
+        farItem.setFarGuid(far.getGuidValue());\r
+        farItem.setStringValue(far.getFarName());\r
+        GlobalData.fdb.getFarList().getFilenameList().add(farItem);\r
 \r
-    /**\r
-     \r
-     Open Framework Database file\r
-     \r
-     */\r
-    private FrameworkDatabase openFrameworkDb() {\r
         String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
         strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
+\r
         try {\r
-            fdb = OpenFile.openFrameworkDb(strFrameworkDbFilePath);\r
-        } catch (XmlException e) {\r
-            Log.err("Open Framework Database " + strFrameworkDbFilePath, e.getMessage());\r
-            return null;\r
+            SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
         } catch (Exception e) {\r
-            Log.err("Open Framework Database " + strFrameworkDbFilePath, "Invalid file type");\r
-            return null;\r
+            Log.err("Save Database File", e.getMessage());\r
         }\r
-        return fdb;\r
     }\r
 \r
-    public void addFarToDb(List<String> packageList, List<String> platformList, FarHeader far) {\r
-      FrameworkDatabase fdb = openFrameworkDb();\r
-      \r
-      for (int i = 0; i < packageList.size(); i++) {\r
-        DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
-        item.setFarGuid(far.getGuidValue());\r
-        item.setStringValue(packageList.get(i));\r
-        fdb.getPackageList().getFilenameList().add(item);\r
-      }\r
-      \r
-      for (int i = 0; i < platformList.size(); i++) {\r
-        DbPathAndFilename item = DbPathAndFilename.Factory.newInstance();\r
-        item.setFarGuid(far.getGuidValue());\r
-        item.setStringValue(platformList.get(i));\r
-        fdb.getPlatformList().getFilenameList().add(item);\r
-      }\r
-      \r
-      DbPathAndFilename farItem = DbPathAndFilename.Factory.newInstance();\r
-      farItem.setFarGuid(far.getGuidValue());\r
-      farItem.setStringValue(far.getFarName());\r
-      fdb.getFarList().getFilenameList().add(farItem);\r
-      \r
-      String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
-      strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
-      \r
-      try {\r
-        SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
-      }\r
-      catch (Exception e) {\r
-        e.printStackTrace();\r
-      }\r
-    }\r
-    \r
-    \r
     public void removeFarFromDb(FarIdentification far) {\r
-        FrameworkDatabase fdb = openFrameworkDb();\r
         //\r
         // Remove Packages\r
         //\r
-        XmlCursor cursor = fdb.getPackageList().newCursor();\r
+        XmlCursor cursor = GlobalData.fdb.getPackageList().newCursor();\r
         cursor.toFirstChild();\r
         do {\r
-          DbPathAndFilename item = (DbPathAndFilename)cursor.getObject();\r
-          \r
-          if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-            cursor.removeXml();\r
-          }\r
+            DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
+\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                cursor.removeXml();\r
+            }\r
         } while (cursor.toNextSibling());\r
         cursor.dispose();\r
-        \r
+\r
         //\r
         // Remove Platforms\r
         //\r
-        cursor = fdb.getPlatformList().newCursor();\r
+        cursor = GlobalData.fdb.getPlatformList().newCursor();\r
         cursor.toFirstChild();\r
         do {\r
-          DbPathAndFilename item = (DbPathAndFilename)cursor.getObject();\r
-          if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-            cursor.removeXml();\r
-          }\r
+            DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                cursor.removeXml();\r
+            }\r
         } while (cursor.toNextSibling());\r
-        \r
+\r
         //\r
         // Remove Far\r
         //\r
-        cursor = fdb.getFarList().newCursor();\r
+        cursor = GlobalData.fdb.getFarList().newCursor();\r
         cursor.toFirstChild();\r
         do {\r
-          DbPathAndFilename item = (DbPathAndFilename)cursor.getObject();\r
-          if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-            cursor.removeXml();\r
-          }\r
+            DbPathAndFilename item = (DbPathAndFilename) cursor.getObject();\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                cursor.removeXml();\r
+            }\r
         } while (cursor.toNextSibling());\r
         cursor.dispose();\r
-        \r
+\r
         String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
         strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
         try {\r
-          SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
-        }\r
-        catch (Exception e) {\r
-          e.printStackTrace();\r
-        }\r
-    }\r
-    \r
-    public String getPackageFarGuid(PackageIdentification packageId) {\r
-      openFrameworkDb();\r
-      \r
-      for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        File tempFile = new File(path);\r
-        if (tempFile.getPath().equalsIgnoreCase(packageId.getSpdFile().getPath())) {\r
-          return fdb.getPackageList().getFilenameArray(index).getFarGuid();\r
-        }\r
-      }\r
-      \r
-      return null;\r
-    }\r
-    \r
-    public String getPlatformFarGuid(PlatformIdentification platformId) {\r
-      openFrameworkDb();\r
-      \r
-      for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        File tempFile = new File(path);\r
-        if (tempFile.getPath().equalsIgnoreCase(platformId.getFpdFile().getPath())) {\r
-          return fdb.getPlatformList().getFilenameArray(index).getFarGuid();\r
-        }\r
-      }\r
-      \r
-      return null;\r
-    }\r
-    \r
-    public String getModuleFarGuid(ModuleIdentification moduleId) {\r
-      PackageIdentification packageId = getPackageIdByModuleId(moduleId);\r
-      if (packageId != null) {\r
-          return getPackageFarGuid(packageId);\r
-      }\r
-      else {\r
+            SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
+        } catch (Exception e) {\r
+            Log.err("Save Database File", e.getMessage());\r
+        }\r
+    }\r
+\r
+    public String getPackageFarGuid(Identification packageId) {\r
+        for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
+            File tempFile = new File(path);\r
+            if (tempFile.getPath().equalsIgnoreCase(packageId.getPath())) {\r
+                return GlobalData.fdb.getPackageList().getFilenameArray(index).getFarGuid();\r
+            }\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    public String getPlatformFarGuid(Identification platformId) {\r
+        for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
+            File tempFile = new File(path);\r
+            if (tempFile.getPath().equalsIgnoreCase(platformId.getPath())) {\r
+                return GlobalData.fdb.getPlatformList().getFilenameArray(index).getFarGuid();\r
+            }\r
+        }\r
+\r
         return null;\r
-      }\r
     }\r
+\r
+    public String getModuleFarGuid(Identification moduleId) {\r
+        PackageIdentification packageId = getPackageIdByModuleId(moduleId);\r
+        if (packageId != null) {\r
+            return getPackageFarGuid(packageId);\r
+        } else {\r
+            return null;\r
+        }\r
+    }\r
+\r
     /**\r
      Get all modules' paths from one package\r
      \r
@@ -210,53 +171,41 @@ public class WorkspaceTools {
      **/\r
     public Vector<String> getAllModulesOfPackage(String path) {\r
         Vector<String> modulePath = new Vector<String>();\r
-        try {\r
-            MsaFiles files = OpenFile.openSpdFile(path).getMsaFiles();\r
-            if (files != null) {\r
-                for (int index = 0; index < files.getFilenameList().size(); index++) {\r
-                    String msaPath = files.getFilenameList().get(index);\r
-                    msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r
-                    msaPath = Tools.convertPathToCurrentOsType(msaPath);\r
-                    modulePath.addElement(msaPath);\r
-                }\r
+        PackageIdentification id = new PackageIdentification(null, null, null, path);\r
+        MsaFiles files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id).getMsaFiles();\r
+        if (files != null) {\r
+            for (int index = 0; index < files.getFilenameList().size(); index++) {\r
+                String msaPath = files.getFilenameList().get(index);\r
+                msaPath = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + msaPath;\r
+                msaPath = Tools.convertPathToCurrentOsType(msaPath);\r
+                modulePath.addElement(msaPath);\r
             }\r
-        } catch (IOException e) {\r
-\r
-        } catch (XmlException e) {\r
-\r
-        } catch (Exception e) {\r
-\r
         }\r
+\r
         return modulePath;\r
     }\r
-    \r
+\r
     /**\r
-    Get all Industry Std Includes' paths from one package\r
-    \r
-    @return a Vector with all paths\r
-    \r
-    **/\r
-   public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {\r
-       Vector<String> includePath = new Vector<String>();\r
-       try {\r
-           IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes();\r
-           if (files != null) {\r
-               for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r
-                   String temp = files.getIndustryStdHeaderList().get(index).getName();\r
-                   temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
-                   temp = Tools.convertPathToCurrentOsType(temp);\r
-                   includePath.addElement(temp);\r
-               }\r
-           }\r
-       } catch (IOException e) {\r
-\r
-       } catch (XmlException e) {\r
-\r
-       } catch (Exception e) {\r
-\r
-       }\r
-       return includePath;\r
-   }\r
+     Get all Industry Std Includes' paths from one package\r
+     \r
+     @return a Vector with all paths\r
+     \r
+     **/\r
+    public Vector<String> getAllIndustryStdIncludesOfPackage(String path) {\r
+        Vector<String> includePath = new Vector<String>();\r
+        PackageIdentification id = new PackageIdentification(null, null, null, path);\r
+        IndustryStdIncludes files = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(id)\r
+                                                                 .getIndustryStdIncludes();\r
+        if (files != null) {\r
+            for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) {\r
+                String temp = files.getIndustryStdHeaderList().get(index).getIncludeHeader();\r
+                temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp;\r
+                temp = Tools.convertPathToCurrentOsType(temp);\r
+                includePath.addElement(temp);\r
+            }\r
+        }\r
+        return includePath;\r
+    }\r
 \r
     /**\r
      Get all package basic information form the FrameworkDatabase.db file\r
@@ -265,134 +214,127 @@ public class WorkspaceTools {
      \r
      */\r
     public Vector<PackageIdentification> getAllPackages() {\r
+        return GlobalData.vPackageList;\r
+    }\r
+\r
+    public Vector<FarIdentification> getAllFars() {\r
+\r
+        Vector<FarIdentification> v = new Vector<FarIdentification>();\r
+        for (int index = 0; index < GlobalData.fdb.getFarList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = GlobalData.fdb.getFarList().getFilenameList().get(index);\r
+            FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());\r
+            v.addElement(far);\r
+        }\r
+        return v;\r
+    }\r
+\r
+    public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {\r
         Identification id = null;\r
-        vPackageList.removeAllElements();\r
 \r
-        openFrameworkDb();\r
+        Vector<PackageIdentification> v = new Vector<PackageIdentification>();\r
 \r
-        for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
-            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                          + fdb.getPackageList().getFilenameArray(index).getStringValue();\r
+        for (int index = 0; index < GlobalData.fdb.getPackageList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = GlobalData.fdb.getPackageList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
             path = Tools.convertPathToCurrentOsType(path);\r
-            try {\r
-                id = getId(path, OpenFile.openSpdFile(path));\r
-                vPackageList.addElement(new PackageIdentification(id));\r
-            } catch (IOException e) {\r
-                Log.err("Open Package Surface Area " + path, e.getMessage());\r
 \r
-            } catch (XmlException e) {\r
-                Log.err("Open Package Surface Area " + path, e.getMessage());\r
-\r
-            } catch (Exception e) {\r
-                Log.err("Open Package Surface Area " + path, "Invalid file type");\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
 \r
+                try {\r
+                    id = Tools.getId(path, OpenFile.openSpdFile(path));\r
+                    v.addElement(new PackageIdentification(id));\r
+                } catch (IOException e) {\r
+                    Log.err("Open Package Surface Area " + path, e.getMessage());\r
+                } catch (XmlException e) {\r
+                    Log.err("Open Package Surface Area " + path, e.getMessage());\r
+                } catch (Exception e) {\r
+                    Log.err("Open Package Surface Area " + path, "Invalid file type");\r
+                }\r
             }\r
         }\r
-        Tools.sortPackages(vPackageList, DataType.SORT_TYPE_ASCENDING);\r
-        return vPackageList;\r
+        return v;\r
     }\r
 \r
-    public Vector<FarIdentification> getAllFars() {\r
-      openFrameworkDb();\r
-      Vector<FarIdentification> v = new Vector<FarIdentification>();\r
-      for (int index = 0; index < fdb.getFarList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getFarList().getFilenameList().get(index);\r
-        FarIdentification far = new FarIdentification(item.getFarGuid(), item.getMd5Sum(), item.getStringValue());\r
-        v.addElement(far);\r
-      }\r
-      return v;\r
-    }\r
-    \r
-    public Vector<PackageIdentification> getPackagesByFar(FarIdentification far) {\r
-      Identification id = null;\r
-      openFrameworkDb();\r
-      Vector<PackageIdentification> v = new Vector<PackageIdentification>();\r
-      \r
-      for (int index = 0; index < fdb.getPackageList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPackageList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        path = Tools.convertPathToCurrentOsType(path);\r
-        \r
-        if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-        \r
-          try {\r
-            id = getId(path, OpenFile.openSpdFile(path));\r
-            v.addElement(new PackageIdentification(id));\r
-          } catch (IOException e) {\r
-            Log.err("Open Package Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (XmlException e) {\r
-            Log.err("Open Package Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (Exception e) {\r
-            Log.err("Open Package Surface Area " + path, "Invalid file type");\r
-            e.printStackTrace();\r
-          }\r
-        }\r
-      }\r
-      return v;\r
-    }\r
-    \r
     public Vector<PlatformIdentification> getPlatformsByFar(FarIdentification far) {\r
-      Identification id = null;\r
-      openFrameworkDb();\r
-      Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();\r
-      \r
-      for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
-        DbPathAndFilename item = fdb.getPlatformList().getFilenameArray(index);\r
-        String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                      + item.getStringValue();\r
-        path = Tools.convertPathToCurrentOsType(path);\r
-        \r
-        if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
-          try {\r
-            id = getId(path, OpenFile.openFpdFile(path));\r
-            v.addElement(new PlatformIdentification(id));\r
-          } catch (IOException e) {\r
-            Log.err("Open Platform Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (XmlException e) {\r
-            Log.err("Open Platform Surface Area " + path, e.getMessage());\r
-            e.printStackTrace();\r
-          } catch (Exception e) {\r
-            Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
-            e.printStackTrace();\r
-          }\r
-        }\r
-    }\r
-      return v;\r
+        Identification id = null;\r
+\r
+        Vector<PlatformIdentification> v = new Vector<PlatformIdentification>();\r
+\r
+        for (int index = 0; index < GlobalData.fdb.getPlatformList().getFilenameList().size(); index++) {\r
+            DbPathAndFilename item = GlobalData.fdb.getPlatformList().getFilenameArray(index);\r
+            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR + item.getStringValue();\r
+            path = Tools.convertPathToCurrentOsType(path);\r
+\r
+            if (item.getFarGuid() != null && item.getFarGuid().equalsIgnoreCase(far.getGuid())) {\r
+                try {\r
+                    id = Tools.getId(path, OpenFile.openFpdFile(path));\r
+                    v.addElement(new PlatformIdentification(id));\r
+                } catch (IOException e) {\r
+                    Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+                } catch (XmlException e) {\r
+                    Log.err("Open Platform Surface Area " + path, e.getMessage());\r
+                } catch (Exception e) {\r
+                    Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
+                }\r
+            }\r
+        }\r
+        return v;\r
     }\r
 \r
     /**\r
      Get all module basic information from a package\r
-    \r
+     \r
      @param id Package id\r
      @return A vector includes all modules' basic information\r
-    \r
-    **/\r
+     \r
+     **/\r
     public Vector<ModuleIdentification> getAllModules(PackageIdentification pid) {\r
         Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r
         Vector<String> modulePaths = this.getAllModulesOfPackage(pid.getPath());\r
-        Identification id = null;\r
         String modulePath = null;\r
-        \r
+\r
         for (int index = 0; index < modulePaths.size(); index++) {\r
-            try {\r
-                modulePath = modulePaths.get(index);\r
-                id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
-            } catch (IOException e) {\r
-                Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());\r
-            } catch (XmlException e) {\r
-                Log.log("Error when Open Module Surface Area " + modulePath, e.getMessage());\r
-            } catch (Exception e) {\r
-                Log.log("Error when Open Module Surface Area " + modulePath, "Invalid file type " + e.getMessage());\r
+            modulePath = modulePaths.get(index);\r
+            ModuleIdentification id = GlobalData.openingModuleList.getIdByPath(modulePath);\r
+            if (id != null) {\r
+                v.addElement(id);\r
             }\r
-            v.addElement(new ModuleIdentification(id, pid));\r
         }\r
-        Tools.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
+        return v;\r
+    }\r
+\r
+    /**\r
+     Get all module basic information from a platform\r
+     \r
+     @param id Package id\r
+     @return A vector includes all modules' basic information\r
+     \r
+     **/\r
+    public Vector<ModuleIdentification> getAllModules(PlatformIdentification fid) {\r
+        Vector<ModuleIdentification> v = new Vector<ModuleIdentification>();\r
+        PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformById(fid).getXmlFpd();\r
+        if (fpd.getFrameworkModules() != null) {\r
+            for (int index = 0; index < fpd.getFrameworkModules().getModuleSAList().size(); index++) {\r
+                String guid = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleGuid();\r
+                String version = fpd.getFrameworkModules().getModuleSAList().get(index).getModuleVersion();\r
+                ModuleIdentification id = GlobalData.openingModuleList.getIdByGuidVersion(guid, version);\r
+                if (id != null) {\r
+                    boolean isFind = false;\r
+                    for (int indexOfModules = 0; indexOfModules < v.size(); indexOfModules++) {\r
+                        if (v.elementAt(indexOfModules).equals(id)) {\r
+                            isFind = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if (!isFind) {\r
+                        v.addElement(id);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        Sort.sortModules(v, DataType.SORT_TYPE_ASCENDING);\r
         return v;\r
-        \r
     }\r
 \r
     /**\r
@@ -402,39 +344,7 @@ public class WorkspaceTools {
      \r
      */\r
     public Vector<ModuleIdentification> getAllModules() {\r
-        vModuleList.removeAllElements();\r
-        //\r
-        // First get all packages\r
-        //\r
-        getAllPackages();\r
-        Vector<String> modulePaths = new Vector<String>();\r
-        Identification id = null;\r
-        String packagePath = null;\r
-        String modulePath = null;\r
-\r
-        //\r
-        // For each package, get all modules list\r
-        //\r
-        for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
-            packagePath = vPackageList.elementAt(indexI).getPath();\r
-            modulePaths = this.getAllModulesOfPackage(packagePath);\r
-            \r
-            for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
-                try {\r
-                    modulePath = modulePaths.get(indexJ);\r
-                    id = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
-                    vModuleList.addElement(new ModuleIdentification(id, vPackageList.elementAt(indexI)));\r
-                } catch (IOException e) {\r
-                    Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
-                } catch (XmlException e) {\r
-                    Log.err("Open Module Surface Area " + modulePath, e.getMessage());\r
-                } catch (Exception e) {\r
-                    Log.err("Open Module Surface Area " + modulePath, "Invalid file type");\r
-                }\r
-            }\r
-        }\r
-        Tools.sortModules(vModuleList, DataType.SORT_TYPE_ASCENDING);\r
-        return vModuleList;\r
+        return GlobalData.vModuleList;\r
     }\r
 \r
     /**\r
@@ -444,28 +354,7 @@ public class WorkspaceTools {
      \r
      */\r
     public Vector<PlatformIdentification> getAllPlatforms() {\r
-        Identification id = null;\r
-        vPlatformList.removeAllElements();\r
-\r
-        openFrameworkDb();\r
-\r
-        for (int index = 0; index < fdb.getPlatformList().getFilenameList().size(); index++) {\r
-            String path = Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
-                          + fdb.getPlatformList().getFilenameArray(index).getStringValue();\r
-            path = Tools.convertPathToCurrentOsType(path);\r
-            try {\r
-                id = getId(path, OpenFile.openFpdFile(path));\r
-                vPlatformList.addElement(new PlatformIdentification(id));\r
-            } catch (IOException e) {\r
-                Log.err("Open Platform Surface Area " + path, e.getMessage());\r
-            } catch (XmlException e) {\r
-                Log.err("Open Platform Surface Area " + path, e.getMessage());\r
-            } catch (Exception e) {\r
-                Log.err("Open Platform Surface Area " + path, "Invalid file type");\r
-            }\r
-        }\r
-        Tools.sortPlatforms(vPlatformList, DataType.SORT_TYPE_ASCENDING);\r
-        return vPlatformList;\r
+        return GlobalData.vPlatformList;\r
     }\r
 \r
     /**\r
@@ -482,7 +371,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -500,7 +389,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -518,7 +407,7 @@ public class WorkspaceTools {
                 }\r
             }\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -527,16 +416,28 @@ public class WorkspaceTools {
      \r
      @return Vector\r
      **/\r
-    public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd) {\r
+    public Vector<String> getAllGuidDeclarationsFromPackage(PackageSurfaceArea spd, String type) {\r
         Vector<String> vector = new Vector<String>();\r
+        boolean isFound = false;\r
         if (spd.getGuidDeclarations() != null) {\r
             if (spd.getGuidDeclarations().getEntryList().size() > 0) {\r
                 for (int index = 0; index < spd.getGuidDeclarations().getEntryList().size(); index++) {\r
-                    vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());\r
+                    Vector<String> vArch = Tools.convertListToVector(spd.getGuidDeclarations().getEntryList()\r
+                                                                        .get(index).getGuidTypeList());\r
+                    for (int indexOfArch = 0; indexOfArch < vArch.size(); indexOfArch++) {\r
+                        if (vArch.get(indexOfArch).equals(type)) {\r
+                            isFound = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if ((isFound) || (vArch == null) || (vArch.size() < 1)) {\r
+                        vector.addElement(spd.getGuidDeclarations().getEntryList().get(index).getCName());\r
+                        isFound = false;\r
+                    }\r
                 }\r
             }\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -545,148 +446,172 @@ public class WorkspaceTools {
      \r
      @return Vector\r
      **/\r
-    public Vector<String> getAllPcdDeclarationsFromPackage(PackageSurfaceArea spd) {\r
-        Vector<String> vector = new Vector<String>();\r
+    public PcdVector getAllPcdDeclarationsFromPackage(PackageSurfaceArea spd) {\r
+        PcdVector vector = new PcdVector();\r
         if (spd.getPcdDeclarations() != null) {\r
             if (spd.getPcdDeclarations().getPcdEntryList().size() > 0) {\r
                 for (int index = 0; index < spd.getPcdDeclarations().getPcdEntryList().size(); index++) {\r
-                    vector.addElement(spd.getPcdDeclarations().getPcdEntryList().get(index).getCName());\r
+                    String name = spd.getPcdDeclarations().getPcdEntryList().get(index).getCName();\r
+                    String guidCName = spd.getPcdDeclarations().getPcdEntryList().get(index).getTokenSpaceGuidCName();\r
+                    String help = spd.getPcdDeclarations().getPcdEntryList().get(index).getHelpText();\r
+                    Vector<String> type = Tools.convertListToVector(spd.getPcdDeclarations().getPcdEntryList()\r
+                                                                       .get(index).getValidUsage());\r
+\r
+                    vector.addPcd(new PcdIdentification(name, guidCName, help, type));\r
                 }\r
             }\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
     public Vector<String> getAllLibraryClassDefinitionsFromWorkspace() {\r
-        //\r
-        // First get all packages\r
-        //\r
-        this.getAllPackages();\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+            Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList\r
+                                                                                                     .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+                                                                                                                                                         .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
 \r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
+\r
+    public Vector<String> getAllLibraryClassDefinitionsFromPackages(Vector<PackageIdentification> vpid) {\r
         Vector<String> vector = new Vector<String>();\r
-        for (int index = 0; index < this.vPackageList.size(); index++) {\r
-            try {\r
-                Vector<String> v = getAllLibraryClassDefinitionsFromPackage(OpenFile\r
-                                                                                    .openSpdFile(vPackageList\r
-                                                                                                             .get(index)\r
-                                                                                                             .getPath()));\r
-                if (v != null && v.size() > 0) {\r
-                    vector.addAll(v);\r
-                }\r
-            } catch (IOException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (XmlException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (Exception e) {\r
-                // TODO Auto-generated catch block\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllLibraryClassDefinitionsFromPackage(GlobalData.openingPackageList\r
+                                                                                                     .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                                      .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
             }\r
+\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
     public Vector<String> getAllProtocolDeclarationsFromWorkspace() {\r
-        //\r
-        // First get all packages\r
-        //\r
-        this.getAllPackages();\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+            Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                                  .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+                                                                                                                                                      .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
 \r
+    public Vector<String> getAllProtocolDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r
         Vector<String> vector = new Vector<String>();\r
-        for (int index = 0; index < this.vPackageList.size(); index++) {\r
-            try {\r
-                Vector<String> v = getAllProtocolDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
-                                                                                                          .getPath()));\r
-                if (v != null && v.size() > 0) {\r
-                    vector.addAll(v);\r
-                }\r
-            } catch (IOException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (XmlException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (Exception e) {\r
-                // TODO Auto-generated catch block\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllProtocolDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                                  .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                                   .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
             }\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
     public Vector<String> getAllPpiDeclarationsFromWorkspace() {\r
-        //\r
-        // First get all packages\r
-        //\r
-        this.getAllPackages();\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+            Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                             .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+                                                                                                                                                 .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
 \r
+    public Vector<String> getAllPpiDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r
         Vector<String> vector = new Vector<String>();\r
-        for (int index = 0; index < this.vPackageList.size(); index++) {\r
-            try {\r
-                Vector<String> v = getAllPpiDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
-                                                                                                     .getPath()));\r
-                if (v != null && v.size() > 0) {\r
-                    vector.addAll(v);\r
-                }\r
-            } catch (IOException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (XmlException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (Exception e) {\r
-                // TODO Auto-generated catch block\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllPpiDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                             .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                              .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
             }\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
-    public Vector<String> getAllGuidDeclarationsFromWorkspace() {\r
-        //\r
-        // First get all packages\r
-        //\r
-        this.getAllPackages();\r
+    public Vector<String> getAllGuidDeclarationsFromWorkspace(String type) {\r
+        Vector<String> vector = new Vector<String>();\r
+        for (int index = 0; index < GlobalData.vPackageList.size(); index++) {\r
+            Vector<String> v = getAllGuidDeclarationsFromPackage(\r
+                                                                 GlobalData.openingPackageList\r
+                                                                                              .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+                                                                                                                                                  .get(index)),\r
+                                                                 type);\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
+\r
+        }\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
 \r
+    public Vector<String> getAllGuidDeclarationsFromPackages(Vector<PackageIdentification> vpid, String type) {\r
         Vector<String> vector = new Vector<String>();\r
-        for (int index = 0; index < this.vPackageList.size(); index++) {\r
-            try {\r
-                Vector<String> v = getAllGuidDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
-                                                                                                      .getPath()));\r
-                if (v != null && v.size() > 0) {\r
-                    vector.addAll(v);\r
-                }\r
-            } catch (IOException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (XmlException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (Exception e) {\r
-                // TODO Auto-generated catch block\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            Vector<String> v = getAllGuidDeclarationsFromPackage(\r
+                                                                 GlobalData.openingPackageList\r
+                                                                                              .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                               .get(index)),\r
+                                                                 type);\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
             }\r
+\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
-    public Vector<String> getAllPcdDeclarationsFromWorkspace() {\r
-        //\r
-        // First get all packages\r
-        //\r
-        this.getAllPackages();\r
+    public PcdVector getAllPcdDeclarationsFromWorkspace() {\r
+        PcdVector vector = new PcdVector();\r
+        for (int index = 0; index < GlobalData.openingPackageList.size(); index++) {\r
+            PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                        .getPackageSurfaceAreaFromId(GlobalData.vPackageList\r
+                                                                                                                                            .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
+            }\r
 \r
-        Vector<String> vector = new Vector<String>();\r
-        for (int index = 0; index < this.vPackageList.size(); index++) {\r
-            try {\r
-                Vector<String> v = getAllPcdDeclarationsFromPackage(OpenFile.openSpdFile(vPackageList.get(index)\r
-                                                                                                     .getPath()));\r
-                if (v != null && v.size() > 0) {\r
-                    vector.addAll(v);\r
-                }\r
-            } catch (IOException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (XmlException e) {\r
-                // TODO Auto-generated catch block\r
-            } catch (Exception e) {\r
-                // TODO Auto-generated catch block\r
+        }\r
+        Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r
+        return vector;\r
+    }\r
+\r
+    public PcdVector getAllPcdDeclarationsFromPackages(Vector<PackageIdentification> vpid) {\r
+        PcdVector vector = new PcdVector();\r
+        for (int index = 0; index < vpid.size(); index++) {\r
+            PcdVector v = getAllPcdDeclarationsFromPackage(GlobalData.openingPackageList\r
+                                                                                        .getPackageSurfaceAreaFromId(vpid\r
+                                                                                                                         .get(index)));\r
+            if (v != null && v.size() > 0) {\r
+                vector.addAll(v);\r
             }\r
+\r
         }\r
-        Tools.sortVectorString(vector, DataType.SORT_TYPE_ASCENDING);\r
+        Sort.sortPcds(vector, DataType.SORT_TYPE_ASCENDING);\r
         return vector;\r
     }\r
 \r
@@ -698,7 +623,6 @@ public class WorkspaceTools {
      \r
      **/\r
     public PackageIdentification getPackageIdByModuleId(Identification id) {\r
-        getAllPackages();\r
         Vector<String> modulePaths = new Vector<String>();\r
         Identification mid = null;\r
         String packagePath = null;\r
@@ -707,59 +631,25 @@ public class WorkspaceTools {
         //\r
         // For each package, get all modules list\r
         //\r
-        for (int indexI = 0; indexI < vPackageList.size(); indexI++) {\r
-            packagePath = vPackageList.elementAt(indexI).getPath();\r
+        for (int indexI = 0; indexI < GlobalData.vPackageList.size(); indexI++) {\r
+            packagePath = GlobalData.vPackageList.elementAt(indexI).getPath();\r
             modulePaths = this.getAllModulesOfPackage(packagePath);\r
             for (int indexJ = 0; indexJ < modulePaths.size(); indexJ++) {\r
                 modulePath = modulePaths.get(indexJ);\r
-                try {\r
-                    mid = getId(modulePath, OpenFile.openMsaFile(modulePath));\r
-                    //\r
-                    // Check id\r
-                    //\r
-                    if (mid.equals(id)) {\r
-                        return vPackageList.elementAt(indexI);\r
-                    }\r
-                } catch (IOException e) {\r
-\r
-                } catch (XmlException e) {\r
-                \r
-                } catch (Exception e) {\r
-\r
+                mid = GlobalData.openingModuleList.getIdByPath(modulePath);\r
+                //\r
+                // Check id\r
+                //\r
+                if (mid.equals(id)) {\r
+                    return GlobalData.vPackageList.elementAt(indexI);\r
                 }\r
+\r
             }\r
         }\r
 \r
         return null;\r
     }\r
 \r
-    public Identification getId(String path, ModuleSurfaceArea msa) {\r
-        MsaHeader head = msa.getMsaHeader();\r
-        String name = head.getModuleName();\r
-        String guid = head.getGuidValue();\r
-        String version = head.getVersion();\r
-        Identification id = new Identification(name, guid, version, path);\r
-        return id;\r
-    }\r
-\r
-    public Identification getId(String path, PackageSurfaceArea spd) {\r
-        SpdHeader head = spd.getSpdHeader();\r
-        String name = head.getPackageName();\r
-        String guid = head.getGuidValue();\r
-        String version = head.getVersion();\r
-        Identification id = new Identification(name, guid, version, path);\r
-        return id;\r
-    }\r
-\r
-    public Identification getId(String path, PlatformSurfaceArea fpd) {\r
-        PlatformHeader head = fpd.getPlatformHeader();\r
-        String name = head.getPlatformName();\r
-        String guid = head.getGuidValue();\r
-        String version = head.getVersion();\r
-        Identification id = new Identification(name, guid, version, path);\r
-        return id;\r
-    }\r
-\r
     /**\r
      Add module information to package surface area\r
      \r
@@ -798,14 +688,15 @@ public class WorkspaceTools {
     public void addPackageToDatabase(PackageIdentification id) throws Exception {\r
         String path = id.getPath();\r
         path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r
-        this.openFrameworkDb();\r
+\r
         DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r
         filename.setStringValue(path);\r
-        fdb.getPackageList().addNewFilename();\r
-        fdb.getPackageList().setFilenameArray(fdb.getPackageList().sizeOfFilenameArray() - 1, filename);\r
+        GlobalData.fdb.getPackageList().addNewFilename();\r
+        GlobalData.fdb.getPackageList().setFilenameArray(GlobalData.fdb.getPackageList().sizeOfFilenameArray() - 1,\r
+                                                         filename);\r
         String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
         strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
-        SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+        SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
     }\r
 \r
     /**\r
@@ -818,14 +709,15 @@ public class WorkspaceTools {
     public void addPlatformToDatabase(PlatformIdentification id) throws Exception {\r
         String path = id.getPath();\r
         path = Tools.getRelativePath(path, Workspace.getCurrentWorkspace());\r
-        this.openFrameworkDb();\r
+\r
         DbPathAndFilename filename = DbPathAndFilename.Factory.newInstance();\r
         filename.setStringValue(path);\r
-        fdb.getPlatformList().addNewFilename();\r
-        fdb.getPlatformList().setFilenameArray(fdb.getPlatformList().sizeOfFilenameArray() - 1, filename);\r
+        GlobalData.fdb.getPlatformList().addNewFilename();\r
+        GlobalData.fdb.getPlatformList().setFilenameArray(GlobalData.fdb.getPlatformList().sizeOfFilenameArray() - 1,\r
+                                                          filename);\r
         String strFrameworkDbFilePath = Workspace.getCurrentWorkspace() + Workspace.getStrWorkspaceDatabaseFile();\r
         strFrameworkDbFilePath = Tools.convertPathToCurrentOsType(strFrameworkDbFilePath);\r
-        SaveFile.saveDbFile(strFrameworkDbFilePath, fdb);\r
+        SaveFile.saveDbFile(strFrameworkDbFilePath, GlobalData.fdb);\r
     }\r
 \r
     /**\r
@@ -838,11 +730,13 @@ public class WorkspaceTools {
      @throws Exception\r
      \r
      **/\r
-    public Vector<String> getAllModuleFilesPath(String path) throws IOException, XmlException, Exception {\r
+    public Vector<String> getAllFilesPathOfModule(String path) {\r
         Vector<String> v = new Vector<String>();\r
         path = Tools.convertPathToCurrentOsType(path);\r
         v.addElement(path);\r
-        ModuleSurfaceArea msa = OpenFile.openMsaFile(path);\r
+        ModuleSurfaceArea msa = GlobalData.openingModuleList\r
+                                                            .getModuleSurfaceAreaFromId(GlobalData.openingModuleList\r
+                                                                                                                    .getIdByPath(path));\r
         if (msa != null) {\r
             //\r
             // Get all files' path of a module\r
@@ -870,14 +764,14 @@ public class WorkspaceTools {
      @throws Exception\r
      \r
      **/\r
-    public Vector<String> getAllPakcageFilesPath(String path) throws IOException, XmlException, Exception {\r
+    public Vector<String> getAllFilesPathOfPakcage(String path) {\r
         Vector<String> v = new Vector<String>();\r
         path = Tools.convertPathToCurrentOsType(path);\r
         //\r
         // First add package\r
         //\r
         v.addElement(path);\r
-        \r
+\r
         //\r
         // Add the package's industry std includes one by one\r
         //\r
@@ -886,14 +780,14 @@ public class WorkspaceTools {
         for (int index = 0; index < f1.size(); index++) {\r
             v.addElement(f1.get(index));\r
         }\r
-        \r
+\r
         //\r
         // Add module's files one by one\r
         //\r
         f1 = new Vector<String>();\r
         f1 = getAllModulesOfPackage(path);\r
         for (int indexI = 0; indexI < f1.size(); indexI++) {\r
-            Vector<String> f2 = getAllModuleFilesPath(f1.get(indexI));\r
+            Vector<String> f2 = getAllFilesPathOfModule(f1.get(indexI));\r
             for (int indexJ = 0; indexJ < f2.size(); indexJ++) {\r
                 v.addElement(f2.get(indexJ));\r
             }\r
@@ -901,4 +795,53 @@ public class WorkspaceTools {
 \r
         return v;\r
     }\r
+\r
+    /**\r
+     Get a module's all package dependencies\r
+     \r
+     @param mid The module id\r
+     @return A vector of all package dependency ids\r
+     \r
+     **/\r
+    public Vector<PackageIdentification> getPackageDependenciesOfModule(ModuleIdentification mid) {\r
+        Vector<PackageIdentification> vpid = new Vector<PackageIdentification>();\r
+        ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);\r
+        if (msa != null) {\r
+            PackageDependencies pd = msa.getPackageDependencies();\r
+            if (pd != null) {\r
+                for (int index = 0; index < pd.getPackageList().size(); index++) {\r
+                    String guid = pd.getPackageList().get(index).getPackageGuid();\r
+                    String version = pd.getPackageList().get(index).getPackageVersion();\r
+                    PackageIdentification pid = GlobalData.openingPackageList.getIdByGuidVersion(guid, version);\r
+                    if (pid != null) {\r
+                        vpid.addElement(pid);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return vpid;\r
+    }\r
+\r
+    public Vector<String> getAllModuleGuidXref() {\r
+        Vector<String> v = new Vector<String>();\r
+        for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {\r
+            ModuleIdentification id = GlobalData.openingModuleList.getOpeningModuleByIndex(index).getId();\r
+            v.addElement(id.getGuid() + " " + id.getName());\r
+        }\r
+        return v;\r
+    }\r
+\r
+    public Vector<String> getModuleArch(ModuleIdentification id) {\r
+        Vector<String> v = new Vector<String>();\r
+        ModuleSurfaceArea msa = null;\r
+        if (id != null) {\r
+            msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(id);\r
+        }\r
+        if (msa != null) {\r
+            if (msa.getModuleDefinitions() != null) {\r
+                v = Tools.convertListToVector(msa.getModuleDefinitions().getSupportedArchitectures());\r
+            }\r
+        }\r
+        return v;\r
+    }\r
 }\r