]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Fix EDKT314 Display module source/binary in a radio box
authorhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Sep 2006 07:29:33 +0000 (07:29 +0000)
committerhche10x <hche10x@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 25 Sep 2006 07:29:33 +0000 (07:29 +0000)
2. Fix EDKT279 Genertate Guilds.xref by wizard tools
3. Fix a typo error in SourceFilesDlg.java

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

Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/MsaHeader.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java
Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java

index 0d3ddb50adc078c6bcab37b15d30adf1287a8722..0e0c54c345dcb3e7f1656aeaea43b3a3a26f72c7 100644 (file)
@@ -22,6 +22,9 @@ import java.awt.event.KeyListener;
 import java.awt.event.MouseEvent;\r
 import java.awt.event.MouseListener;\r
 import java.awt.event.WindowEvent;\r
+import java.io.BufferedWriter;\r
+import java.io.File;\r
+import java.io.FileWriter;\r
 import java.io.IOException;\r
 import java.util.Iterator;\r
 import java.util.Set;\r
@@ -306,6 +309,8 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
     ///\r
     private static FrameworkWizardUI fwui = null;\r
 \r
+    private JMenuItem jMenuItemToolsGenerateGuidsXref = null;\r
+\r
     /**\r
      If the class hasn't an instnace, new one.\r
      \r
@@ -431,7 +436,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
             jMenuFile.add(getJMenuItemFileSaveAs());\r
             jMenuFile.add(getJMenuItemFileSaveAll());\r
             jMenuFile.addSeparator();\r
-            \r
+\r
             jMenuFile.add(getJMenuItemFileRefresh());\r
             jMenuFile.addSeparator();\r
 \r
@@ -784,6 +789,9 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
 \r
             jMenuTools.add(getJMenuItemToolsToolChainConfiguration());\r
             jMenuTools.add(getJMenuItemToolsBuildPreferences());\r
+            jMenuTools.addSeparator();\r
+\r
+            jMenuTools.add(getJMenuItemToolsGenerateGuidsXref());\r
         }\r
         return jMenuTools;\r
     }\r
@@ -1758,6 +1766,21 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
         return jMenuItemEditFindLibraryInstance;\r
     }\r
 \r
+    /**\r
+     * This method initializes jMenuItemProjectGenerateGuidsXref       \r
+     *         \r
+     * @return javax.swing.JMenuItem   \r
+     */\r
+    private JMenuItem getJMenuItemToolsGenerateGuidsXref() {\r
+        if (jMenuItemToolsGenerateGuidsXref == null) {\r
+            jMenuItemToolsGenerateGuidsXref = new JMenuItem();\r
+            jMenuItemToolsGenerateGuidsXref.setText("Generate guids.xref");\r
+            jMenuItemToolsGenerateGuidsXref.setMnemonic('G');\r
+            jMenuItemToolsGenerateGuidsXref.addActionListener(this);\r
+        }\r
+        return jMenuItemToolsGenerateGuidsXref;\r
+    }\r
+\r
     /* (non-Javadoc)\r
      * @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])\r
      *\r
@@ -1884,7 +1907,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
         if (arg0.getSource() == this.jMenuItemFileSaveAll) {\r
             this.saveAll();\r
         }\r
-        \r
+\r
         if (arg0.getSource() == this.jMenuItemFileRefresh) {\r
             this.closeAll();\r
             this.refresh();\r
@@ -1951,6 +1974,10 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
             this.setupToolChainConfiguration();\r
         }\r
 \r
+        if (arg0.getSource() == this.jMenuItemToolsGenerateGuidsXref) {\r
+            this.generateGuidsXref();\r
+        }\r
+\r
         if (arg0.getSource() == this.jMenuItemHelpAbout) {\r
             About a = new About(this, true);\r
             int result = a.showDialog();\r
@@ -2625,9 +2652,12 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
         IDefaultMutableTreeNode belongNode = null;\r
 \r
         try {\r
-            id = iTree.getSelectNode().getId();\r
-            intCategory = iTree.getSelectCategory();\r
-            belongNode = iTree.getSelectNode().getBelongNode();\r
+            //\r
+            // Get selected tree node\r
+            //\r
+            if (iTree.getSelectNode() != null) {\r
+                id = iTree.getSelectNode().getId();\r
+            }\r
 \r
             //\r
             // If id is null, return directly\r
@@ -2636,6 +2666,9 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
                 return;\r
             }\r
 \r
+            intCategory = iTree.getSelectCategory();\r
+            belongNode = iTree.getSelectNode().getBelongNode();\r
+\r
             //              \r
             // If the node is not opened yet\r
             // Insert top level elements first\r
@@ -3585,4 +3618,57 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe
             }\r
         }\r
     }\r
+\r
+    /**\r
+     Search whole workspace and find all module's name and guid, and save them to a file\r
+     \r
+     **/\r
+    private void generateGuidsXref() {\r
+        //\r
+        // Init File Chooser\r
+        //\r
+        JFileChooser fc = new JFileChooser();\r
+        fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));\r
+        fc.setSelectedFile(new File(Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
+                                    + DataType.GUIDS_XREF_FILE_NAME));\r
+        fc.setMultiSelectionEnabled(false);\r
+\r
+        //\r
+        // Get guids xref and save to file\r
+        //\r
+        int result = fc.showOpenDialog(new JPanel());\r
+        if (result == JFileChooser.APPROVE_OPTION) {\r
+            Vector<String> v = wt.getAllModuleGuidXref();\r
+            if (v.size() < 1) {\r
+                Log.wrn("No guids found!!!");\r
+                return;\r
+            }\r
+            File f = fc.getSelectedFile();\r
+            if (!f.exists()) {\r
+                try {\r
+                    f.createNewFile();\r
+                } catch (IOException e) {\r
+                    Log.wrn("Fail to create file", e.getMessage());\r
+                    Log.err("Fail to create file when generating guids.xref", e.getMessage());\r
+                }\r
+            }\r
+            FileWriter fw = null;\r
+            BufferedWriter bw = null;\r
+            try {\r
+                fw = new FileWriter(f);\r
+                bw = new BufferedWriter(fw);\r
+                for (int index = 0; index < v.size(); index++) {\r
+                    bw.write(v.get(index));\r
+                    bw.newLine();\r
+                }\r
+                bw.flush();\r
+                fw.flush();\r
+                bw.close();\r
+                fw.close();\r
+            } catch (IOException e) {\r
+                Log.wrn("Fail to write file", e.getMessage());\r
+                Log.err("Fail to write file when generating guids.xref", e.getMessage());\r
+            }\r
+        }\r
+    }\r
 }\r
