]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java
1. Fix EDKT434: After Workspace is changed, Wizard should close all (desktop area...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / common / find / FindResultDetailInfo.java
index 0788d6703e2131caf39e92656dbecc588c182619..472555b43955dbf9502c647ba2b7e403dde10e51 100644 (file)
@@ -25,6 +25,9 @@ import javax.swing.JPanel;
 import javax.swing.JScrollPane;\r
 import javax.swing.JTextArea;\r
 \r
+import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions;\r
+import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo;\r
+import org.tianocore.DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData;\r
 import org.tianocore.FrameworkModulesDocument.FrameworkModules;\r
 import org.tianocore.LibrariesDocument.Libraries;\r
 import org.tianocore.LibrariesDocument.Libraries.Instance;\r
@@ -32,6 +35,9 @@ import org.tianocore.LibraryClassDocument.LibraryClass;
 import org.tianocore.ModuleSADocument.ModuleSA;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
+import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition;\r
+import org.tianocore.PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData;\r
+import org.tianocore.PcdCodedDocument.PcdCoded;\r
 import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
 import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.GlobalData;\r
@@ -124,6 +130,251 @@ public class FindResultDetailInfo extends IFrame {
         this.jTextArea.setSelectionEnd(0);\r
     }\r
 \r
+    /**\r
+     \r
+     @param lci\r
+     \r
+     **/\r
+    public FindResultDetailInfo(PcdFindResultId frid) {\r
+        super();\r
+        init();\r
+        this.setTitle(frid.getName());\r
+        this.jTextArea.setText(createReport(frid));\r
+        this.jTextArea.setSelectionStart(0);\r
+        this.jTextArea.setSelectionEnd(0);\r
+    }\r
+\r
+    /**\r
+     Create detailed information report for pcd\r
+     \r
+     @param frid\r
+     @return\r
+     \r
+     **/\r
+    private String createReport(PcdFindResultId frid) {\r
+        String name = frid.getName();\r
+\r
+        //\r
+        // Write Pcd Name\r
+        //\r
+        writeReportLn("PCD C Name: " + name);\r
+\r
+        //\r
+        // Wrtie Declared package\r
+        //\r
+        writeReportLn("Declared in Package: " + frid.getDeclaredBy().getName() + " ("\r
+                      + Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");\r
+\r
+        //\r
+        // Write Token Space\r
+        //\r
+        writeReportLn("Token Space: " + frid.getTokenSpaceGuidCName());\r
+\r
+        //\r
+        // Write Token\r
+        //\r
+        writeReportLn("Token: " + frid.getToken());\r
+\r
+        //\r
+        // Write Datum Type\r
+        //\r
+        writeReportLn("Datum Type: " + frid.getDatumType());\r
+\r
+        //\r
+        // Write Default Value\r
+        //\r
+        writeReportLn("Default Value: " + frid.getValue());\r
+\r
+        //\r
+        // Write Usages\r
+        //\r
+        writeReportLn("Valid Usages: " + frid.getUsage());\r
+\r
+        //\r
+        // Write Help Text\r
+        //\r
+        writeReportLn("Help Text: ");\r
+        writeReportLn(TAB + frid.getHelp());\r
+\r
+        //\r
+        // Write an Empty Line\r
+        //\r
+        writeReportLn("");\r
+\r
+        //\r
+        // Wriet all modules which use this PCD:\r
+        //\r
+        writeReportLn("Modules Coded to Use This PCD: ");\r
+\r
+        Vector<ModuleIdentification> vModules = frid.getConsumedModules();\r
+        if (vModules != null) {\r
+            for (int index = 0; index < vModules.size(); index++) {\r
+                //\r
+                // Write Module Name and Path\r
+                //\r
+                writeReportLn(TAB + vModules.get(index).getName() + " ("\r
+                              + Tools.getRelativePath(vModules.get(index).getPath(), Workspace.getCurrentWorkspace())\r
+                              + ")");\r
+\r
+                //\r
+                // Write Module Pcd Info\r
+                //\r
+                ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(vModules.get(index));\r
+                if (msa != null) {\r
+                    PcdCoded pcdCoded = msa.getPcdCoded();\r
+                    if (pcdCoded != null) {\r
+                        for (int indexOfPcd = 0; indexOfPcd < pcdCoded.getPcdEntryList().size(); indexOfPcd++) {\r
+                            if (pcdCoded.getPcdEntryList().get(indexOfPcd).getCName().equals(name)) {\r
+                                //\r
+                                // Write Pcd Item Type\r
+                                //\r
+                                writeReportLn(TAB + TAB + "PcdItemType: "\r
+                                              + pcdCoded.getPcdEntryList().get(indexOfPcd).getPcdItemType().toString());\r
+\r
+                                //\r
+                                // Write Help Text\r
+                                //\r
+                                writeReportLn(TAB + TAB + "Help Text: ");\r
+                                writeReportLn(TAB + TAB + TAB\r
+                                              + pcdCoded.getPcdEntryList().get(indexOfPcd).getHelpText());\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+\r
+                //\r
+                // Write an Empty Line\r
+                //\r
+                writeReportLn("");\r
+            }\r
+        }\r
+\r
+        //\r
+        // Write an Empty Line\r
+        //\r
+        writeReportLn("");\r
+\r
+        //\r
+        // Write All Platforms Specifing this PCD\r
+        //\r
+        writeReportLn("Platforms Specifing this PCD: ");\r
+\r
+        for (int index = 0; index < GlobalData.openingPlatformList.size(); index++) {\r
+            PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getXmlFpd();\r
+            PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(index).getId();\r
+\r
+            String tmp = "";\r
+            //\r
+            // Get Non-Dynamic Pcd\r
+            //\r
+            FrameworkModules fm = fpd.getFrameworkModules();\r
+            if (fm != null) {\r
+                for (int indexOfModuleSa = 0; indexOfModuleSa < fm.getModuleSAList().size(); indexOfModuleSa++) {\r
+                    ModuleSA msa = fm.getModuleSAList().get(indexOfModuleSa);\r
+                    if (msa != null) {\r
+                        PcdBuildDefinition p = msa.getPcdBuildDefinition();\r
+                        if (p != null) {\r
+                            if (p.getPcdDataList() != null) {\r
+\r
+                                for (int indexOfPcd = 0; indexOfPcd < p.getPcdDataList().size(); indexOfPcd++) {\r
+                                    PcdData pd = p.getPcdDataList().get(indexOfPcd);\r
+                                    //\r
+                                    // Find this PCD\r
+                                    //\r
+                                    if (pd.getCName().equals(name)) {\r
+                                        //\r
+                                        // Write Module Sa Info\r
+                                        //\r
+                                        ModuleIdentification moduleSaId = GlobalData\r
+                                                                                    .findIdByGuidVersion(\r
+                                                                                                         msa\r
+                                                                                                            .getModuleGuid(),\r
+                                                                                                         msa\r
+                                                                                                            .getModuleVersion(),\r
+                                                                                                         msa\r
+                                                                                                            .getPackageGuid(),\r
+                                                                                                         msa\r
+                                                                                                            .getPackageVersion());\r
+                                        tmp = tmp\r
+                                              + TAB\r
+                                              + TAB\r
+                                              + "Module: "\r
+                                              + moduleSaId.getName()\r
+                                              + " ("\r
+                                              + Tools.getRelativePath(moduleSaId.getPath(),\r
+                                                                      Workspace.getCurrentWorkspace()) + ")"\r
+                                              + DataType.UNIX_LINE_SEPARATOR;\r
+                                        tmp = tmp + TAB + TAB + TAB + "Implementation: " + pd.getItemType().toString()\r
+                                              + DataType.UNIX_LINE_SEPARATOR;\r
+                                        tmp = tmp + TAB + TAB + TAB + "Specified / Implementation Value: "\r
+                                              + pd.getValue() + DataType.UNIX_LINE_SEPARATOR;\r
+                                        tmp = tmp + DataType.UNIX_LINE_SEPARATOR;\r
+                                    }\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            //\r
+            // Get Dynamic Pcd\r
+            //\r
+            DynamicPcdBuildDefinitions dpbd = fpd.getDynamicPcdBuildDefinitions();\r
+            if (dpbd != null) {\r
+                for (int indexOfDpbd = 0; indexOfDpbd < dpbd.getPcdBuildDataList().size(); indexOfDpbd++) {\r
+                    PcdBuildData pbd = dpbd.getPcdBuildDataList().get(indexOfDpbd);\r
+                    if (pbd != null) {\r
+                        if (pbd.getCName().equals(name)) {\r
+                            //\r
+                            // Write Dynamic Pcd Build Definition\r
+                            //\r
+                            tmp = tmp + TAB + TAB + "Dynamic Pcd Build Definition: " + DataType.UNIX_LINE_SEPARATOR;\r
+                            if (pbd.getSkuInfoList() != null) {\r
+                                for (int indexOfPcd = 0; indexOfPcd < pbd.getSkuInfoList().size(); indexOfPcd++) {\r
+                                    SkuInfo si = pbd.getSkuInfoList().get(indexOfPcd);\r
+                                    if (si != null) {\r
+                                        tmp = tmp + TAB + TAB + TAB + "Sku Id: " + si.getSkuId().toString()\r
+                                              + DataType.UNIX_LINE_SEPARATOR;\r
+                                        tmp = tmp + TAB + TAB + TAB + "Variable Name: " + si.getVariableName()\r
+                                              + DataType.UNIX_LINE_SEPARATOR;\r
+                                        tmp = tmp + TAB + TAB + TAB + "Variable GUID: " + si.getVariableGuid()\r
+                                              + DataType.UNIX_LINE_SEPARATOR;\r
+                                        tmp = tmp + TAB + TAB + TAB + "Variable Offset: " + si.getVariableOffset()\r
+                                              + DataType.UNIX_LINE_SEPARATOR;\r
+                                        tmp = tmp + TAB + TAB + TAB + "Hii Default Value: " + si.getHiiDefaultValue()\r
+                                              + DataType.UNIX_LINE_SEPARATOR;\r
+                                    }\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            //\r
+            // If not empty, write this platform info\r
+            //\r
+            if (!Tools.isEmpty(tmp)) {\r
+                tmp = TAB + "Platform: " + pid.getName() + " ("\r
+                      + Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")"\r
+                      + DataType.UNIX_LINE_SEPARATOR + tmp;\r
+                this.writeReportLn(tmp);\r
+            }\r
+        }\r
+\r
+        return reportContent;\r
+    }\r
+\r
+    //\r
+    // Create detailed information report for library\r
+    // \r
+    /**\r
+     \r
+     @param frid\r
+     @return\r
+     \r
+     **/\r
     private String createReport(FindResultId frid) {\r
         String tmp = "";\r
         String name = frid.getName();\r