1. Fix EDKT447 Keep PPI/Protocol/GUID/PCD in find result even if they are only declar...
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 31 Oct 2006 03:04:31 +0000 (03:04 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 31 Oct 2006 03:04:31 +0000 (03:04 +0000)
2. Fix EDKT448 Provide reload solution in Find Result

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

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java

index c735b5e6b4da4dc85d9039dc7e5ae7d57c885816..de67728dfc91b27ef47d87480bbd67dec266e463 100644 (file)
@@ -16,11 +16,14 @@ package org.tianocore.frameworkwizard.common.find;
 \r
 import java.util.Vector;\r
 \r
+import org.tianocore.GuidDeclarationsDocument.GuidDeclarations;\r
 import org.tianocore.LibraryClassDeclarationsDocument.LibraryClassDeclarations.LibraryClass;\r
 import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;\r
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
 import org.tianocore.PcdDeclarationsDocument.PcdDeclarations.PcdEntry;\r
+import org.tianocore.PpiDeclarationsDocument.PpiDeclarations;\r
+import org.tianocore.ProtocolDeclarationsDocument.ProtocolDeclarations;\r
 import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.GlobalData;\r
 import org.tianocore.frameworkwizard.common.Sort;\r
@@ -160,6 +163,39 @@ public class Find {
                 }\r
             }\r
         }\r
+        //\r
+        // Go through all defined ppi to find which is not added yet.\r
+        //\r
+        for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
+            PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
+            PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
+                                                                           .getId();\r
+            if (spd.getPpiDeclarations() != null) {\r
+                for (int indexOfPpis = 0; indexOfPpis < spd.getPpiDeclarations().getEntryList().size(); indexOfPpis++) {\r
+                    boolean isFound = false;\r
+                    PpiDeclarations.Entry e = spd.getPpiDeclarations().getEntryList().get(indexOfPpis);\r
+                    for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
+                        if (e.getCName().equals(pv.getPpis(indexOfPv).getName())) {\r
+                            isFound = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if (!isFound) {\r
+                        String arg0 = e.getCName();\r
+                        String arg1 = "";\r
+                        String arg2 = "";\r
+                        String arg3 = "";\r
+                        Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());\r
+                        String arg5 = e.getHelpText();\r
+\r
+                        pid = new PpisIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
+                        pid.setBelongModule(null);\r
+                        pid.setDeclaredBy(packageId);\r
+                        pv.addPpis(pid);\r
+                    }\r
+                }\r
+            }\r
+        }\r
         Sort.sortPpis(pv, DataType.SORT_TYPE_ASCENDING);\r
         return pv;\r
     }\r
@@ -197,7 +233,10 @@ public class Find {
             //\r
             // Get the sting "PackageName.ModuleName" \r
             //\r
-            String tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r
+            String tmp = "";\r
+            if (pvId.getBelongModule() != null) {\r
+                tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r
+            }\r
 \r
             //\r
             // Check if the item has been added in\r
@@ -353,6 +392,39 @@ public class Find {
                 }\r
             }\r
         }\r
+        //\r
+        // Go through all defined protocols to find which is not added yet.\r
+        //\r
+        for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
+            PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
+            PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
+                                                                           .getId();\r
+            if (spd.getProtocolDeclarations() != null) {\r
+                for (int indexOfProtocols = 0; indexOfProtocols < spd.getProtocolDeclarations().getEntryList().size(); indexOfProtocols++) {\r
+                    boolean isFound = false;\r
+                    ProtocolDeclarations.Entry e = spd.getProtocolDeclarations().getEntryList().get(indexOfProtocols);\r
+                    for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
+                        if (e.getCName().equals(pv.getProtocols(indexOfPv).getName())) {\r
+                            isFound = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if (!isFound) {\r
+                        String arg0 = e.getCName();\r
+                        String arg1 = "";\r
+                        String arg2 = "";\r
+                        String arg3 = "";\r
+                        Vector<String> arg4 = Tools.convertListToVector(e.getSupArchList());\r
+                        String arg5 = e.getHelpText();\r
+\r
+                        pid = new ProtocolsIdentification(arg0, arg1, arg2, arg3, arg4, arg5);\r
+                        pid.setBelongModule(null);\r
+                        pid.setDeclaredBy(packageId);\r
+                        pv.addProtocols(pid);\r
+                    }\r
+                }\r
+            }\r
+        }\r
         Sort.sortProtocols(pv, DataType.SORT_TYPE_ASCENDING);\r
         return pv;\r
     }\r
