X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=Tools%2FSource%2FFrameworkWizard%2Fsrc%2Forg%2Ftianocore%2Fframeworkwizard%2Fmodule%2Fui%2Fdialog%2FSourceFilesDlg.java;h=81759be67c02943f2a2bf97aa1d6b3b2faebb0f9;hp=f5c321df8ef0cbaeaec23c74c950e046eecdc8f8;hb=a19466adcb3939cd5fb8f919f000c04a0fe0b6f1;hpb=ccb063b1f27dcc84d67fa82592dd79b7e0be1e3f diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java index f5c321df8e..81759be67c 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/dialog/SourceFilesDlg.java @@ -1,6 +1,6 @@ /** @file - The file is used to create, update SourceFile of MSA/MBD file + The file is used to create, update SourceFiles section of the MSA file Copyright (c) 2006, Intel Corporation All rights reserved. This program and the accompanying materials @@ -27,20 +27,21 @@ import javax.swing.JTextField; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.DataValidation; +import org.tianocore.frameworkwizard.common.EnumerationData; import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.ui.ArchCheckBox; +import org.tianocore.frameworkwizard.common.ui.IComboBox; import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification; /** - The class is used to create, update SourceFile of MSA/MBD file - It extends IInternalFrame - - - + * The class is used to create, update SourceFiles section of the MSA file + * + * It extends IDialog + * **/ public class SourceFilesDlg extends IDialog { @@ -76,6 +77,8 @@ public class SourceFilesDlg extends IDialog { private JTextField jTextFieldToolCode = null; + private IComboBox iComboBoxToolCode = null; + private JTextField jTextFieldToolChainFamily = null; private JLabel jLabelFeatureFlag = null; @@ -83,7 +86,7 @@ public class SourceFilesDlg extends IDialog { private JTextField jTextFieldFeatureFlag = null; private ArchCheckBox jArchCheckBox = null; - + private JButton jButtonOk = null; private JButton jButtonCancel = null; @@ -95,6 +98,8 @@ public class SourceFilesDlg extends IDialog { private String msaFileName = ""; + private EnumerationData ed = new EnumerationData(); + /** This method initializes jTextFieldFileName @@ -104,7 +109,7 @@ public class SourceFilesDlg extends IDialog { private JTextField getJTextFieldSourceFilesDirectory() { if (jTextFieldFileName == null) { jTextFieldFileName = new JTextField(); - jTextFieldFileName.setBounds(new java.awt.Rectangle(140, 10, 250, 20)); + jTextFieldFileName.setBounds(new java.awt.Rectangle(168, 12, 250, 20)); jTextFieldFileName.setPreferredSize(new java.awt.Dimension(250, 20)); jTextFieldFileName.setToolTipText("Path is relative to the MSA file and must include the file name"); } @@ -121,7 +126,7 @@ public class SourceFilesDlg extends IDialog { if (jButtonOpenFile == null) { jButtonOpenFile = new JButton(); jButtonOpenFile.setText("Browse"); - jButtonOpenFile.setBounds(new java.awt.Rectangle(395, 10, 85, 20)); + jButtonOpenFile.setBounds(new java.awt.Rectangle(422, 12, 85, 20)); jButtonOpenFile.setPreferredSize(new java.awt.Dimension(85, 20)); jButtonOpenFile.addActionListener(this); } @@ -149,13 +154,26 @@ public class SourceFilesDlg extends IDialog { private JTextField getJTextFieldTagName() { if (jTextFieldTagName == null) { jTextFieldTagName = new JTextField(); - jTextFieldTagName.setBounds(new java.awt.Rectangle(140, 35, 340, 20)); + jTextFieldTagName.setBounds(new java.awt.Rectangle(168, 37, 340, 20)); jTextFieldTagName.setPreferredSize(new java.awt.Dimension(340, 20)); jTextFieldTagName.setToolTipText("You may specify a specific tool chain tag name, such as BILL1"); } return jTextFieldTagName; } + private IComboBox getIComboBoxToolCode() { + if (iComboBoxToolCode == null) { + iComboBoxToolCode = new IComboBox(); + iComboBoxToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20)); + iComboBoxToolCode.setPreferredSize(new java.awt.Dimension(340, 20)); + iComboBoxToolCode.setToolTipText("You may select a specific tool command from drop down list,
" + + "or you can DOUBLE-CLICK this fild to enter your customizing
" + + "tool command.
" + + "Press ENTER to save your input or press ESCAPE to quit"); + } + return iComboBoxToolCode; + } + /** * This method initializes jTextFieldToolCode * @@ -164,9 +182,10 @@ public class SourceFilesDlg extends IDialog { private JTextField getJTextFieldToolCode() { if (jTextFieldToolCode == null) { jTextFieldToolCode = new JTextField(); - jTextFieldToolCode.setBounds(new java.awt.Rectangle(140, 60, 340, 20)); + jTextFieldToolCode.setBounds(new java.awt.Rectangle(168, 62, 340, 20)); jTextFieldToolCode.setPreferredSize(new java.awt.Dimension(340, 20)); jTextFieldToolCode.setToolTipText("You may specify a specific tool command, such as ASM"); + jTextFieldToolCode.setVisible(false); } return jTextFieldToolCode; } @@ -179,7 +198,7 @@ public class SourceFilesDlg extends IDialog { private JTextField getJTextFieldToolChainFamily() { if (jTextFieldToolChainFamily == null) { jTextFieldToolChainFamily = new JTextField(); - jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(140, 85, 340, 20)); + jTextFieldToolChainFamily.setBounds(new java.awt.Rectangle(168, 87, 340, 20)); jTextFieldToolChainFamily.setPreferredSize(new java.awt.Dimension(340, 20)); jTextFieldToolChainFamily.setToolTipText("You may specify a specific tool chain family, such as GCC"); } @@ -194,7 +213,7 @@ public class SourceFilesDlg extends IDialog { private JTextField getJTextFieldFeatureFlag() { if (jTextFieldFeatureFlag == null) { jTextFieldFeatureFlag = new JTextField(); - jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(140, 110, 340, 20)); + jTextFieldFeatureFlag.setBounds(new java.awt.Rectangle(168, 112, 340, 20)); jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(340, 20)); jTextFieldFeatureFlag.setToolTipText("RESERVED FOR FUTURE USE"); } @@ -210,7 +229,7 @@ public class SourceFilesDlg extends IDialog { private JButton getJButtonOk() { if (jButtonOk == null) { jButtonOk = new JButton(); - jButtonOk.setBounds(new java.awt.Rectangle(290, 165, 90, 20)); + jButtonOk.setBounds(new java.awt.Rectangle(317, 172, 90, 20)); jButtonOk.setText("Ok"); jButtonOk.addActionListener(this); } @@ -226,7 +245,7 @@ public class SourceFilesDlg extends IDialog { private JButton getJButtonCancel() { if (jButtonCancel == null) { jButtonCancel = new JButton(); - jButtonCancel.setBounds(new java.awt.Rectangle(390, 165, 90, 20)); + jButtonCancel.setBounds(new java.awt.Rectangle(412, 172, 90, 20)); jButtonCancel.setText("Cancel"); jButtonCancel.addActionListener(this); } @@ -251,11 +270,12 @@ public class SourceFilesDlg extends IDialog { **/ private void init() { - this.setSize(510, 240); + this.setSize(525, 240); this.setContentPane(getJScrollPane()); this.setTitle("Source Files"); this.setViewMode(false); this.centerWindow(); + Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode()); } /** @@ -274,7 +294,32 @@ public class SourceFilesDlg extends IDialog { if (inSourceFilesIdentifications != null) { this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename()); this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName()); - this.jTextFieldToolCode.setText(inSourceFilesIdentifications.getToolCode()); + + // + // Generate Tool Code selection list + // + Vector v = ed.getVToolCode(); + boolean isFind = false; + String strToolCode = inSourceFilesIdentifications.getToolCode(); + + // + // If the input value is not in the default list, add it to the list + // + if (strToolCode != null) { + for (int index = 0; index < v.size(); index++) { + if (v.elementAt(index).equals(strToolCode)) { + isFind = true; + break; + } + } + if (!isFind && !isEmpty(strToolCode)) { + v.addElement(strToolCode); + } + } + + Tools.generateComboBoxByVector(iComboBoxToolCode, v); + this.iComboBoxToolCode.setSelectedItem(strToolCode); + this.jTextFieldToolChainFamily.setText(inSourceFilesIdentifications.getToolChainFamily()); jTextFieldFeatureFlag.setText(inSourceFilesIdentifications.getFeatureFlag()); this.jArchCheckBox.setSelectedItems(inSourceFilesIdentifications.getSupArchList()); @@ -303,30 +348,30 @@ public class SourceFilesDlg extends IDialog { private JPanel getJContentPane() { if (jContentPane == null) { jArchCheckBox = new ArchCheckBox(); - jArchCheckBox.setBounds(new java.awt.Rectangle(140, 135, 340, 20)); + jArchCheckBox.setBounds(new java.awt.Rectangle(168, 137, 340, 20)); jArchCheckBox.setPreferredSize(new java.awt.Dimension(340, 20)); jLabelFeatureFlag = new JLabel(); - jLabelFeatureFlag.setBounds(new java.awt.Rectangle(15, 110, 120, 20)); + jLabelFeatureFlag.setBounds(new java.awt.Rectangle(12, 112, 155, 20)); jLabelFeatureFlag.setText("Feature Flag Expression"); jLabelToolCode = new JLabel(); - jLabelToolCode.setBounds(new java.awt.Rectangle(15, 60, 120, 20)); + jLabelToolCode.setBounds(new java.awt.Rectangle(12, 62, 155, 20)); jLabelToolCode.setText("Tool Code"); jLabelTagName = new JLabel(); - jLabelTagName.setBounds(new java.awt.Rectangle(15, 35, 120, 20)); + jLabelTagName.setBounds(new java.awt.Rectangle(12, 37, 155, 20)); jLabelTagName.setText("Tag Name"); jLabelArch = new JLabel(); - jLabelArch.setBounds(new java.awt.Rectangle(15, 135, 120, 20)); + jLabelArch.setBounds(new java.awt.Rectangle(12, 137, 155, 20)); jLabelArch.setText("Supported Architectures"); jLabelToolChainFamily = new JLabel(); - jLabelToolChainFamily.setBounds(new java.awt.Rectangle(15, 85, 120, 20)); + jLabelToolChainFamily.setBounds(new java.awt.Rectangle(12, 87, 155, 20)); jLabelToolChainFamily.setText("Tool Chain Family"); jLabelFileName = new JLabel(); jLabelFileName.setText("File Name"); - jLabelFileName.setBounds(new java.awt.Rectangle(15, 10, 120, 20)); + jLabelFileName.setBounds(new java.awt.Rectangle(12, 12, 155, 20)); jContentPane = new JPanel(); jContentPane.setLayout(null); - jContentPane.setPreferredSize(new java.awt.Dimension(490, 185)); + jContentPane.setPreferredSize(new java.awt.Dimension(505, 192)); jContentPane.add(jLabelFileName, null); jContentPane.add(getJTextFieldSourceFilesDirectory(), null); @@ -341,6 +386,7 @@ public class SourceFilesDlg extends IDialog { jContentPane.add(getJTextFieldTagName(), null); jContentPane.add(jLabelToolCode, null); jContentPane.add(getJTextFieldToolCode(), null); + jContentPane.add(getIComboBoxToolCode(), null); jContentPane.add(getJTextFieldToolChainFamily(), null); jContentPane.add(jLabelFeatureFlag, null); jContentPane.add(getJTextFieldFeatureFlag(), null); @@ -380,13 +426,16 @@ public class SourceFilesDlg extends IDialog { String name = this.jTextFieldFileName.getText(); String s[] = name.split(";"); String tagName = this.jTextFieldTagName.getText(); - String toolCode = this.jTextFieldToolCode.getText(); + String toolCode = this.iComboBoxToolCode.getSelectedItem().toString(); + if (toolCode.equals(DataType.EMPTY_SELECT_ITEM)) { + toolCode = ""; + } String tcf = this.jTextFieldToolChainFamily.getText(); String featureFlag = this.jTextFieldFeatureFlag.getText(); Vector arch = this.jArchCheckBox.getSelectedItemsVector(); sfid = new SourceFilesIdentification[s.length]; for (int index = 0; index < s.length; index++) { - sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch); + sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch); } return sfid; }