index 6f95ca445d1d7df7c9fbd9300d7032456ab92600..21d76139c5718dfbf3d4db275be41651e20e0c91 100644 (file)
@@ -279,4 +279,9 @@ public class DataType {
     public final static String PROTOCOL_TYPE_PROTOCOL = "Protocol";\r
     \r
     public final static String PROTOCOL_TYPE_PROTOCOL_NOTIFY = "Protocol Notify";\r
+    \r
+    //\r
+    // The default file name for guids.xref file\r
+    //\r
+    public final static String GUIDS_XREF_FILE_NAME = "guids.xref";\r
 }\r
index 18757ae473b55bd6576281a2e96870a158015d71..b7f6804cac3c02597f1c454adf257483e663850d 100644 (file)
@@ -20,6 +20,7 @@ import java.awt.event.ComponentEvent;
 import java.awt.event.FocusEvent;\r
 import java.util.Vector;\r
 \r
+import javax.swing.ButtonGroup;\r
 import javax.swing.JButton;\r
 import javax.swing.JCheckBox;\r
 import javax.swing.JComboBox;\r
@@ -44,6 +45,7 @@ import org.tianocore.frameworkwizard.common.Tools;
 import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;\r
 import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
+import javax.swing.JRadioButton;\r
 \r
 /**\r
  The class is used to create, update MsaHeader of MSA file\r
@@ -123,8 +125,6 @@ public class MsaHeader extends IInternalFrame {
 \r
     private JLabel jLabelBinaryModule = null;\r
 \r
-    private JComboBox jComboBoxBinaryModule = null;\r
-\r
     private JLabel jLabelOutputFileBasename = null;\r
 \r
     private JTextField jTextFieldOutputFileBasename = null;\r
@@ -194,6 +194,10 @@ public class MsaHeader extends IInternalFrame {
 \r
     private EnumerationData ed = new EnumerationData();\r
 \r
+    private JRadioButton jRadioButtonBinaryModuleTrue = null;\r
+\r
+    private JRadioButton jRadioButtonBinaryModuleFalse = null;\r
+\r
     /**\r
      * This method initializes jCheckBoxIa32    \r
      *  \r
@@ -599,29 +603,6 @@ public class MsaHeader extends IInternalFrame {
         return jTextAreaCopyright;\r
     }\r
 \r
-    /**\r
-     * This method initializes jComboBoxBinaryModule    \r
-     *  \r
-     * @return javax.swing.JComboBox    \r
-     */\r
-    private JComboBox getJComboBoxBinaryModule() {\r
-        if (jComboBoxBinaryModule == null) {\r
-            jComboBoxBinaryModule = new JComboBox();\r
-            jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(valueCol, 480, valueWidth, 20));\r
-            jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(valueWidth, 20));\r
-            jComboBoxBinaryModule.addFocusListener(this);\r
-            jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>"\r
-                                                 + "which can be compiled or binary <br>"\r
-                                                 + "modules which are linked.  <br>"\r
-                                                 + "A module cannot contain both. <br>"\r
-                                                 + "The GUID numbers should be identical <br>"\r
-                                                 + "for a binary and source MSA, <br>"\r
-                                                 + "however the BINARY MSA should have <br>"\r
-                                                 + "a higher version number.</html>");\r
-        }\r
-        return jComboBoxBinaryModule;\r
-    }\r
-\r
     /**\r
      * This method initializes jTextFieldOutputFileBasename \r
      *  \r
@@ -798,9 +779,9 @@ public class MsaHeader extends IInternalFrame {
                 this.setSelectedItems(Tools.convertListToVector(md.getSupportedArchitectures()));\r
             }\r
             if (md.getBinaryModule()) {\r
-                this.jComboBoxBinaryModule.setSelectedIndex(1);\r
+                this.jRadioButtonBinaryModuleTrue.setSelected(true);\r
             } else {\r
-                this.jComboBoxBinaryModule.setSelectedIndex(0);\r
+                this.jRadioButtonBinaryModuleFalse.setSelected(true);\r
             }\r
             if (md.getOutputFileBasename() != null) {\r
                 this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());\r
@@ -917,7 +898,6 @@ public class MsaHeader extends IInternalFrame {
             jContentPane.add(jLabelOutputFileBasename, null);\r
             jContentPane.add(getJTextFieldOutputFileBasename(), null);\r
             jContentPane.add(jLabelBinaryModule, null);\r
-            jContentPane.add(getJComboBoxBinaryModule(), null);\r
             jContentPane.add(jLabelArch, null);\r
 \r
             jStarLabel1 = new StarLabel();\r
@@ -963,11 +943,15 @@ public class MsaHeader extends IInternalFrame {
             jContentPane.add(getJCheckBoxArm(), null);\r
             jContentPane.add(getJCheckBoxPpc(), null);\r
 \r
-            \r
             jContentPane.add(getJCheckBoxPcd(), null);\r
             jContentPane.add(getJComboBoxPcdIsDriver(), null);\r
-            \r
             jContentPane.add(getJCheckBoxFlashMap(), null);\r
+\r
+            ButtonGroup bg = new ButtonGroup();\r
+            jContentPane.add(getJRadioButtonBinaryModuleTrue(), null);\r
+            jContentPane.add(getJRadioButtonBinaryModuleFalse(), null);\r
+            bg.add(getJRadioButtonBinaryModuleTrue());\r
+            bg.add(getJRadioButtonBinaryModuleFalse());\r
         }\r
         return jContentPane;\r
     }\r
@@ -1146,7 +1130,6 @@ public class MsaHeader extends IInternalFrame {
     private void initFrame() {\r
         EnumerationData ed = new EnumerationData();\r
         Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());\r
-        Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());\r
         this.setSelectedItems(ed.getVSupportedArchitectures());\r
     }\r
 \r
@@ -1186,15 +1169,14 @@ public class MsaHeader extends IInternalFrame {
         Tools.resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);\r
         Tools.resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth);\r
         Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);\r
-        // Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);\r
+        Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);\r
         Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);\r
-        // Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);\r
-        // Tools.resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth);\r
+        Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);\r
         Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);\r
-        // Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);\r
+        Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);\r
 \r
         Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,\r
-                                 DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON - 5);\r
+                                 DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);\r
     }\r
 \r
     public void focusLost(FocusEvent arg0) {\r
@@ -1391,14 +1373,21 @@ public class MsaHeader extends IInternalFrame {
         //\r
         // Check Binary Module Type\r
         //\r
-        if (arg0.getSource() == this.jComboBoxBinaryModule) {\r
-            if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.TRUE)) {\r
+        if (arg0.getSource() == this.jRadioButtonBinaryModuleTrue) {\r
+            if (jRadioButtonBinaryModuleTrue.isSelected()) {\r
                 if (md.getBinaryModule()) {\r
                     return;\r
                 } else {\r
                     md.setBinaryModule(true);\r
                 }\r
-            } else if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.FALSE)) {\r
+            }\r
+        }\r
+\r
+        //\r
+        // Check Binary Module Type\r
+        //\r
+        if (arg0.getSource() == this.jRadioButtonBinaryModuleFalse) {\r
+            if (jRadioButtonBinaryModuleFalse.isSelected()) {\r
                 if (md.getBinaryModule()) {\r
                     md.setBinaryModule(false);\r
                 } else {\r
@@ -1618,5 +1607,51 @@ public class MsaHeader extends IInternalFrame {
         }\r
         return jCheckBoxFlashMap;\r
     }\r
-    \r
+\r
+    /**\r
+     * This method initializes jRadioButtonBinaryModuleTrue    \r
+     *         \r
+     * @return javax.swing.JRadioButton        \r
+     */\r
+    private JRadioButton getJRadioButtonBinaryModuleTrue() {\r
+        if (jRadioButtonBinaryModuleTrue == null) {\r
+            jRadioButtonBinaryModuleTrue = new JRadioButton();\r
+            jRadioButtonBinaryModuleTrue.setBounds(new java.awt.Rectangle(valueCol, 480, 140, 20));\r
+            jRadioButtonBinaryModuleTrue.setText("True");\r
+            jRadioButtonBinaryModuleTrue.setSelected(true);\r
+            jRadioButtonBinaryModuleTrue.addFocusListener(this);\r
+            jRadioButtonBinaryModuleTrue.setToolTipText("<html>Modules are either source modules <br>"\r
+                                                        + "which can be compiled or binary <br>"\r
+                                                        + "modules which are linked.  <br>"\r
+                                                        + "A module cannot contain both. <br>"\r
+                                                        + "The GUID numbers should be identical <br>"\r
+                                                        + "for a binary and source MSA, <br>"\r
+                                                        + "however the BINARY MSA should have <br>"\r
+                                                        + "a higher version number.</html>");\r
+        }\r
+        return jRadioButtonBinaryModuleTrue;\r
+    }\r
+\r
+    /**\r
+     * This method initializes jRadioButtonBinaryModuleFalse   \r
+     *         \r
+     * @return javax.swing.JRadioButton        \r
+     */\r
+    private JRadioButton getJRadioButtonBinaryModuleFalse() {\r
+        if (jRadioButtonBinaryModuleFalse == null) {\r
+            jRadioButtonBinaryModuleFalse = new JRadioButton();\r
+            jRadioButtonBinaryModuleFalse.setBounds(new java.awt.Rectangle(valueCol + 140, 480, 140, 20));\r
+            jRadioButtonBinaryModuleFalse.setText("False");\r
+            jRadioButtonBinaryModuleFalse.addFocusListener(this);\r
+            jRadioButtonBinaryModuleFalse.setToolTipText("<html>Modules are either source modules <br>"\r
+                                                         + "which can be compiled or binary <br>"\r
+                                                         + "modules which are linked.  <br>"\r
+                                                         + "A module cannot contain both. <br>"\r
+                                                         + "The GUID numbers should be identical <br>"\r
+                                                         + "for a binary and source MSA, <br>"\r
+                                                         + "however the BINARY MSA should have <br>"\r
+                                                         + "a higher version number.</html>");\r
+        }\r
+        return jRadioButtonBinaryModuleFalse;\r
+    }\r
 }\r