@@ -390,7 +462,10 @@ public class Find {
             //\r
             // Get the sting "PackageName.ModuleName" \r
             //\r
-            String tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r
+            String tmp = "";\r
+            if (pvId.getBelongModule() != null) {\r
+                tmp = pvId.getBelongModule().getPackageId().getName() + SEPERATOR + pvId.getBelongModule().getName();\r
+            }\r
 \r
             //\r
             // Check if the item has been added in\r
@@ -500,6 +575,38 @@ public class Find {
                 }\r
             }\r
         }\r
+        //\r
+        // Go through all defined guids to find which is not added yet.\r
+        //\r
+        for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
+            PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
+            PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
+                                                                           .getId();\r
+            if (spd.getGuidDeclarations() != null) {\r
+                for (int indexOfGuids = 0; indexOfGuids < spd.getGuidDeclarations().getEntryList().size(); indexOfGuids++) {\r
+                    boolean isFound = false;\r
+                    GuidDeclarations.Entry e = spd.getGuidDeclarations().getEntryList().get(indexOfGuids);\r
+                    for (int indexOfGv = 0; indexOfGv < gv.size(); indexOfGv++) {\r
+                        if (e.getCName().equals(gv.getGuids(indexOfGv).getName())) {\r
+                            isFound = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if (!isFound) {\r
+                        String arg0 = e.getCName();\r
+                        String arg1 = "";\r
+                        String arg2 = "";\r
+                        Vector<String> arg3 = Tools.convertListToVector(e.getSupArchList());\r
+                        String arg4 = e.getHelpText();\r
+\r
+                        gid = new GuidsIdentification(arg0, arg1, arg2, arg3, arg4);\r
+                        gid.setBelongModule(null);\r
+                        gid.setDeclaredBy(packageId);\r
+                        gv.addGuids(gid);\r
+                    }\r
+                }\r
+            }\r
+        }\r
         Sort.sortGuids(gv, DataType.SORT_TYPE_ASCENDING);\r
         return gv;\r
     }\r
@@ -537,7 +644,10 @@ public class Find {
             //\r
             // Get the sting "PackageName.ModuleName" \r
             //\r
-            String tmp = gvId.getBelongModule().getPackageId().getName() + SEPERATOR + gvId.getBelongModule().getName();\r
+            String tmp = "";\r
+            if (gvId.getBelongModule() != null) {\r
+                tmp = gvId.getBelongModule().getPackageId().getName() + SEPERATOR + gvId.getBelongModule().getName();\r
+            }\r
 \r
             //\r
             // Check if the item has been added in\r
@@ -656,32 +766,51 @@ public class Find {
                 }\r
             }\r
         }\r
