1. Fix EDKT339 Library Class Search need to get info for selected library class
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Oct 2006 00:58:22 +0000 (00:58 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Oct 2006 00:58:22 +0000 (00:58 +0000)
2. Fix EDKT303 Give warning if no library instances that support the required the library class

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

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/GlobalData.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/Find.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResult.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java [new file with mode: 0644]
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java [new file with mode: 0644]
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/LibraryClass/LibraryClassVector.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/Identifications/ModuleIdentification.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/LibraryClassDefsDlg.java
Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java

index e83a95bbad5d35b1caa356fdeaa183bfcac52b3c..b9462351b97369fb3cb97412692d3d506aac126e 100644 (file)
@@ -199,4 +199,25 @@ public class GlobalData {
         }\r
         return modulePath;\r
     }\r
+    \r
+    /**\r
+     Get a module id\r
+     \r
+     @param moduleGuid\r
+     @param moduleVersion\r
+     @param packageGuid\r
+     @param packageVersion\r
+     @return\r
+    \r
+    **/\r
+    public static ModuleIdentification findIdByGuidVersion(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {\r
+        ModuleIdentification mid = null;\r
+        for (int index = 0; index < vModuleList.size(); index++) {\r
+            if (vModuleList.elementAt(index).equals(moduleGuid, moduleVersion, packageGuid, packageVersion)) {\r
+                mid = vModuleList.elementAt(index);\r
+                break;\r
+            }\r
+        }\r
+        return mid;\r
+    }\r
 }\r
