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=6ca65fa04e7a96a97ec70ad70468878a74ac1645;hp=53ac9a591cebdbcd9aa1824db298acb86d87dcda;hb=214b0d1914b48d651b25e58f321ddb77a46903b8;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..6ca65fa04e 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,23 @@ 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.ModuleIdentification;
import org.tianocore.frameworkwizard.module.Identifications.SourceFiles.SourceFilesIdentification;
+import org.tianocore.frameworkwizard.workspace.WorkspaceTools;
/**
- 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 +79,8 @@ public class SourceFilesDlg extends IDialog {
private JTextField jTextFieldToolCode = null;
+ private IComboBox iComboBoxToolCode = null;
+
private JTextField jTextFieldToolChainFamily = null;
private JLabel jLabelFeatureFlag = null;
@@ -83,7 +88,7 @@ public class SourceFilesDlg extends IDialog {
private JTextField jTextFieldFeatureFlag = null;
private ArchCheckBox jArchCheckBox = null;
-
+
private JButton jButtonOk = null;
private JButton jButtonCancel = null;
@@ -91,10 +96,14 @@ 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();
+
+ private WorkspaceTools wt = new WorkspaceTools();
+
/**
This method initializes jTextFieldFileName
@@ -104,7 +113,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 +130,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 +158,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 field to enter your customized
"
+ + "tool command.
"
+ + "Press ENTER to save your input or press ESCAPE to quit");
+ }
+ return iComboBoxToolCode;
+ }
+
/**
* This method initializes jTextFieldToolCode
*
@@ -164,9 +186,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 +202,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,9 +217,10 @@ 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, 137, 340, 20));
jTextFieldFeatureFlag.setPreferredSize(new java.awt.Dimension(340, 20));
jTextFieldFeatureFlag.setToolTipText("RESERVED FOR FUTURE USE");
+ jTextFieldFeatureFlag.setEnabled(false);
}
return jTextFieldFeatureFlag;
}
@@ -210,7 +234,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 +250,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);
}
@@ -241,9 +265,9 @@ public class SourceFilesDlg extends IDialog {
This is the default constructor
**/
- public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, String fileName) {
+ public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, ModuleIdentification mid) {
super(iFrame, true);
- init(inSourceFilesIdentification, fileName);
+ init(inSourceFilesIdentification, mid);
}
/**
@@ -251,11 +275,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());
}
/**
@@ -266,18 +291,47 @@ public class SourceFilesDlg extends IDialog {
@param inSourceFiles The input data of SourceFilesDocument.SourceFiles
**/
- private void init(SourceFilesIdentification inSourceFilesIdentifications, String fileName) {
+ private void init(SourceFilesIdentification inSourceFilesIdentifications, ModuleIdentification mid) {
init();
- 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());
+ this.msaFileName = mid.getPath();
+
+ //
+ // Init arch with module's arch
+ //
+ this.jArchCheckBox.setEnabledItems(wt.getModuleArch(mid));
+
+ 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 +357,31 @@ 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, 112, 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, 137, 155, 20));
+ jLabelFeatureFlag.setText("Feature Flag Expression");
+ jLabelFeatureFlag.setEnabled(false);
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, 112, 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 +396,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 +432,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 +462,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 must be entered!");
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 +475,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 +485,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 +495,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 +505,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 +520,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;
}
}