+        //\r
+        // Go through all defined pcds to find which is not added yet.\r
+        //\r
+        for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
+            PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
+            PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
+                                                                           .getId();\r
+            if (spd.getPcdDeclarations() != null) {\r
+                for (int indexOfPcds = 0; indexOfPcds < spd.getPcdDeclarations().getPcdEntryList().size(); indexOfPcds++) {\r
+                    boolean isFound = false;\r
+                    PcdEntry e = spd.getPcdDeclarations().getPcdEntryList().get(indexOfPcds);\r
+                    for (int indexOfPv = 0; indexOfPv < pv.size(); indexOfPv++) {\r
+                        if (e.getCName().equals(pv.getPcdCoded(indexOfPv).getName())) {\r
+                            isFound = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if (!isFound) {\r
+                        pid = new PcdCodedIdentification("", "", "", null, "", "", null, null);\r
+                        pid.setName(e.getCName());\r
+                        pid.setTokenSpaceGuidCName(e.getTokenSpaceGuidCName());\r
+                        pid.setToken(e.getToken().toString());\r
+                        pid.setDatumType(e.getDatumType().toString());\r
+                        pid.setValue(e.getDefaultValue());\r
+                        pid.setUsage(Tools.convertListToString(e.getValidUsage()));\r
+                        pid.setHelp(e.getHelpText());\r
+                        pid.setDeclaredBy(packageId);\r
+\r
+                        pid.setBelongModule(null);\r
+                        pv.addPcdCoded(pid);\r
+                    }\r
+                }\r
+            }\r
+        }\r
         Sort.sortPcdCodeds(pv, DataType.SORT_TYPE_ASCENDING);\r
         return pv;\r
     }\r
 \r
     /**\r
-     Re-org all guid entries for find table\r
      \r
+     @param pv\r
      @return\r
      \r
      **/\r
-/**\r
-\r
- @return\r
-\r
-**/\r
-/**\r
-\r
- @return\r
-\r
-**/\r
-/**\r
-\r
- @return\r
-\r
-**/\r
-public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {\r
+    public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {\r
         Vector<PcdFindResultId> pcd = new Vector<PcdFindResultId>();\r
         boolean isAdded = false;\r
         boolean isProduced = false;\r
@@ -734,13 +863,14 @@ public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {
                 pcdId.setDatumType(pvId.getDatumType());\r
                 pcdId.setValue(pvId.getValue());\r
                 pcdId.setUsage(pvId.getUsage());\r
-                \r
+\r
                 pcd.addElement(pcdId);\r
             }\r
         }\r
 \r
         return pcd;\r
     }\r
+\r
     /**\r
      Get all library class entries from workspace\r
      \r
@@ -821,6 +951,38 @@ public static Vector<PcdFindResultId> getAllPcdCodedForFind(PcdCodedVector pv) {
                 }\r
             }\r
         }\r
+        //\r
+        // Go through all defined pcds to find which is not added yet.\r
+        //\r
+        for (int indexOfPackage = 0; indexOfPackage < GlobalData.openingPackageList.size(); indexOfPackage++) {\r
+            PackageSurfaceArea spd = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage).getXmlSpd();\r
+            PackageIdentification packageId = GlobalData.openingPackageList.getOpeningPackageByIndex(indexOfPackage)\r
+                                                                           .getId();\r
+            if (spd.getLibraryClassDeclarations() != null) {\r
+                for (int indexOfLibraryClass = 0; indexOfLibraryClass < spd.getLibraryClassDeclarations()\r
+                                                                           .getLibraryClassList().size(); indexOfLibraryClass++) {\r
+                    boolean isFound = false;\r
+                    LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);\r
+                    for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {\r
+                        if (lc.getName().equals(lcv.getLibraryClass(indexOfLcv).getLibraryClassName())) {\r
+                            isFound = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                    if (!isFound) {\r
+                        lcid = new LibraryClassIdentification("", null, "", "", null, "", null, "");\r
+                        lcid.setLibraryClassName(lc.getName());\r
+                        lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));\r
+                        lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));\r
+                        lcid.setHelp(lc.getHelpText());\r
+                        lcid.setDeclaredBy(packageId);\r
+\r
+                        lcid.setBelongModule(null);\r
+                        lcv.addLibraryClass(lcid);\r
+                    }\r
+                }\r
+            }\r
+        }\r
         Sort.sortLibraryClass(lcv, DataType.SORT_TYPE_ASCENDING);\r
         return lcv;\r
     }\r
index c0991025aca904b4a823deaf33a9a58a5a92b422..de6526b10c1900c6e22a0940c8b7fd8f45a20bca 100644 (file)
@@ -91,6 +91,10 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
 \r
     private Vector<PcdFindResultId> vPcdFindResult = null;\r
 \r
+    private JButton jButtonReload = null;\r
+\r
+    private JPanel jPanelOperation = null;\r
+\r
     /**\r
      * This is the default constructor\r
      */\r