index 90c38fd8fe32c719184bb225a030a9283dccf619..fe6496199d5cae39abdfba236eff73b3e55cba4f 100644 (file)
@@ -231,10 +231,12 @@ public class Tools {
         //\r
         // remove file separator of rear\r
         //\r
-        if (path.length() > 0 && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {\r
+        if (path.length() > 0\r
+            && path.indexOf(DataType.DOS_FILE_SEPARATOR) == path.length() - DataType.DOS_FILE_SEPARATOR.length()) {\r
             path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());\r
         }\r
-        if (path.length() > 0 && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {\r
+        if (path.length() > 0\r
+            && path.indexOf(DataType.UNIX_FILE_SEPARATOR) == path.length() - DataType.UNIX_FILE_SEPARATOR.length()) {\r
             path = path.substring(0, path.length() - DataType.DOS_FILE_SEPARATOR.length());\r
         }\r
         //\r
@@ -261,6 +263,35 @@ public class Tools {
         return v;\r
     }\r
 \r
+    /**\r
+     Convert a Vector to a String, separator with ", "\r
+     \r
+     @param v\r
+     @return\r
+     \r
+     **/\r
+    public static String convertVectorToString(Vector<String> v) {\r
+        String s = "";\r
+        for (int index = 0; index < v.size(); index++) {\r
+            s = s + v.elementAt(index).toString() + ", ";\r
+        }\r
+        if (s.length() > 0) {\r
+            s = s.substring(0, s.length() - ", ".length());\r
+        }\r
+        return s;\r
+    }\r
+\r
+    /**\r
+     Convert a List to a String\r
+     \r
+     @param list\r
+     @return\r
+     \r
+     **/\r
+    public static String convertListToString(List list) {\r
+        return Tools.convertVectorToString(Tools.convertListToVector(list));\r
+    }\r
+\r
     /**\r
      If the input path missing ext, append the ext to the path\r
      \r
@@ -339,7 +370,7 @@ public class Tools {
         if (arg0.length() <= 0) {\r
             return "";\r
         }\r
-        \r
+\r
         //\r
         // Convert string to array by " "\r
         //\r
@@ -553,14 +584,14 @@ public class Tools {
         resizeComponentWidth(c, containerWidth, preferredWidth);\r
         resizeComponentHeight(c, containerHeight, preferredHeight);\r
     }\r
-    \r
+\r
     /**\r
      To adjust each column's width to meet the table's size\r
      \r
      @param t the table need to be adjusted\r
      @param width the new width of the table\r
-    \r
-    **/\r
+     \r
+     **/\r
     public static void resizeTableColumn(JTable t, int width) {\r
         if (t != null) {\r
             int columnCount = t.getColumnCount();\r
index 08bae58d2b6c15365f829c73e6e374316ef79e42..c0019c8049b1757925d84b6ddb957b8b6b33db30 100644 (file)
@@ -16,6 +16,7 @@ package org.tianocore.frameworkwizard.common.find;
 \r
 import java.util.Vector;\r
 \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
@@ -781,8 +782,11 @@ public class Find {
                                                                                                .getLibraryClassDeclarations()\r
                                                                                                .getLibraryClassList()\r
                                                                                                .size(); indexOfLibraryClass++) {\r
-                                        if (spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass)\r
-                                               .getName().equals(name)) {\r
+                                        LibraryClass lc = spd.getLibraryClassDeclarations().getLibraryClassList().get(indexOfLibraryClass);\r
+                                        if (lc.getName().equals(name)) {\r
+                                            lcid.setSupArchList(Tools.convertListToVector(lc.getSupArchList()));\r
+                                            lcid.setSupModuleList(Tools.convertListToVector(lc.getSupModuleList()));\r
+                                            lcid.setHelp(lc.getHelpText());\r
                                             lcid.setDeclaredBy(packageId);\r
                                             break;\r
                                         }\r
@@ -809,9 +813,72 @@ public class Find {
      @return\r
      \r
      **/\r
-    public static Vector<LibraryClassId> getAllLibraryClassForFind() {\r
-        Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();\r
-        LibraryClassVector lcv = Find.getAllLibraryClassVector();\r
+    //    public static Vector<LibraryClassId> getAllLibraryClassForFind(LibraryClassVector lcv) {\r
+    //        Vector<LibraryClassId> libraryClass = new Vector<LibraryClassId>();\r
+    //        boolean isAdded = false;\r
+    //        boolean isProduced = false;\r
+    //\r
+    //        //\r
+    //        // Go through pv to add item as new format to ppi one by one\r
+    //        //\r
+    //        for (int indexOfLcv = 0; indexOfLcv < lcv.size(); indexOfLcv++) {\r
+    //            isAdded = false;\r
+    //            LibraryClassIdentification lcvId = lcv.getLibraryClass(indexOfLcv);\r
+    //\r
+    //            //\r
+    //            // First check if produced or not\r
+    //            //\r
+    //            if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
+    //                || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
+    //                isProduced = true;\r
+    //            } else if (lcvId.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED)\r
+    //                       || lcvId.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
+    //                isProduced = false;\r
+    //            }\r
+    //\r
+    //            //\r
+    //            // Get the string "PackageName.ModuleName" \r
+    //            //\r
+    //            String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR\r
+    //                         + lcvId.getBelongModule().getName();\r
+    //\r
+    //            //\r
+    //            // Check if the item has been added in\r
+    //            // If added, append package name and new module name\r
+    //            // If not added, add a new one first\r
+    //            //\r
+    //            for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {\r
+    //                LibraryClassId lcId = libraryClass.get(indexOfGuid);\r
+    //\r
+    //                if (lcvId.getLibraryClassName().equals(lcId.getName())) {\r
+    //                    if (isProduced) {\r
+    //                        libraryClass.get(indexOfGuid).setProducedModules(lcId.getProducedModules() + "<br>" + tmp);\r
+    //                    } else if (!isProduced) {\r
+    //                        libraryClass.get(indexOfGuid).setConsumedModules(lcId.getConsumedModules() + "<br>" + tmp);\r
+    //                    }\r
+    //                    isAdded = true;\r
+    //                    continue;\r
+    //                }\r
+    //            }\r
+    //\r
+    //            //\r
+    //            // Add a new one\r
+    //            //\r
+    //            if (!isAdded) {\r
+    //                if (isProduced) {\r
+    //                    libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", tmp, null,\r
+    //                                                               lcvId.getDeclaredBy().getName()));\r
+    //                } else if (!isProduced) {\r
+    //                    libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", null, tmp,\r
+    //                                                               lcvId.getDeclaredBy().getName()));\r
+    //                }\r
+    //            }\r
+    //        }\r
+    //\r
+    //        return libraryClass;\r
+    //    }\r
+    public static Vector<FindResultId> getAllLibraryClassForFind(LibraryClassVector lcv) {\r
+        Vector<FindResultId> libraryClass = new Vector<FindResultId>();\r
         boolean isAdded = false;\r
         boolean isProduced = false;\r
 \r
@@ -833,25 +900,19 @@ public class Find {
                 isProduced = false;\r
             }\r
 \r
-            //\r
-            // Get the string "PackageName.ModuleName" \r
-            //\r
-            String tmp = lcvId.getBelongModule().getPackageId().getName() + SEPERATOR\r
-                         + lcvId.getBelongModule().getName();\r
-\r
             //\r
             // Check if the item has been added in\r
             // If added, append package name and new module name\r
             // If not added, add a new one first\r
             //\r
             for (int indexOfGuid = 0; indexOfGuid < libraryClass.size(); indexOfGuid++) {\r
-                LibraryClassId lcId = libraryClass.get(indexOfGuid);\r
+                FindResultId frId = libraryClass.get(indexOfGuid);\r
 \r
-                if (lcvId.getLibraryClassName().equals(lcId.getName())) {\r
+                if (lcvId.getLibraryClassName().equals(frId.getName())) {\r
                     if (isProduced) {\r
-                        libraryClass.get(indexOfGuid).setProducedModules(lcId.getProducedModules() + "<br>" + tmp);\r
+                        libraryClass.get(indexOfGuid).addProducedModules(lcvId.getBelongModule());\r
                     } else if (!isProduced) {\r
-                        libraryClass.get(indexOfGuid).setConsumedModules(lcId.getConsumedModules() + "<br>" + tmp);\r
+                        libraryClass.get(indexOfGuid).addConsumedModules(lcvId.getBelongModule());\r
                     }\r
                     isAdded = true;\r
                     continue;\r
@@ -862,13 +923,9 @@ public class Find {
             // Add a new one\r
             //\r
             if (!isAdded) {\r
-                if (isProduced) {\r
-                    libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", tmp, null,\r
-                                                               lcvId.getDeclaredBy().getName()));\r
-                } else if (!isProduced) {\r
-                    libraryClass.addElement(new LibraryClassId(lcvId.getLibraryClassName(), "Library Class", null, tmp,\r
-                                                               lcvId.getDeclaredBy().getName()));\r
-                }\r
+                libraryClass.addElement(new FindResultId(lcvId.getLibraryClassName(), "Library Class",\r
+                                                         lcvId.getSupArchList(), lcvId.getHelp(),\r
+                                                         lcvId.getSupModuleList(), lcvId.getDeclaredBy()));\r
             }\r
         }\r
 \r
index 5dcc7aa944570988da3484c8cfe14d28f3596ce7..da9a7de546cd105b3427d97d0c1e189b285d42da 100644 (file)
@@ -17,7 +17,8 @@ package org.tianocore.frameworkwizard.common.find;
 import java.awt.Dimension;\r
 import java.awt.event.ActionEvent;\r
 import java.awt.event.ComponentEvent;\r
-import java.awt.event.ComponentListener;\r
+import java.awt.event.MouseEvent;\r
+import java.awt.event.MouseListener;\r
 import java.awt.event.WindowEvent;\r
 import java.util.Vector;\r
 \r
@@ -28,6 +29,8 @@ import javax.swing.JScrollPane;
 import javax.swing.JTable;\r
 import javax.swing.ListSelectionModel;\r
 import javax.swing.SwingConstants;\r
+import javax.swing.event.ListSelectionEvent;\r
+import javax.swing.event.ListSelectionListener;\r
 import javax.swing.event.TableModelEvent;\r
 import javax.swing.event.TableModelListener;\r
 import javax.swing.table.DefaultTableCellRenderer;\r
@@ -37,8 +40,10 @@ import org.tianocore.frameworkwizard.common.IDefaultTableModel;
 import org.tianocore.frameworkwizard.common.Log;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.ui.IFrame;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.LibraryClass.LibraryClassVector;\r
 \r
-public class FindResult extends IFrame implements TableModelListener, ComponentListener {\r
+public class FindResult extends IFrame implements TableModelListener, ListSelectionListener, MouseListener {\r
 \r
     ///\r
     /// Define class Serial Version UID\r
@@ -75,6 +80,12 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
 \r
     private static FindResult findLibraryClassResult = null;\r
 \r
+    private int selectedRow = -1;\r
+\r
+    private LibraryClassVector lcv = null;\r
+\r
+    private Vector<FindResultId> vLibraryClassFindResult = null;\r
+\r
     /**\r
      * This is the default constructor\r
      */\r
@@ -160,7 +171,9 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
             jTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF);\r
             jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
 \r
+            jTable.getSelectionModel().addListSelectionListener(this);\r
             jTable.getModel().addTableModelListener(this);\r
+            jTable.addMouseListener(this);\r
 \r
             model.addColumn("Name");\r
             model.addColumn("Type");\r
@@ -173,12 +186,7 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
             jTable.getColumn("Produced by").setCellRenderer(new MyTableCellRenderer());\r
             jTable.getColumn("Consumed by").setCellRenderer(new MyTableCellRenderer());\r
             jTable.getColumn("Declared by").setCellRenderer(new MyTableCellRenderer());\r
-            \r
-//            jTable.getColumn("Name").setPreferredWidth((this.getSize().width - 30) / 5);\r
-//            jTable.getColumn("Type").setPreferredWidth((this.getSize().width - 30) / 5);\r
-//            jTable.getColumn("Produced by").setPreferredWidth((this.getSize().width - 30) / 5);\r
-//            jTable.getColumn("Consumed by").setPreferredWidth((this.getSize().width - 30) / 5);\r
-//            jTable.getColumn("Declared by").setPreferredWidth((this.getSize().width - 30) / 5);\r
+\r
             int columnWidth = (this.getSize().width - 28) / 5;\r
             jTable.getColumn("Name").setPreferredWidth(columnWidth);\r
             jTable.getColumn("Type").setPreferredWidth(columnWidth);\r
@@ -402,29 +410,49 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
         }\r
 \r
         if (this.method.equals("LIBRARY_CLASS")) {\r
-            Vector<LibraryClassId> vLibraryClass = Find.getAllLibraryClassForFind();\r
-\r
-            if (vLibraryClass.size() > 0) {\r
+            lcv = Find.getAllLibraryClassVector();\r
+            vLibraryClassFindResult = Find.getAllLibraryClassForFind(lcv);\r
 \r
-                for (int index = 0; index < vLibraryClass.size(); index++) {\r
+            if (vLibraryClassFindResult.size() > 0) {\r
+                for (int index = 0; index < vLibraryClassFindResult.size(); index++) {\r
                     Vector<String> v = new Vector<String>();\r
-                    v.addElement(vLibraryClass.elementAt(index).getName());\r
-                    v.addElement(vLibraryClass.elementAt(index).getType());\r
-                    String strProducedModules = vLibraryClass.elementAt(index).getProducedModules();\r
+                    v.addElement(vLibraryClassFindResult.elementAt(index).getName());\r
+                    v.addElement(vLibraryClassFindResult.elementAt(index).getType());\r
+\r
+                    //\r
+                    // Generate Produced Modules List\r
+                    //\r
+                    String strProducedModules = "";\r
+                    Vector<ModuleIdentification> vModule = vLibraryClassFindResult.elementAt(index)\r
+                                                                                  .getProducedModules();\r
+                    for (int indexOfPM = 0; indexOfPM < vModule.size(); indexOfPM++) {\r
+                        strProducedModules = strProducedModules + "<br>"\r
+                                             + vModule.get(indexOfPM).getPackageId().getName() + "."\r
+                                             + vModule.get(indexOfPM).getName();\r
+                    }\r
                     if (strProducedModules.indexOf("<br>") == 0) {\r
                         strProducedModules = strProducedModules.substring("<br>".length());\r
                     }\r
                     int line1 = Tools.getSpecificStringCount(strProducedModules, "<br>");\r
                     v.addElement("<html>" + strProducedModules + "</html>");\r
 \r
-                    String strConsumedModules = vLibraryClass.elementAt(index).getConsumedModules();\r
+                    //\r
+                    // Generate Consumed Modules List\r
+                    //\r
+                    String strConsumedModules = "";\r
+                    vModule = vLibraryClassFindResult.elementAt(index).getConsumedModules();\r
+                    for (int indexOfCM = 0; indexOfCM < vModule.size(); indexOfCM++) {\r
+                        strConsumedModules = strConsumedModules + "<br>"\r
+                                             + vModule.get(indexOfCM).getPackageId().getName() + "."\r
+                                             + vModule.get(indexOfCM).getName();\r
+                    }\r
                     if (strConsumedModules.indexOf("<br>") == 0) {\r
                         strConsumedModules = strConsumedModules.substring("<br>".length());\r
                     }\r
                     int line2 = Tools.getSpecificStringCount(strConsumedModules, "<br>");\r
                     v.addElement("<html>" + strConsumedModules + "</html>");\r
 \r
-                    v.addElement(vLibraryClass.elementAt(index).getDeclaredBy());\r
+                    v.addElement(vLibraryClassFindResult.elementAt(index).getDeclaredBy().getName());\r
 \r
                     model.addRow(v);\r
                     jTable.setRowHeight(index, (Math.max(line1, line2) > 1 ? Math.max(line1, line2) : 1) * 18);\r
@@ -443,9 +471,12 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
 \r
     }\r
 \r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
+     *\r
+     */\r
     public void actionPerformed(ActionEvent arg0) {\r
         if (arg0.getSource() == this.jButtonClose) {\r
-\r
             this.dispose();\r
         }\r
     }\r
@@ -468,6 +499,39 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
         Tools.resizeTableColumn(this.jTable, this.getSize().width - 28);\r
     }\r
 \r
+    /* (non-Javadoc)\r
+     * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent)\r
+     *\r
+     */\r
+    public void valueChanged(ListSelectionEvent arg0) {\r
+        if (arg0.getValueIsAdjusting()) {\r
+            return;\r
+        }\r
+        ListSelectionModel lsm = (ListSelectionModel) arg0.getSource();\r
+        if (lsm.isSelectionEmpty()) {\r
+            return;\r
+        } else {\r
+            selectedRow = lsm.getMinSelectionIndex();\r
+        }\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)\r
+     *\r
+     */\r
+    public void mouseClicked(MouseEvent arg0) {\r
+        if (arg0.getClickCount() == 2) {\r
+            if (this.selectedRow < 0) {\r
+                return;\r
+            } else {\r
+                if (this.method.equals("LIBRARY_CLASS")) {\r
+                    FindResultDetailInfo frdi = new FindResultDetailInfo(vLibraryClassFindResult.elementAt(selectedRow));\r
+                    frdi.setVisible(true);\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
     /* (non-Javadoc)\r
      * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)\r
      *\r
@@ -480,7 +544,7 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
 \r
     class MyTableCellRenderer extends DefaultTableCellRenderer {\r
         ///\r
-        ///\r
+        /// Define Class Serial Version UID\r
         ///\r
         private static final long serialVersionUID = -2082787479305255946L;\r
 \r
@@ -490,4 +554,23 @@ public class FindResult extends IFrame implements TableModelListener, ComponentL
         }\r
     }\r
 \r
+    public void mousePressed(MouseEvent e) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    public void mouseReleased(MouseEvent e) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    public void mouseEntered(MouseEvent e) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
+\r
+    public void mouseExited(MouseEvent e) {\r
+        // TODO Auto-generated method stub\r
+\r
+    }\r
 }\r
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultDetailInfo.java
new file mode 100644 (file)
index 0000000..0788d67
--- /dev/null
@@ -0,0 +1,408 @@
+/** @file\r
+\r
+ The file is used to show detailed information of one of find results\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
+ **/\r
+package org.tianocore.frameworkwizard.common.find;\r
+\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.ComponentEvent;\r
+import java.awt.event.WindowEvent;\r
+import java.util.Vector;\r
+\r
+import javax.swing.JButton;\r
+import javax.swing.JFrame;\r
+import javax.swing.JPanel;\r
+import javax.swing.JScrollPane;\r
+import javax.swing.JTextArea;\r
+\r
+import org.tianocore.FrameworkModulesDocument.FrameworkModules;\r
+import org.tianocore.LibrariesDocument.Libraries;\r
+import org.tianocore.LibrariesDocument.Libraries.Instance;\r
+import org.tianocore.LibraryClassDocument.LibraryClass;\r
+import org.tianocore.ModuleSADocument.ModuleSA;\r
+import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
+import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea;\r
+import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea;\r
+import org.tianocore.frameworkwizard.common.DataType;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
+import org.tianocore.frameworkwizard.common.Tools;\r
+import org.tianocore.frameworkwizard.common.ui.IFrame;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.platform.PlatformIdentification;\r
+import org.tianocore.frameworkwizard.workspace.Workspace;\r
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;\r
+\r
+public class FindResultDetailInfo extends IFrame {\r
+\r
+    ///\r
+    /// Define class Serial Version UID\r
+    ///\r
+    private static final long serialVersionUID = -4888295869041881282L;\r
+\r
+    private JPanel jContentPane = null;\r
+\r
+    private JScrollPane jScrollPane = null;\r
+\r
+    private JTextArea jTextArea = null;\r
+\r
+    private JButton jButtonClose = null;\r
+\r
+    //\r
+    // Not for UI\r
+    //\r
+    private static String TAB = "  ";\r
+\r
+    private String reportContent = "";\r
+\r
+    private WorkspaceTools wt = new WorkspaceTools();\r
+\r
+    /**\r
+     * This method initializes jScrollPane     \r
+     *         \r
+     * @return javax.swing.JScrollPane \r
+     */\r
+    private JScrollPane getJScrollPane() {\r
+        if (jScrollPane == null) {\r
+            jScrollPane = new JScrollPane();\r
+            jScrollPane.setBounds(new java.awt.Rectangle(5, 5, 535, 280));\r
+            jScrollPane.setPreferredSize(new java.awt.Dimension(535, 280));\r
+            jScrollPane.setViewportView(getJTextArea());\r
+        }\r
+        return jScrollPane;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jTextArea       \r
+     *         \r
+     * @return javax.swing.JTextArea   \r
+     */\r
+    private JTextArea getJTextArea() {\r
+        if (jTextArea == null) {\r
+            jTextArea = new JTextArea();\r
+            jTextArea.setEditable(false);\r
+        }\r
+        return jTextArea;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jButtonClose    \r
+     *         \r
+     * @return javax.swing.JButton     \r
+     */\r
+    private JButton getJButtonClose() {\r
+        if (jButtonClose == null) {\r
+            jButtonClose = new JButton();\r
+            jButtonClose.setBounds(new java.awt.Rectangle(240, 290, 80, 20));\r
+            jButtonClose.setPreferredSize(new java.awt.Dimension(80, 20));\r
+            jButtonClose.addActionListener(this);\r
+            jButtonClose.setText("Close");\r
+        }\r
+        return jButtonClose;\r
+    }\r
+\r
+    /**\r
+     \r
+     @param lci\r
+     \r
+     **/\r
+    public FindResultDetailInfo(FindResultId 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
+    private String createReport(FindResultId frid) {\r
+        String tmp = "";\r
+        String name = frid.getName();\r
+\r
+        //\r
+        // Write Class Name\r
+        //\r
+        writeReportLn(name);\r
+\r
+        //\r
+        // Write Provided Package\r
+        //\r
+        writeReportLn(TAB + "Provided by: " + frid.getDeclaredBy().getName() + " ("\r
+                      + Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace()) + ")");\r
+\r
+        //\r
+        // Write Header File\r
+        //\r
+        PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(frid.getDeclaredBy());\r
+        tmp = Tools.getRelativePath(frid.getDeclaredBy().getPath(), Workspace.getCurrentWorkspace());\r
+        writeReportLn(TAB + "Header File: " + Tools.getFilePathOnly(tmp)\r
+                      + wt.getHeaderFileFromPackageByLibraryClassName(spd, name));\r
+\r
+        //\r
+        // Write Supported Module Types\r
+        //\r
+        writeReportLn(TAB + "Supported Module Types: " + Tools.convertVectorToString(frid.getModuleType()));\r
+\r
+        //\r
+        // Write Supported Arch\r
+        //\r
+        writeReportLn(TAB + "Supported Architectures: " + Tools.convertVectorToString(frid.getArch()));\r
+\r
+        //\r
+        // Write Help Text\r
+        //\r
+        writeReportLn(TAB + "Help Text: ");\r
+        writeReportLn(TAB + TAB + frid.getHelp());\r
+\r
+        //\r
+        // Write an empty line\r
+        //\r
+        writeReportLn("");\r
+\r
+        //\r
+        // Write Instances\r
+        //\r
+        writeReportLn("Library Instances:");\r
+\r
+        //\r
+        // Write Instances One by One\r
+        //\r
+        for (int index = 0; index < frid.getProducedModules().size(); index++) {\r
+            ModuleIdentification mid = frid.getProducedModules().get(index);\r
+            ModuleSurfaceArea msa = GlobalData.openingModuleList.getModuleSurfaceAreaFromId(mid);\r
+            if (msa != null) {\r
+                //\r
+                // Write Instance Name\r
+                //\r
+                if (msa.getMsaHeader() != null) {\r
+                    writeReportLn(TAB + msa.getMsaHeader().getModuleName());\r
+                }\r
+\r
+                //\r
+                // Write Msa File Name\r
+                //\r
+                writeReportLn(TAB + TAB + "Provided by: "\r
+                              + Tools.getRelativePath(mid.getPath(), Workspace.getCurrentWorkspace()));\r
+\r
+                //\r
+                // Find the produced library class\r
+                //\r
+                if (msa.getLibraryClassDefinitions() != null) {\r
+                    for (int indexL = 0; indexL < msa.getLibraryClassDefinitions().getLibraryClassList().size(); indexL++) {\r
+                        LibraryClass lc = msa.getLibraryClassDefinitions().getLibraryClassList().get(indexL);\r
+                        if (lc.getKeyword().equals(name)) {\r
+                            //\r
+                            // Write Supported Module Types\r
+                            //\r
+                            writeReportLn(TAB + TAB + "Supported Module Types: "\r
+                                          + Tools.convertListToString(lc.getSupModuleList()));\r
+\r
+                            //\r
+                            // Write Supported Arch\r
+                            //\r
+                            writeReportLn(TAB + TAB + "Supported Architectures: "\r
+                                          + Tools.convertListToString(lc.getSupArchList()));\r
+\r
+                            //\r
+                            // Write Help Text\r
+                            //\r
+                            writeReportLn(TAB + TAB + "Help Text: ");\r
+                            writeReportLn(TAB + TAB + (lc.getHelpText() == null ? "" : lc.getHelpText()));\r
+                        }\r
+                    }\r
+                }\r
+\r
+            }\r
+        }\r
+\r
+        //\r
+        // Write an empty line\r
+        //\r
+        writeReportLn("");\r
+\r
+        //\r
+        // Write all modules which consumed this library\r
+        //\r
+        writeReportLn("Modules Requiring " + name + ":");\r
+        for (int index = 0; index < frid.getConsumedModules().size(); index++) {\r
+            //\r
+            // Write\r
+            //\r
+            writeReportLn(TAB\r
+                          + frid.getConsumedModules().get(index).getName()\r
+                          + " ("\r
+                          + Tools.getRelativePath(frid.getConsumedModules().get(index).getPath(),\r
+                                                  Workspace.getCurrentWorkspace()) + ")");\r
+        }\r
+\r
+        //\r
+        // Write an empty line\r
+        //\r
+        writeReportLn("");\r
+\r
+        //\r
+        // Write platforms using the library class instances\r
+        //\r
+        writeReportLn("Platforms Using " + name + ":");\r
+\r
+        //\r
+        // Write Instances One by One as Using Platforms\r
+        //\r
+        for (int index = 0; index < frid.getProducedModules().size(); index++) {\r
+            ModuleIdentification mid = frid.getProducedModules().get(index);\r
+\r
+            //\r
+            // Write Instance Name \r
+            //\r
+            writeReportLn(TAB + mid.getName());\r
+\r
+            //\r
+            // Go through each platform one by one\r
+            //\r
+            for (int indexOfPlatform = 0; indexOfPlatform < GlobalData.openingPlatformList.size(); indexOfPlatform++) {\r
+                PlatformSurfaceArea fpd = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)\r
+                                                                        .getXmlFpd();\r
+                PlatformIdentification pid = GlobalData.openingPlatformList.getOpeningPlatformByIndex(indexOfPlatform)\r
+                                                                           .getId();\r
+                Vector<ModuleIdentification> vModuleSa = new Vector<ModuleIdentification>();\r
+                if (fpd != null) {\r
+                    FrameworkModules fm = fpd.getFrameworkModules();\r
+                    if (fm != null) {\r
+                        for (int indexOfModule = 0; indexOfModule < fm.getModuleSAList().size(); indexOfModule++) {\r
+                            ModuleSA msa = fm.getModuleSAList().get(indexOfModule);\r
+                            if (msa != null) {\r
+                                Libraries l = msa.getLibraries();\r
+                                if (l != null) {\r
+                                    if (l.getInstanceList() != null) {\r
+                                        for (int indexOfInstance = 0; indexOfInstance < l.getInstanceList().size(); indexOfInstance++) {\r
+                                            Instance i = l.getInstanceList().get(indexOfInstance);\r
+                                            if (mid.equals(i.getModuleGuid(), i.getModuleVersion(), i.getPackageGuid(),\r
+                                                           i.getPackageVersion())) {\r
+                                                ModuleIdentification moduleSaId = GlobalData\r
+                                                                                            .findIdByGuidVersion(\r
+                                                                                                                 msa\r
+                                                                                                                    .getModuleGuid(),\r
+                                                                                                                 msa\r
+                                                                                                                    .getModuleVersion(),\r
+                                                                                                                 msa\r
+                                                                                                                    .getPackageGuid(),\r
+                                                                                                                 msa\r
+                                                                                                                    .getPackageVersion());\r
+                                                if (moduleSaId != null) {\r
+                                                    vModuleSa.addElement(moduleSaId);\r
+                                                }\r
+                                            }\r
+                                        }\r
+                                    }\r
+                                }\r
+                            }\r
+                        }\r
+\r
+                        //\r
+                        // Get finded moduleSa in this spd\r
+                        //\r
+                        if (vModuleSa.size() > 0) {\r
+                            writeReportLn(TAB + TAB + pid.getName() + " ("\r
+                                          + Tools.getRelativePath(pid.getPath(), Workspace.getCurrentWorkspace()) + ")");\r
+                            for (int indexOfModuleSa = 0; indexOfModuleSa < vModuleSa.size(); indexOfModuleSa++) {\r
+                                writeReportLn(TAB\r
+                                              + TAB\r
+                                              + TAB\r
+                                              + vModuleSa.elementAt(indexOfModuleSa).getName()\r
+                                              + " ("\r
+                                              + Tools.getRelativePath(vModuleSa.elementAt(indexOfModuleSa).getPath(),\r
+                                                                      Workspace.getCurrentWorkspace()) + ")");\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+            writeReportLn("");\r
+        }\r
+\r
+        return this.reportContent;\r
+    }\r
+\r
+    /**\r
+     * This method initializes this\r
+     * \r
+     * @return void\r
+     */\r
+    private void init() {\r
+        this.setSize(550, 380);\r
+        this.setContentPane(getJContentPane());\r
+        this.setTitle("JFrame");\r
+        this.setResizable(true);\r
+        this.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);\r
+        this.centerWindow();\r
+\r
+    }\r
+\r
+    /**\r
+     * This method initializes jContentPane\r
+     * \r
+     * @return javax.swing.JPanel\r
+     */\r
+    private JPanel getJContentPane() {\r
+        if (jContentPane == null) {\r
+            jContentPane = new JPanel();\r
+            jContentPane.setLayout(null);\r
+            jContentPane.setSize(new java.awt.Dimension(550, 350));\r
+            jContentPane.add(getJScrollPane(), null);\r
+            jContentPane.add(getJButtonClose(), null);\r
+\r
+            jContentPane.setPreferredSize(new java.awt.Dimension(550, 340));\r
+        }\r
+        return jContentPane;\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.WindowListener#windowClosing(java.awt.event.WindowEvent)\r
+     *\r
+     * Override windowClosing to popup warning message to confirm quit\r
+     * \r
+     */\r
+    public void windowClosing(WindowEvent arg0) {\r
+        this.dispose();\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)\r
+     * \r
+     * Override componentResized to resize all components when frame's size is changed\r
+     */\r
+    public void componentResized(ComponentEvent arg0) {\r
+        int intCurrentWidth = this.getJContentPane().getWidth();\r
+        int intCurrentHeight = this.getJContentPane().getHeight();\r
+        int intPreferredWidth = this.getJContentPane().getPreferredSize().width;\r
+        int intPreferredHeight = this.getJContentPane().getPreferredSize().height;\r
+\r
+        Tools.resizeComponent(this.jScrollPane, intCurrentWidth, intCurrentHeight, intPreferredWidth,\r
+                              intPreferredHeight);\r
+        Tools.centerComponent(this.jButtonClose, intCurrentWidth, intCurrentHeight, intPreferredHeight,\r
+                              DataType.SPACE_TO_BOTTOM_FOR_CLOSE_BUTTON);\r
+    }\r
+\r
+    /* (non-Javadoc)\r
+     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)\r
+     *\r
+     */\r
+    public void actionPerformed(ActionEvent arg0) {\r
+        if (arg0.getSource() == this.jButtonClose) {\r
+            this.dispose();\r
+        }\r
+    }\r
+\r
+    private void writeReportLn(String line) {\r
+        this.reportContent = this.reportContent + line + DataType.LINE_SEPARATOR;\r
+    }\r
+}\r
diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/find/FindResultId.java
new file mode 100644 (file)
index 0000000..3784fb3
--- /dev/null
@@ -0,0 +1,124 @@
+/** @file\r
+\r
+ The file is used to define GUID Identification used by find function\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
+ **/\r
+package org.tianocore.frameworkwizard.common.find;\r
+\r
+import java.util.Vector;\r
+\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
+import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
+\r
+public class FindResultId {\r
+\r
+    private String name = "";\r
+\r
+    private String type = "";\r
+    \r
+    private Vector<String> arch = new Vector<String>();\r
+    \r
+    private Vector<String> moduleType = new Vector<String>();\r
+    \r
+    private String help = "";\r
+\r
+    private Vector<ModuleIdentification> producedModules = new Vector<ModuleIdentification>();\r
+\r
+    private Vector<ModuleIdentification> consumedModules = new Vector<ModuleIdentification>();\r
+    \r
+    private PackageIdentification declaredBy = null;\r
+    \r
+    public FindResultId(String strName, String strType, Vector<String> vArch, String strHelp, Vector<String> vModuleType, PackageIdentification pDeclaredBy) {\r
+        this.name = (strName == null ? "" : strName);\r
+        this.type = (strType == null ? "" : strType);\r
+        this.arch = (vArch == null ? this.arch : vArch);\r
+        this.help = (strHelp == null ? "" : strHelp);\r
+        this.moduleType = (vModuleType == null ? this.moduleType : vModuleType);\r
+        this.declaredBy = pDeclaredBy;\r
+    }\r
+\r
+    public Vector<String> getArch() {\r
+        return arch;\r
+    }\r
+\r
+    public void setArch(Vector<String> arch) {\r
+        this.arch = arch;\r
+    }\r
+\r
+    public Vector<ModuleIdentification> getConsumedModules() {\r
+        return consumedModules;\r
+    }\r
+\r
+    public void setConsumedModules(Vector<ModuleIdentification> consumedModules) {\r
+        this.consumedModules = consumedModules;\r
+    }\r
+    \r
+    public void addConsumedModules(ModuleIdentification consumedModule) {\r
+        if (consumedModule != null) {\r
+            this.consumedModules.addElement(consumedModule);\r
+        }\r
+    }\r
+\r
+    public PackageIdentification getDeclaredBy() {\r
+        return declaredBy;\r
+    }\r
+\r
+    public void setDeclaredBy(PackageIdentification declaredBy) {\r
+        this.declaredBy = declaredBy;\r
+    }\r
+\r
+    public String getHelp() {\r
+        return help;\r
+    }\r
+\r
+    public void setHelp(String help) {\r
+        this.help = help;\r
+    }\r
+\r
+    public String getName() {\r
+        return name;\r
+    }\r
+\r
+    public void setName(String name) {\r
+        this.name = name;\r
+    }\r
+\r
+    public Vector<ModuleIdentification> getProducedModules() {\r
+        return producedModules;\r
+    }\r
+\r
+    public void setProducedModules(Vector<ModuleIdentification> producedModules) {\r
+        this.producedModules = producedModules;\r
+    }\r
+    \r
+    public void addProducedModules(ModuleIdentification producedModule) {\r
+        if (producedModule != null) {\r
+            this.producedModules.addElement(producedModule);\r
+        }\r
+    }\r
+\r
+    public String getType() {\r
+        return type;\r
+    }\r
+\r
+    public void setType(String type) {\r
+        this.type = type;\r
+    }\r
+\r
+    public Vector<String> getModuleType() {\r
+        return moduleType;\r
+    }\r
+\r
+    public void setModuleType(Vector<String> moduleType) {\r
+        this.moduleType = moduleType;\r
+    }\r
+}\r
index fa03258bdc33ef86643200b2c24d04becc21404a..3155cf63299644f62eba7e9da8b6eb990b567989 100644 (file)
@@ -23,7 +23,14 @@ public class LibraryClassVector {
         for (int index = 0; index < vLibraryClass.size(); index++) {\r
             if (vLibraryClass.elementAt(index).getLibraryClassName().equals(lib.getLibraryClassName())\r
                 && vLibraryClass.elementAt(index).getUsage().equals(lib.getUsage())) {\r
-                return index;\r
+                if (vLibraryClass.elementAt(index).getBelongModule() != null && lib.getBelongModule() != null) {\r
+                    if (vLibraryClass.elementAt(index).getBelongModule().equals(lib.getBelongModule())) {\r
+                        return index;\r
+                    }\r
+                }\r
+                if (vLibraryClass.elementAt(index).getBelongModule() == null && lib.getBelongModule() == null) {\r
+                    return index;\r
+                }\r
             }\r
         }\r
         return -1;\r
index d7a9c48fe43a5280c7cc621be4eee77a6e50f845..3135eef0f44edce211994141d989eda9e07a02ec 100644 (file)
@@ -24,6 +24,7 @@ import org.tianocore.LibraryClassDefinitionsDocument.LibraryClassDefinitions;
 import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;\r
 import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.OpenFile;\r
+import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.Identifications.Identification;\r
 import org.tianocore.frameworkwizard.packaging.PackageIdentification;\r
 \r
@@ -133,6 +134,31 @@ public class ModuleIdentification extends Identification {
             }\r
         }\r
     }\r
+    \r
+    public boolean equals(String moduleGuid, String moduleVersion, String packageGuid, String packageVersion) {\r
+        boolean b = false;\r
+        if (this.getGuid().equals(moduleGuid) && this.getPackageId().getGuid().equals(packageGuid)) {\r
+            b = true;\r
+            //\r
+            // Check Version\r
+            //\r
+            if (moduleVersion != null) {\r
+                if (!Tools.isEmpty(moduleVersion)) {\r
+                    if (!moduleVersion.equals(this.getVersion())) {\r
+                        b = false;\r
+                    }\r
+                }\r
+            }\r
+            if (packageVersion != null) {\r
+                if (!Tools.isEmpty(packageVersion)) {\r
+                    if (!packageVersion.equals(this.getPackageId().getVersion())) {\r
+                        b = false;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+        return b;\r
+    }\r
 \r
     public boolean isLibrary() {\r
         return isLibrary;\r
index 0c8d66343427db8aa3e63f6c5a2d953cc2378ac6..854c6514d5964e11928732376a46610890db5ba5 100644 (file)
@@ -505,32 +505,6 @@ public class LibraryClassDefsDlg extends IDialog {
             Log.wrn("Update Library Class Definitions", "Incorrect data type for Library Class");\r
             return false;\r
         }\r
-\r
-        //\r
-        // Check if the library is produced\r
-        //\r
-        String strUsage = this.jComboBoxUsage.getSelectedItem().toString();\r
-        //\r
-        // Check only when the library class is consumed\r
-        //\r
-        if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
-            LibraryClassVector v = Find.getAllLibraryClassVector();\r
-            boolean isFind = false;\r
-            for (int index = 0; index < v.size(); index++) {\r
-                LibraryClassIdentification lid = v.getLibraryClass(index);\r
-                if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {\r
-                    if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
-                        || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
-                        isFind = true;\r
-                        break;\r
-                    }\r
-                }\r
-            }\r
-            if (!isFind) {\r
-                Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet.");\r
-                return false;\r
-            }\r
-        }\r
         \r
         //\r
         // Check RecommendedInstanceVersion\r
@@ -561,6 +535,32 @@ public class LibraryClassDefsDlg extends IDialog {
                 return false;\r
             }\r
         }\r
+        \r
+        //\r
+        // Check if the library is produced\r
+        //\r
+        String strUsage = this.jComboBoxUsage.getSelectedItem().toString();\r
+        //\r
+        // Check only when the library class is consumed\r
+        //\r
+        if (strUsage.equals(DataType.USAGE_TYPE_ALWAYS_CONSUMED) || strUsage.equals(DataType.USAGE_TYPE_SOMETIMES_CONSUMED)) {\r
+            LibraryClassVector v = Find.getAllLibraryClassVector();\r
+            boolean isFind = false;\r
+            for (int index = 0; index < v.size(); index++) {\r
+                LibraryClassIdentification lid = v.getLibraryClass(index);\r
+                if (lid.getLibraryClassName().equals(this.jComboBoxLibraryClassName.getSelectedItem().toString())) {\r
+                    if (lid.getUsage().equals(DataType.USAGE_TYPE_ALWAYS_PRODUCED)\r
+                        || lid.getUsage().equals(DataType.USAGE_TYPE_SOMETIMES_PRODUCED)) {\r
+                        isFind = true;\r
+                        break;\r
+                    }\r
+                }\r
+            }\r
+            if (!isFind) {\r
+                Log.wrn("Update Library Class Definitions", "This Library Class has no instance yet. It may have some errors in build time.");\r
+                //return false;\r
+            }\r
+        }\r
 \r
         return true;\r
     }\r
index c27b81eea0c029dd5a1d402f2f48396150dcb400..1969d07503f12e215ae13791c8d9b3be982fba5b 100644 (file)
@@ -471,7 +471,7 @@ public class WorkspaceTools {
                         if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_DYNAMIC)) {\r
                             hasDYNAMIC = true;\r
                         }\r
-                        if(type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {\r
+                        if (type.elementAt(indexOfType).equals(DataType.PCD_ITEM_TYPE_FEATURE_FLAG)) {\r
                             hasFEATURE_FLAG = true;\r
                         }\r
                     }\r
@@ -666,10 +666,11 @@ public class WorkspaceTools {
                 //\r
                 // Check id\r
                 //\r
-                if (mid.equals(id)) {\r
-                    return GlobalData.vPackageList.elementAt(indexI);\r
+                if (mid != null) {\r
+                    if (mid.equals(id)) {\r
+                        return GlobalData.vPackageList.elementAt(indexI);\r
+                    }\r
                 }\r
-\r
             }\r
         }\r
 \r
@@ -809,19 +810,10 @@ public class WorkspaceTools {
                     //\r
                     PackageIdentification pid = GlobalData.openingModuleList.getIdByPath(path).getPackageId();\r
                     PackageSurfaceArea spd = GlobalData.openingPackageList.getPackageSurfaceAreaFromId(pid);\r
-                    if (spd != null) {\r
-                        if (spd.getLibraryClassDeclarations() != null) {\r
-                            LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();\r
-                            for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {\r
-                                if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {\r
-                                    v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())\r
-                                                                                  + DataType.FILE_SEPARATOR\r
-                                                                                  + lcdl.getLibraryClassList()\r
-                                                                                        .get(indexOfLibOfSpd)\r
-                                                                                        .getIncludeHeader()));\r
-                                }\r
-                            }\r
-                        }\r
+                    String headerFile = getHeaderFileFromPackageByLibraryClassName(spd, name);\r
+                    if (!Tools.isEmpty(headerFile)) {\r
+                        v.addElement(Tools.convertPathToCurrentOsType(Tools.getFilePathOnly(pid.getPath())\r
+                                                                      + DataType.FILE_SEPARATOR + headerFile));\r
                     }\r
                 }\r
             }\r
@@ -920,4 +912,20 @@ public class WorkspaceTools {
         }\r
         return v;\r
     }\r
+\r
+    public String getHeaderFileFromPackageByLibraryClassName(PackageSurfaceArea spd, String name) {\r
+        String headerFile = "";\r
+        if (spd != null) {\r
+            if (spd.getLibraryClassDeclarations() != null) {\r
+                LibraryClassDeclarations lcdl = spd.getLibraryClassDeclarations();\r
+                for (int indexOfLibOfSpd = 0; indexOfLibOfSpd < lcdl.sizeOfLibraryClassArray(); indexOfLibOfSpd++) {\r
+                    if (lcdl.getLibraryClassList().get(indexOfLibOfSpd).getName().equals(name)) {\r
+                        return lcdl.getLibraryClassList().get(indexOfLibOfSpd).getIncludeHeader();\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
+        return headerFile;\r
+    }\r
 }\r