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=3c868494ef468381338d5624682722ef4ee8886e;hb=a19466adcb3939cd5fb8f919f000c04a0fe0b6f1;hpb=06a19ceec7b8b78f4698073ce4054b26dc4a74bd
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 3c868494ef..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
@@ -15,6 +15,7 @@
package org.tianocore.frameworkwizard.module.ui.dialog;
import java.awt.event.ActionEvent;
+import java.io.File;
import java.util.Vector;
import javax.swing.JButton;
@@ -26,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;
-import org.tianocore.frameworkwizard.workspace.Workspace;
/**
- 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 {
@@ -75,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,14 +87,18 @@ public class SourceFilesDlg extends IDialog {
private ArchCheckBox jArchCheckBox = null;
+ private JButton jButtonOk = null;
+
+ private JButton jButtonCancel = null;
+
//
// Not used by UI
//
- private SourceFilesIdentification sfid = null;
+ private SourceFilesIdentification sfid[] = null;
- private JButton jButtonOk = null;
+ private String msaFileName = "";
- private JButton jButtonCancel = null;
+ private EnumerationData ed = new EnumerationData();
/**
This method initializes jTextFieldFileName
@@ -101,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");
}
@@ -118,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);
}
@@ -146,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
*
@@ -161,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;
}
@@ -176,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");
}
@@ -191,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");
}
@@ -207,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);
}
@@ -223,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);
}
@@ -238,9 +260,9 @@ public class SourceFilesDlg extends IDialog {
This is the default constructor
**/
- public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame) {
+ public SourceFilesDlg(SourceFilesIdentification inSourceFilesIdentification, IFrame iFrame, String fileName) {
super(iFrame, true);
- init(inSourceFilesIdentification);
+ init(inSourceFilesIdentification, fileName);
}
/**
@@ -248,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());
}
/**
@@ -263,17 +286,43 @@ public class SourceFilesDlg extends IDialog {
@param inSourceFiles The input data of SourceFilesDocument.SourceFiles
**/
- private void init(SourceFilesIdentification inSourceFilesIdentifications) {
+ private void init(SourceFilesIdentification inSourceFilesIdentifications, String fileName) {
init();
- this.sfid = inSourceFilesIdentifications;
-
- 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.sfid = inSourceFilesIdentifications;
+ this.msaFileName = fileName;
+
+ 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());
}
}
@@ -299,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);
@@ -337,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);
@@ -372,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;
}
@@ -395,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;
}
@@ -408,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;
}
}
@@ -418,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;
}
}
@@ -428,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;
}
}
@@ -438,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;
}
}
@@ -451,19 +508,25 @@ public class SourceFilesDlg extends IDialog {
**/
private void selectFile() {
- JFileChooser fc = new JFileChooser(Workspace.getCurrentWorkspace());
-
+ 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;
}
}