index 6309eb28898e7340fa282b594eac9514e0cc8fca..266870f0bf2e97b0c516e5fac7d558bd6b83bfbb 100644 (file)
@@ -167,7 +167,7 @@ public class SourceFilesDlg extends IDialog {
             iComboBoxToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20));\r
             iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20));\r
             iComboBoxToolCode.setToolTipText("<html>You may select a specific tool command from drop down list,<br>"\r
-                                             + "or you can DOUBLE-CLICK this feild to enter your customized<br>"\r
+                                             + "or you can DOUBLE-CLICK this field to enter your customized<br>"\r
                                              + "tool command.<br>"\r
                                              + "Press ENTER to save your input or press ESCAPE to quit</html>");\r
         }\r
index 9c62ecde672525867f78af1ae0efdc5b11222f09..c560899eae83138f848f08ef1af95709d19221b4 100644 (file)
@@ -804,4 +804,13 @@ public class WorkspaceTools {
         }\r
         return vpid;\r
     }\r
+    \r
+    public Vector<String> getAllModuleGuidXref() {\r
+        Vector<String> v = new Vector<String>();\r
+        for (int index = 0; index < GlobalData.openingModuleList.size(); index++) {\r
+            ModuleIdentification id = GlobalData.openingModuleList.getOpeningModuleByIndex(index).getId();\r
+            v.addElement(id.getGuid() + " " + id.getName());\r
+        }\r
+        return v;\r
+    }\r
 }\r