]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java
Use unified global data to get module informations.
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / packaging / ui / SpdLibClassDecls.java
index d1363f7cbd02c989d004c2a51176f1f69cebb739..6972bfd7428f0b82a67d19d0d9276bb015d559aa 100644 (file)
@@ -18,7 +18,6 @@ import java.awt.event.ComponentEvent;
 import java.io.File;\r
 import java.util.HashMap;\r
 import java.util.Iterator;\r
-import java.util.Map;\r
 import java.util.Set;\r
 import java.util.Vector;\r
 \r
@@ -42,20 +41,17 @@ import javax.swing.event.TableModelEvent;
 import javax.swing.event.TableModelListener;\r
 import javax.swing.table.DefaultTableModel;\r
 import javax.swing.table.TableModel;\r
-\r
-import org.apache.xmlbeans.XmlObject;\r
 import org.tianocore.PackageSurfaceAreaDocument;\r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.GlobalData;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPackageType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
 import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList;\r
 import org.tianocore.frameworkwizard.platform.ui.ListEditor;\r
-import org.tianocore.frameworkwizard.platform.ui.global.GlobalData;\r
 import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery;\r
-import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification;\r
-import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification;\r
+import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification;\r
 \r
 \r
 /**\r
@@ -200,8 +196,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     private JScrollPane getJScrollPane() {\r
         if (jScrollPane == null) {\r
             jScrollPane = new JScrollPane();\r
-            jScrollPane.setBounds(new java.awt.Rectangle(12,351,608,253));\r
-            jScrollPane.setPreferredSize(new java.awt.Dimension(500,419));\r
+            jScrollPane.setBounds(new java.awt.Rectangle(12,351,400,253));\r
             jScrollPane.setViewportView(getJTable());\r
         }\r
         return jScrollPane;\r
@@ -224,8 +219,8 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
            model.addColumn("Help Text");\r
            model.addColumn("Recommended Instance");\r
            model.addColumn("Version");\r
-           model.addColumn("Sup. Arch");\r
-           model.addColumn("Mod. Types");\r
+           model.addColumn("Supported Architectures");\r
+           model.addColumn("Supported Module Types");\r
            \r
            Vector<String> vArch = new Vector<String>();\r
            vArch.add("IA32");\r
@@ -311,7 +306,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
                 getLibInstances(lib);\r
                 guid = nameToGuid(name);\r
                 if (guid == null){\r
-                  JOptionPane.showMessageDialog(frame, "Recommended Instance NOT exists.");\r
+                  JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");\r
                   return;\r
                 }\r
             }\r
@@ -627,7 +622,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
             }\r
             else{\r
                 if (recommendGuid == null) {\r
-                  JOptionPane.showMessageDialog(frame, "Recommended Instance NOT exists.");\r
+                  JOptionPane.showMessageDialog(frame, "Recommended Instance does not exist.");\r
                   return;\r
                 }\r
             }\r
@@ -664,25 +659,25 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
 \r
     private boolean dataValidation(String[] row) {\r
         if (!DataValidation.isKeywordType(row[cnClassName])) {\r
-            JOptionPane.showMessageDialog(frame, "Library Class is NOT KeyWord Type.");\r
+            JOptionPane.showMessageDialog(frame, "Library Class name entered does not match KeyWord datatype.");\r
             return false;\r
         }\r
         if (!DataValidation.isPathAndFilename(row[cnHdrFile])) {\r
-            JOptionPane.showMessageDialog(frame, "Include Header is NOT PathAndFilename Type.");\r
+            JOptionPane.showMessageDialog(frame, "Include Header does not match the PathAndFilename datatype.");\r
             return false;\r
         }\r
         if (row[cnHelpText].length() == 0) {\r
-            JOptionPane.showMessageDialog(frame, "Help Text Must NOT be empty.");\r
+            JOptionPane.showMessageDialog(frame, "Help Text must be entered!");\r
             return false;\r
         }\r
         if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) {\r
             if (row[cnRecInstName] == null || row[cnRecInstName].length() == 0) {\r
-                JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with Instance Name.");\r
+                JOptionPane.showMessageDialog(frame, "Recommended Instance Version must associate with the Instance Name.");\r
                 return false;\r
             }\r
             \r
             if (!DataValidation.isVersionDataType(row[cnRecInstVer])) {\r
-                JOptionPane.showMessageDialog(frame, "Recommended Instance Version is NOT VersionDataType.");\r
+                JOptionPane.showMessageDialog(frame, "Recommended Instance Version does not match Version datatype.");\r
                 return false;\r
             }\r
         }\r
@@ -744,7 +739,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
                         theFile = chooser.getSelectedFile();\r
                         String file = theFile.getPath();\r
                         if (!file.startsWith(dirPrefix)) {\r
-                            JOptionPane.showMessageDialog(frame, "You can only select files in current package!");\r
+                            JOptionPane.showMessageDialog(frame, "You can only select files in current package directory structure!");\r
                             return;\r
                         }\r
                         \r
@@ -768,9 +763,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     public void componentResized(ComponentEvent arg0) {\r
         int intPreferredWidth = 500;\r
         \r
-        resizeComponentWidth(this.jTextFieldClass, this.getWidth(), intPreferredWidth);\r
-        resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);\r
-        resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth-10);\r
+        Tools.resizeComponentWidth(this.jTextFieldClass, this.getWidth(), intPreferredWidth);\r
+        Tools.resizeComponentWidth(this.jTextFieldHelp, this.getWidth(), intPreferredWidth);\r
+        Tools.resizeComponentWidth(this.jScrollPane, this.getWidth(), intPreferredWidth-10);\r
         \r
     }\r
     /**\r
@@ -920,20 +915,10 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
     private void getLibInstances(String libClass){\r
         libNameGuidMap.clear();\r
         try {\r
-            GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE"));\r
-        \r
-            Set<PackageIdentification> spi = GlobalData.getPackageList();\r
-            Iterator ispi = spi.iterator();\r
-            \r
-            while (ispi.hasNext()) {\r
-                PackageIdentification pi = (PackageIdentification) ispi.next();\r
-\r
-                Set<ModuleIdentification> smi = GlobalData.getModules(pi);\r
-                Iterator ismi = smi.iterator();\r
+                Iterator ismi = GlobalData.vModuleList.iterator();\r
                 while (ismi.hasNext()) {\r
                     ModuleIdentification mi = (ModuleIdentification) ismi.next();\r
-                    Map<String, XmlObject> m = GlobalData.getNativeMsa(mi);\r
-                    SurfaceAreaQuery.setDoc(m);\r
+                    \r
                     Vector<String> classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED", mi);\r
                     for (int i = 0; i < classProduced.size(); ++i) {\r
                         if (classProduced.get(i).equals(libClass)) {\r
@@ -941,10 +926,10 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen
                         }\r
                     }\r
                 }\r
-            }\r
+           \r
         }\r
         catch(Exception e){\r
-            JOptionPane.showMessageDialog(frame, "Search Instances Fail.");\r
+            JOptionPane.showMessageDialog(frame, "Search Instances Failed.");\r
         }\r
         \r
     }\r