@@ -130,7 +134,7 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
             jContentPane = new JPanel();\r
             jContentPane.setLayout(null);\r
             jContentPane.add(getJScrollPaneTable(), null);\r
-            jContentPane.add(getJButtonClose(), null);\r
+            jContentPane.add(getJPanelOperation(), null);\r
             jContentPane.setPreferredSize(new java.awt.Dimension(585, 445));\r
         }\r
         return jContentPane;\r
@@ -213,8 +217,8 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
             jButtonClose = new JButton();\r
             jButtonClose.setText("Close");\r
             jButtonClose.addActionListener(this);\r
-            jButtonClose.setBounds(new java.awt.Rectangle(255, 415, 80, 20));\r
             jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));\r
+            jButtonClose.setBounds(new java.awt.Rectangle(90, 0, 80, 20));\r
         }\r
         return jButtonClose;\r
     }\r
@@ -281,6 +285,8 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
      **/\r
     private void showTable() {\r
         clearAll();\r
+        this.jTable.repaint();\r
+        this.jTable.updateUI();\r
 \r
         if (this.method.equals("PPI")) {\r
             Vector<PpiId> vPpi = Find.getAllPpisForFind();\r
@@ -507,6 +513,10 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
         if (arg0.getSource() == this.jButtonClose) {\r
             this.dispose();\r
         }\r
+        \r
+        if (arg0.getSource() == this.jButtonReload) {\r
+            this.showTable();\r
+        }\r
     }\r
 \r
     /* (non-Javadoc)\r
@@ -522,7 +532,7 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
 \r
         Tools.resizeComponent(this.jScrollPaneTable, intCurrentWidth, intCurrentHeight, intPreferredWidth,\r
                               intPreferredHeight);\r
-        Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,\r
+        Tools.centerComponent(this.jPanelOperation, intCurrentWidth, intCurrentHeight, intPreferredHeight,\r
                               DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);\r
         Tools.resizeTableColumn(this.jTable, this.getSize().width - 28);\r
     }\r
@@ -605,4 +615,37 @@ public class FindResult extends IFrame implements TableModelListener, ListSelect
         // TODO Auto-generated method stub\r
 \r
     }\r
+\r
+    /**\r
+     * This method initializes jButtonReload   \r
+     *         \r
+     * @return javax.swing.JButton     \r
+     */\r
+    private JButton getJButtonReload() {\r
+        if (jButtonReload == null) {\r
+            jButtonReload = new JButton();\r
+            jButtonReload.setText("Reload");\r
+            jButtonReload.addActionListener(this);\r
+            jButtonReload.setBounds(new java.awt.Rectangle(0, 0, 80, 20));\r
+            jButtonReload.setPreferredSize(new java.awt.Dimension(80, 20));\r
+        }\r
+        return jButtonReload;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jPanelOperation \r
+     *         \r
+     * @return javax.swing.JPanel      \r
+     */\r
+    private JPanel getJPanelOperation() {\r
+        if (jPanelOperation == null) {\r
+            jPanelOperation = new JPanel();\r
+            jPanelOperation.setLayout(null);\r
+            jPanelOperation.setBounds(new java.awt.Rectangle(300, 415, 170, 20));\r
+            jPanelOperation.setPreferredSize(new java.awt.Dimension(170, 20));\r
+            jPanelOperation.add(getJButtonClose(), null);\r
+            jPanelOperation.add(getJButtonReload(), null);\r
+        }\r
+        return jPanelOperation;\r
+    }\r
 }\r