]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java
1. Fix the bug missing initialize ToolCode drop down list when add a new source file
[mirror_edk2.git] / Tools / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / module / ui / dialog / SourceFilesDlg.java
index d45bd218978c007bd4a6c45e12f11a2b455972d5..baed15e20afe8001362616aa9902c91ea54cfad7 100644 (file)
@@ -27,9 +27,11 @@ import javax.swing.JTextField;
 \r
 import org.tianocore.frameworkwizard.common.DataType;\r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
+import org.tianocore.frameworkwizard.common.EnumerationData;\r
 import org.tianocore.frameworkwizard.common.Log;\r
 import org.tianocore.frameworkwizard.common.Tools;\r
 import org.tianocore.frameworkwizard.common.ui.ArchCheckBox;\r
+import org.tianocore.frameworkwizard.common.ui.IComboBox;\r
 import org.tianocore.frameworkwizard.common.ui.IDialog;\r
 import org.tianocore.frameworkwizard.common.ui.IFrame;\r
 import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
@@ -76,6 +78,8 @@ public class SourceFilesDlg extends IDialog {
 \r
     private JTextField jTextFieldToolCode = null;\r
 \r
+    private IComboBox iComboBoxToolCode = null;\r
+\r
     private JTextField jTextFieldToolChainFamily = null;\r
 \r
     private JLabel jLabelFeatureFlag = null;\r
@@ -83,7 +87,7 @@ public class SourceFilesDlg extends IDialog {
     private JTextField jTextFieldFeatureFlag = null;\r
 \r
     private ArchCheckBox jArchCheckBox = null;\r
-    \r
+\r
     private JButton jButtonOk = null;\r
 \r
     private JButton jButtonCancel = null;\r
@@ -95,6 +99,8 @@ public class SourceFilesDlg extends IDialog {
 \r
     private String msaFileName = "";\r
 \r
+    private EnumerationData ed = new EnumerationData();\r
+\r
     /**\r
      This method initializes jTextFieldFileName \r
      \r
@@ -156,6 +162,19 @@ public class SourceFilesDlg extends IDialog {
         return jTextFieldTagName;\r
     }\r
 \r
+    private IComboBox getIComboBoxToolCode() {\r
+        if (iComboBoxToolCode == null) {\r
+            iComboBoxToolCode = new IComboBox();\r
+            iComboBoxToolCode.setBounds(new java.awt.Rectangle(140, 60, 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 fild to enter your customizing <br>"\r
+                                             + "tool command.<br>"\r
+                                             + "Press ENTER to save your input or press ESCAPE to quit</html>");\r
+        }\r
+        return iComboBoxToolCode;\r
+    }\r
+\r
     /**\r
      * This method initializes jTextFieldToolCode      \r
      *         \r
@@ -167,6 +186,7 @@ public class SourceFilesDlg extends IDialog {
             jTextFieldToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20));\r
             jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20));\r
             jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM");\r
+            jTextFieldToolCode.setVisible(false);\r
         }\r
         return jTextFieldToolCode;\r
     }\r
@@ -251,11 +271,12 @@ public class SourceFilesDlg extends IDialog {
      \r
      **/\r
     private void init() {\r
-        this.setSize(500, 235);\r
+        this.setSize(510, 240);\r
         this.setContentPane(getJScrollPane());\r
         this.setTitle("Source Files");\r
         this.setViewMode(false);\r
         this.centerWindow();\r
+        Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode());\r
     }\r
 \r
     /**         \r
@@ -274,7 +295,32 @@ public class SourceFilesDlg extends IDialog {
         if (inSourceFilesIdentifications != null) {\r
             this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename());\r
             this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName());\r
-            this.jTextFieldToolCode.setText(inSourceFilesIdentifications.getToolCode());\r
+\r
+            //\r
+            // Generate Tool Code selection list\r
+            //\r
+            Vector<String> v = ed.getVToolCode();\r
+            boolean isFind = false;\r
+            String strToolCode = inSourceFilesIdentifications.getToolCode();\r
+\r
+            //\r
+            // If the input value is not in the default list, add it to the list\r
+            //\r
+            if (strToolCode != null) {\r
+                for (int index = 0; index < v.size(); index++) {\r
+                    if (v.elementAt(index).equals(strToolCode)) {\r
+                        isFind = true;\r
+                        break;\r
+                    }\r
+                }\r
+                if (!isFind && !isEmpty(strToolCode)) {\r
+                    v.addElement(strToolCode);\r
+                }\r
+            }\r
+\r
+            Tools.generateComboBoxByVector(iComboBoxToolCode, v);\r
+            this.iComboBoxToolCode.setSelectedItem(strToolCode);\r
+\r
             this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily());\r
             jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag());\r
             this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList());\r
@@ -307,7 +353,7 @@ public class SourceFilesDlg extends IDialog {
             jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20));\r
             jLabelFeatureFlag = new JLabel();\r
             jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 120, 20));\r
-            jLabelFeatureFlag.setText("Feature Flag");\r
+            jLabelFeatureFlag.setText("Feature Flag Expression");\r
             jLabelToolCode = new JLabel();\r
             jLabelToolCode.setBounds(new java.awt.Rectangle(15, 60, 120, 20));\r
             jLabelToolCode.setText("Tool Code");\r
@@ -316,7 +362,7 @@ public class SourceFilesDlg extends IDialog {
             jLabelTagName.setText("Tag Name");\r
             jLabelArch = new JLabel();\r
             jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 120, 20));\r
-            jLabelArch.setText("Sup Arch List");\r
+            jLabelArch.setText("Supported Architectures");\r
             jLabelToolChainFamily = new JLabel();\r
             jLabelToolChainFamily.setBounds(new java.awt.Rectangle(15, 85, 120, 20));\r
             jLabelToolChainFamily.setText("Tool Chain Family");\r
@@ -341,6 +387,7 @@ public class SourceFilesDlg extends IDialog {
             jContentPane.add(getJTextFieldTagName(), null);\r
             jContentPane.add(jLabelToolCode, null);\r
             jContentPane.add(getJTextFieldToolCode(), null);\r
+            jContentPane.add(getIComboBoxToolCode(), null);\r
             jContentPane.add(getJTextFieldToolChainFamily(), null);\r
             jContentPane.add(jLabelFeatureFlag, null);\r
             jContentPane.add(getJTextFieldFeatureFlag(), null);\r
@@ -380,13 +427,16 @@ public class SourceFilesDlg extends IDialog {
         String name = this.jTextFieldFileName.getText();\r
         String s[] = name.split(";");\r
         String tagName = this.jTextFieldTagName.getText();\r
-        String toolCode = this.jTextFieldToolCode.getText();\r
+        String toolCode = this.iComboBoxToolCode.getSelectedItem().toString();\r
+        if (toolCode.equals(DataType.EMPTY_SELECT_ITEM)) {\r
+            toolCode = "";\r
+        }\r
         String tcf = this.jTextFieldToolChainFamily.getText();\r
         String featureFlag = this.jTextFieldFeatureFlag.getText();\r
         Vector<String> arch = this.jArchCheckBox.getSelectedItemsVector();\r
         sfid = new SourceFilesIdentification[s.length];\r
         for (int index = 0; index < s.length; index++) {\r
-            sfid[index] =  new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch);\r
+            sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch);\r
         }\r
         return sfid;\r
     }\r