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=53ac9a591cebdbcd9aa1824db298acb86d87dcda;hb=a19466adcb3939cd5fb8f919f000c04a0fe0b6f1;hpb=55a2762d8c1fe0291903f5015e11fd29b913f2b6 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 53ac9a591c..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; @@ -91,10 +94,12 @@ public class SourceFilesDlg extends IDialog { // // Not used by UI // - private SourceFilesIdentification sfid = null; + private SourceFilesIdentification sfid[] = null; 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(500, 235); + this.setSize(525, 240); this.setContentPane(getJScrollPane()); this.setTitle("Source Files"); this.setViewMode(false); this.centerWindow(); + Tools.generateComboBoxByVector(iComboBoxToolCode, ed.getVToolCode()); } /** @@ -268,16 +288,41 @@ public class SourceFilesDlg extends IDialog { **/ private void init(SourceFilesIdentification inSourceFilesIdentifications, String fileName) { init(); - this.sfid = inSourceFilesIdentifications; + //this.sfid = inSourceFilesIdentifications; this.msaFileName = fileName; - if (this.sfid != null) { - this.jTextFieldFileName.setText(sfid.getFilename()); - this.jTextFieldTagName.setText(sfid.getTagName()); - this.jTextFieldToolCode.setText(sfid.getToolCode()); - this.jTextFieldToolChainFamily.setText(sfid.getToolChainFamily()); - jTextFieldFeatureFlag.setText(sfid.getFeatureFlag()); - this.jArchCheckBox.setSelectedItems(sfid.getSupArchList()); + if (inSourceFilesIdentifications != null) { + this.jTextFieldFileName.setText(inSourceFilesIdentifications.getFilename()); + this.jTextFieldTagName.setText(inSourceFilesIdentifications.getTagName()); + + // + // 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.setText("Feature Flag"); + 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.setText("Sup Arch List"); + 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); @@ -376,14 +422,21 @@ public class SourceFilesDlg extends IDialog { } } - private SourceFilesIdentification getCurrentSourceFiles() { + private SourceFilesIdentification[] getCurrentSourceFiles() { 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(name, tagName, toolCode, tcf, featureFlag, arch); + sfid = new SourceFilesIdentification[s.length]; + for (int index = 0; index < s.length; index++) { + sfid[index] = new SourceFilesIdentification(s[index], tagName, toolCode, tcf, featureFlag, arch); + } return sfid; } @@ -399,11 +452,11 @@ public class SourceFilesDlg extends IDialog { // Check Filename // if (isEmpty(this.jTextFieldFileName.getText())) { - Log.err("File Name couldn't be empty"); + Log.wrn("Update Source Files", "File Name couldn't be empty"); return false; } if (!DataValidation.isFilename(this.jTextFieldFileName.getText())) { - Log.err("Incorrect data type for File Name"); + Log.wrn("Update Source Files", "Incorrect data type for File Name"); return false; } @@ -412,7 +465,7 @@ public class SourceFilesDlg extends IDialog { // if (!isEmpty(this.jTextFieldTagName.getText())) { if (!DataValidation.isTagName(this.jTextFieldTagName.getText())) { - Log.err("Incorrect data type for Tag Name"); + Log.wrn("Update Source Files", "Incorrect data type for Tag Name"); return false; } } @@ -422,7 +475,7 @@ public class SourceFilesDlg extends IDialog { // if (!isEmpty(this.jTextFieldToolCode.getText())) { if (!DataValidation.isToolCode(this.jTextFieldToolCode.getText())) { - Log.err("Incorrect data type for Tool Code"); + Log.wrn("Update Source Files", "Incorrect data type for Tool Code"); return false; } } @@ -432,7 +485,7 @@ public class SourceFilesDlg extends IDialog { // if (!isEmpty(this.jTextFieldToolChainFamily.getText())) { if (!DataValidation.isToolChainFamily(this.jTextFieldToolChainFamily.getText())) { - Log.err("Incorrect data type for Tool Chain Family"); + Log.wrn("Update Source Files", "Incorrect data type for Tool Chain Family"); return false; } } @@ -442,7 +495,7 @@ public class SourceFilesDlg extends IDialog { // if (!isEmpty(this.jTextFieldFeatureFlag.getText())) { if (!DataValidation.isFeatureFlag(this.jTextFieldFeatureFlag.getText())) { - Log.err("Incorrect data type for Feature Flag"); + Log.wrn("Update Source Files", "Incorrect data type for Feature Flag"); return false; } } @@ -457,17 +510,23 @@ public class SourceFilesDlg extends IDialog { private void selectFile() { JFileChooser fc = new JFileChooser(); fc.setCurrentDirectory(new File(Tools.getFilePathOnly(msaFileName))); + fc.setMultiSelectionEnabled(true); int result = fc.showOpenDialog(new JPanel()); if (result == JFileChooser.APPROVE_OPTION) { - this.jTextFieldFileName.setText(fc.getSelectedFile().getName()); + File f[] = fc.getSelectedFiles(); + String s = ""; + for (int index = 0; index < f.length; index++) { + s = s + f[index].getName() + ";"; + } + this.jTextFieldFileName.setText(s); } } - public SourceFilesIdentification getSfid() { + public SourceFilesIdentification[] getSfid() { return sfid; } - public void setSfid(SourceFilesIdentification sfid) { + public void setSfid(SourceFilesIdentification[] sfid) { this.sfid = sfid; } }