From: hche10x Date: Fri, 7 Jul 2006 05:38:39 +0000 (+0000) Subject: 1. Add help for ToolChainConfig X-Git-Tag: edk2-stable201903~25034 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=8f9acbd7afefaeb33a15f00cf4998e94fffeebd0 1. Add help for ToolChainConfig 2. Fix data validation bug in PCD of Msa git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@814 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java index c27ba89ed7..8a2c682ca0 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/About.java @@ -129,7 +129,7 @@ public class About extends IDialog { jLabel.setToolTipText(""); jLabel.setBounds(new java.awt.Rectangle(25,90,270,20)); jLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - jLabel.setText("Framework Wizard 1.0"); + jLabel.setText(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.setSize(new java.awt.Dimension(320,235)); diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java index 09e8f6d00f..8f1ec6c6ba 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/Clone.java @@ -675,7 +675,7 @@ public class Clone extends IDialog { // trg = getModulePath(); newId.setPath(trg); - vFiles = wt.getAllModuleFiles(src); + vFiles = wt.getAllModuleFilesPath(src); // // First copy all files to new directory @@ -738,7 +738,7 @@ public class Clone extends IDialog { // trg = this.getPackagePath(); newId.setPath(trg); - vFiles = wt.getAllPakcageFiles(src); + vFiles = wt.getAllPakcageFilesPath(src); FileOperation.copyFile(src, trg); for (int index = 1; index < vFiles.size(); index++) { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index 0c48798cdc..af4c2a6fc5 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -136,10 +136,6 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele private int currentOpeningPlatformIndex = -1; - private String projectName = "FrameworkWizard"; - - private String projectVersion = "0.5"; - private IDefaultMutableTreeNode dmtnRoot = null; private IDefaultMutableTreeNode dmtnModuleDescription = null; @@ -1690,7 +1686,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele this.addComponentListener(this); this.getCompontentsFromFrameworkDatabase(); this.setContentPane(getJContentPane()); - this.setTitle(projectName + " " + projectVersion + " " + "- [" + Workspace.getCurrentWorkspace() + "]"); + this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]"); this.setExitType(1); // @@ -2879,7 +2875,7 @@ public class FrameworkWizardUI extends IFrame implements MouseListener, TreeSele // Reinit whole window // closeAll(); - this.setTitle(projectName + " " + projectVersion + " " + "- [" + Workspace.getCurrentWorkspace() + "]"); + this.setTitle(DataType.PROJECT_NAME + " " + DataType.PROJECT_VERSION + " " + "- [" + Workspace.getCurrentWorkspace() + "]"); } sw.dispose(); } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java index 393e70cb76..8d0055a403 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfig.java @@ -20,20 +20,29 @@ import java.io.IOException; import javax.swing.JButton; import javax.swing.JFileChooser; +import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.Log; import org.tianocore.frameworkwizard.common.Tools; +import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigId; import org.tianocore.frameworkwizard.common.Identifications.ToolChainConfigVector; import org.tianocore.frameworkwizard.common.ui.IDialog; import org.tianocore.frameworkwizard.common.ui.IFrame; import org.tianocore.frameworkwizard.workspace.Workspace; -public class ToolChainConfig extends IDialog { +public class ToolChainConfig extends IDialog implements ListSelectionListener, TableModelListener{ /// /// Define Class Members @@ -58,14 +67,31 @@ public class ToolChainConfig extends IDialog { + DataType.FILE_SEPARATOR + "Conf"; private String currentFile = Tools.addFileSeparator(toolsDir) + "tools_def.template"; - + private ToolChainConfigVector vtcc = new ToolChainConfigVector(); + private JLabel jLabelName = null; + + private JTextField jTextFieldName = null; + + private JLabel jLabelValue = null; + + private JTextField jTextFieldValue = null; + + private JButton jButtonAdd = null; + + private JButton jButtonRemove = null; + + private int selectedRow = -1; + + private JButton jButtonHelp = null; + /** - * This method initializes jScrollPane - * - * @return javax.swing.JScrollPane - */ + This method initializes jScrollPane + + @return javax.swing.JScrollPane + + **/ private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); @@ -76,29 +102,42 @@ public class ToolChainConfig extends IDialog { } /** - * This method initializes jTable - * - * @return javax.swing.JTable - */ + This method initializes jTable + + @return javax.swing.JTable + + **/ private JTable getJTable() { if (jTable == null) { - jTable = new JTable(); - // model = new DefaultTableModel(); - // jTable = new JTable(model); - // jTable.setRowHeight(20); +// Vector vTableHeader = new Vector(); +// vTableHeader.addElement("Name"); +// vTableHeader.addElement("Value"); +// + model = new DefaultTableModel(); + //model = new DefaultTableModel(vTableHeader); + jTable = new JTable(model); + jTable.setRowHeight(20); + + model.addColumn("Property"); + model.addColumn("Value"); + + jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTable.getSelectionModel().addListSelectionListener(this); + jTable.getModel().addTableModelListener(this); } return jTable; } /** - * This method initializes jButtonOpen - * - * @return javax.swing.JButton - */ + This method initializes jButtonOpen + + @return javax.swing.JButton + + **/ private JButton getJButtonOpen() { if (jButtonOpen == null) { jButtonOpen = new JButton(); - jButtonOpen.setBounds(new java.awt.Rectangle(140, 390, 120, 25)); + jButtonOpen.setBounds(new java.awt.Rectangle(40, 405, 120, 20)); jButtonOpen.setText("Open a file"); jButtonOpen.addActionListener(this); } @@ -106,14 +145,15 @@ public class ToolChainConfig extends IDialog { } /** - * This method initializes jButtonSave - * - * @return javax.swing.JButton - */ + This method initializes jButtonSave + + @return javax.swing.JButton + + **/ private JButton getJButtonSave() { if (jButtonSave == null) { jButtonSave = new JButton(); - jButtonSave.setBounds(new java.awt.Rectangle(280, 390, 120, 25)); + jButtonSave.setBounds(new java.awt.Rectangle(170, 405, 120, 20)); jButtonSave.setText("Save to a file"); jButtonSave.addActionListener(this); } @@ -121,20 +161,96 @@ public class ToolChainConfig extends IDialog { } /** - * This method initializes jButtonClose - * - * @return javax.swing.JButton - */ + This method initializes jButtonClose + + @return javax.swing.JButton + + **/ private JButton getJButtonClose() { if (jButtonClose == null) { jButtonClose = new JButton(); - jButtonClose.setBounds(new java.awt.Rectangle(465, 390, 100, 25)); + jButtonClose.setBounds(new java.awt.Rectangle(490, 405, 80, 20)); jButtonClose.setText("Close"); jButtonClose.addActionListener(this); } return jButtonClose; } + /** + This method initializes jTextFieldName + + @return javax.swing.JTextField + + **/ + private JTextField getJTextFieldName() { + if (jTextFieldName == null) { + jTextFieldName = new JTextField(); + jTextFieldName.setBounds(new java.awt.Rectangle(60, 365, 140, 20)); + } + return jTextFieldName; + } + + /** + This method initializes jTextFieldValue + + @return javax.swing.JTextField + + **/ + private JTextField getJTextFieldValue() { + if (jTextFieldValue == null) { + jTextFieldValue = new JTextField(); + jTextFieldValue.setBounds(new java.awt.Rectangle(250, 365, 140, 20)); + } + return jTextFieldValue; + } + + /** + This method initializes jButtonAdd + + @return javax.swing.JButton + + **/ + private JButton getJButtonAdd() { + if (jButtonAdd == null) { + jButtonAdd = new JButton(); + jButtonAdd.setBounds(new java.awt.Rectangle(400, 365, 80, 20)); + jButtonAdd.setText("Add"); + jButtonAdd.addActionListener(this); + } + return jButtonAdd; + } + + /** + This method initializes jButtonRemove + + @return javax.swing.JButton + + **/ + private JButton getJButtonRemove() { + if (jButtonRemove == null) { + jButtonRemove = new JButton(); + jButtonRemove.setBounds(new java.awt.Rectangle(490, 365, 80, 20)); + jButtonRemove.setText("Remove"); + jButtonRemove.addActionListener(this); + } + return jButtonRemove; + } + + /** + * This method initializes jButtonHelp + * + * @return javax.swing.JButton + */ + private JButton getJButtonHelp() { + if (jButtonHelp == null) { + jButtonHelp = new JButton(); + jButtonHelp.setBounds(new java.awt.Rectangle(300,405,120,20)); + jButtonHelp.setText("Help"); + jButtonHelp.addActionListener(this); + } + return jButtonHelp; + } + /** @param args @@ -154,10 +270,9 @@ public class ToolChainConfig extends IDialog { } /** - * This method initializes this - * - * @return void - */ + This method initializes this + + **/ private void init() { this.setSize(600, 480); this.setContentPane(getJContentPane()); @@ -185,18 +300,32 @@ public class ToolChainConfig extends IDialog { } /** - * This method initializes jContentPane - * - * @return javax.swing.JPanel - */ + This method initializes jContentPane + + @return javax.swing.JPanel + + **/ private JPanel getJContentPane() { if (jContentPane == null) { + jLabelValue = new JLabel(); + jLabelValue.setBounds(new java.awt.Rectangle(205, 365, 40, 20)); + jLabelValue.setText("Value"); + jLabelName = new JLabel(); + jLabelName.setBounds(new java.awt.Rectangle(15, 365, 40, 20)); + jLabelName.setText("Name"); jContentPane = new JPanel(); jContentPane.setLayout(null); jContentPane.add(getJScrollPane(), null); jContentPane.add(getJButtonOpen(), null); jContentPane.add(getJButtonSave(), null); jContentPane.add(getJButtonClose(), null); + jContentPane.add(jLabelName, null); + jContentPane.add(getJTextFieldName(), null); + jContentPane.add(jLabelValue, null); + jContentPane.add(getJTextFieldValue(), null); + jContentPane.add(getJButtonAdd(), null); + jContentPane.add(getJButtonRemove(), null); + jContentPane.add(getJButtonHelp(), null); } return jContentPane; } @@ -214,15 +343,15 @@ public class ToolChainConfig extends IDialog { if (arg0.getSource() == jButtonOpen) { JFileChooser fc = new JFileChooser(); - fc.setAcceptAllFileFilterUsed(false); + fc.setAcceptAllFileFilterUsed(true); fc.setCurrentDirectory(new File(toolsDir)); - int result = fc.showSaveDialog(new JPanel()); + int result = fc.showOpenDialog(new JPanel()); if (result == JFileChooser.APPROVE_OPTION) { try { vtcc.removeAll(); vtcc.parseFile(fc.getSelectedFile().getPath()); - currentFile = fc.getSelectedFile().getPath(); + currentFile = fc.getSelectedFile().getPath(); this.setTitle("Tool Chain Configuration" + " [" + currentFile + "]"); } catch (IOException e) { Log.err(this.currentFile + "Read Error", e.getMessage()); @@ -235,13 +364,45 @@ public class ToolChainConfig extends IDialog { if (arg0.getSource() == jButtonSave) { JFileChooser fc = new JFileChooser(); - fc.setAcceptAllFileFilterUsed(false); - fc.setCurrentDirectory(new File(toolsDir)); + fc.setAcceptAllFileFilterUsed(true); + fc.setSelectedFile(new File(currentFile)); - int result = fc.showOpenDialog(new JPanel()); + int result = fc.showSaveDialog(new JPanel()); if (result == JFileChooser.APPROVE_OPTION) { + currentFile = fc.getSelectedFile().getPath(); + try { + vtcc.saveFile(currentFile); + } catch (IOException e) { + Log.err(this.currentFile + "Write Error", e.getMessage()); + e.printStackTrace(); + return; + } + } + } + + if (arg0.getSource() == jButtonAdd) { + if (check()) { + String[] row = { jTextFieldName.getText(), jTextFieldValue.getText() }; + this.vtcc.addToolChainConfigs(new ToolChainConfigId(row[0], row[1])); + this.model.addRow(row); } } + + if (arg0.getSource() == jButtonRemove) { + if (jTable.isEditing()) { + jTable.getCellEditor().stopCellEditing(); + } + if (selectedRow > -1) { + this.model.removeRow(selectedRow); + this.vtcc.removeToolChainConfigs(selectedRow); + selectedRow = -1; + } + } + + if (arg0.getSource() == jButtonHelp) { + ToolChainConfigHelp tcch = new ToolChainConfigHelp(); + tcch.setVisible(true); + } } /** @@ -249,17 +410,71 @@ public class ToolChainConfig extends IDialog { **/ private void showTable() { - model = new DefaultTableModel(); - jTable = new JTable(model); - jTable.setRowHeight(20); - - model.addColumn("Name"); - model.addColumn("Value"); + clearAll(); + if (vtcc.size() > 0) { for (int index = 0; index < vtcc.size(); index++) { model.addRow(vtcc.toStringVector(index)); } } - this.jScrollPane.setViewportView(this.jTable); + this.jTable.repaint(); + this.jTable.updateUI(); + //this.jScrollPane.setViewportView(this.jTable); + } + + /** + Clear all table rows + + **/ + private void clearAll() { + if (model != null) { + for (int index = model.getRowCount() - 1; index >= 0; index--) { + model.removeRow(index); + } + } + } + + /** + Check if name or value is empty + + @return + + **/ + private boolean check() { + if (isEmpty(this.jTextFieldName.getText())) { + Log.err("Add Tool Chain", "Name couldn't be empty!"); + return false; + } + + if (isEmpty(this.jTextFieldValue.getText())) { + Log.err("Add Tool Chain", "Value couldn't be empty"); + return false; + } + return true; + } + + /* (non-Javadoc) + * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) + * + */ + public void valueChanged(ListSelectionEvent arg0) { + if (arg0.getValueIsAdjusting()) { + return; + } + ListSelectionModel lsm = (ListSelectionModel) arg0.getSource(); + if (lsm.isSelectionEmpty()) { + return; + } else { + selectedRow = lsm.getMinSelectionIndex(); + } + } + + public void tableChanged(TableModelEvent arg0) { + int row = arg0.getFirstRow(); + TableModel m = (TableModel)arg0.getSource(); + if (arg0.getType() == TableModelEvent.UPDATE){ + this.vtcc.getToolChainConfigs(row).setName(m.getValueAt(row, 0).toString()); + this.vtcc.getToolChainConfigs(row).setValue(m.getValueAt(row, 1).toString()); + } } } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java new file mode 100644 index 0000000000..e6bbe16fa6 --- /dev/null +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/ToolChainConfigHelp.java @@ -0,0 +1,132 @@ +package org.tianocore.frameworkwizard; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextPane; + +import org.tianocore.frameworkwizard.common.DataType; +import javax.swing.JButton; + + +public class ToolChainConfigHelp extends JFrame implements ActionListener { + + /// + /// + /// + private static final long serialVersionUID = -6315081029366587222L; + + private JPanel jContentPane = null; + + private String helpContent = ""; + + private JTextPane jTextPane = null; + + private JButton jButtonClose = null; + + /** + * This method initializes jTextPane + * + * @return javax.swing.JTextPane + */ + private JTextPane getJTextPane() { + if (jTextPane == null) { + jTextPane = new JTextPane(); + jTextPane.setBounds(new java.awt.Rectangle(10,10,600,420)); + jTextPane.setBackground(new java.awt.Color(238,238,238)); + jTextPane.setEditable(false); + helpContent = helpContent + + "The coding forthe Property is: TARGET_TAGNAME_ARCH_COMMAND_ATTR" + DataType.UNIX_LINE_SEPARATOR + + "The Value, is either afull path, full path and filename or a reserved word." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + "TARGET - DEBUG and RELEASE are predefined, however the user may define one or more of their own TARGET types in this file." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + "TAGNAME - HOST, MSFT, GCC, INTC are predefined, however the user may define one or more of their own TAGNAME keywords in this file." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + "ARCH - EDK II supports IA32, X64, IPF and EBC at this time." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + "COMMAND - Predefined command codes are listed in the tools_def.txt file, however the user can specify additional command codes for their one, non-standard tools." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + "ATTR - Predefined Attributes are listed in the tools_def.txt file." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + "NOTE: The TAGNAME: HOST is reserved and MUST be defined in order to build the included Tiano tools from their C source files. These tools have been built and tested using both Microsoft and GCC tool chains." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR + + "NOTE: The \"*\" symbol may be used as a wildcard character in most of these fields, refer to the tools_def.txt and the \"EDK II Build and Packaging Architecture Specification\" for more details." + DataType.UNIX_LINE_SEPARATOR + + DataType.UNIX_LINE_SEPARATOR; + + + jTextPane.setText(helpContent); + } + return jTextPane; + } + + /** + * This method initializes jButtonClose + * + * @return javax.swing.JButton + */ + private JButton getJButtonClose() { + if (jButtonClose == null) { + jButtonClose = new JButton(); + jButtonClose.setBounds(new java.awt.Rectangle(480,450,80,20)); + jButtonClose.setText("Close"); + jButtonClose.addActionListener(this); + } + return jButtonClose; + } + + /** + + @param args + + **/ + public static void main(String[] args) { + ToolChainConfigHelp tcch = new ToolChainConfigHelp(); + tcch.setVisible(true); + } + + /** + * This is the default constructor + */ + public ToolChainConfigHelp() { + super(); + initialize(); + } + + /** + * This method initializes this + * + * @return void + */ + private void initialize() { + this.setSize(625, 520); + this.setTitle("How to Setup Tool Chain Configuration"); + this.setContentPane(getJContentPane()); + } + + /** + * This method initializes jContentPane + * + * @return javax.swing.JPanel + */ + private JPanel getJContentPane() { + if (jContentPane == null) { + jContentPane = new JPanel(); + jContentPane.setLayout(null); + jContentPane.add(getJTextPane(), null); + jContentPane.add(getJButtonClose(), null); + } + return jContentPane; + } + + public void actionPerformed(ActionEvent arg0) { + if (arg0.getSource() == jButtonClose) { + this.dispose(); + } + + } + +} diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java index c096b72416..ef1b6bb922 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/DataType.java @@ -163,4 +163,12 @@ public class DataType { // Will be replaced by resource file later // public static final String SUP_ARCH_LIST_HELP_TEXT = "Deselecting a checkbox will restrict this module for use with the selected architectures, based on the list of items that are checked. If all boxes are checked, then the module will support all current AND FUTURE architectures"; + + // + // Project name and version + // + public static final String PROJECT_NAME = "Framework Wizard"; + + public static final String PROJECT_VERSION = "1.0"; + } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java index 347a66970e..49aac3d074 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Identifications/ToolChainConfigVector.java @@ -15,8 +15,10 @@ package org.tianocore.frameworkwizard.common.Identifications; import java.io.BufferedReader; +import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; +import java.io.FileWriter; import java.io.IOException; import java.util.Vector; @@ -49,7 +51,7 @@ public class ToolChainConfigVector { return null; } } - + public Vector toStringVector(int index) { Vector v = new Vector(); v.addElement(getToolChainConfigs(index).getName()); @@ -77,7 +79,7 @@ public class ToolChainConfigVector { vToolChainConfigs.removeElementAt(index); } } - + public void removeAll() { vToolChainConfigs = new Vector(); } @@ -89,7 +91,7 @@ public class ToolChainConfigVector { } return v; } - + public Vector getToolChainConfigsValue() { Vector v = new Vector(); for (int index = 0; index < this.vToolChainConfigs.size(); index++) { @@ -102,13 +104,29 @@ public class ToolChainConfigVector { return this.vToolChainConfigs.size(); } + public void saveFile(String file) throws IOException { + if (size() > 0) { + FileWriter fw = new FileWriter(file); + BufferedWriter bw = new BufferedWriter(fw); + for (int index = 0; index < size(); index++) { + String line = this.getToolChainConfigs(index).getName() + " " + ToolChainConfigId.EQUALS + " " + + this.getToolChainConfigs(index).getValue(); + bw.write(line); + bw.newLine(); + } + bw.flush(); + bw.close(); + fw.close(); + } + } + /** - + @param file @throws IOException @throws FileNotFoundException - - **/ + + **/ public void parseFile(String file) throws IOException { FileReader fr = new FileReader(file); BufferedReader br = new BufferedReader(fr); @@ -118,13 +136,13 @@ public class ToolChainConfigVector { line = br.readLine(); } } - + /** Parse the input string and add name, value to vector @param line - - **/ + + **/ private void parseLine(String line) { String name = ""; String value = ""; diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java index 57f3b4e2dc..3272d207f3 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IDialog.java @@ -67,9 +67,6 @@ public class IDialog extends JDialog implements ActionListener { initialize(); } - /** - * This is the override constructor - */ /** This is the override constructor @@ -80,6 +77,17 @@ public class IDialog extends JDialog implements ActionListener { super(parentFrame, modal); initialize(); } + + /** + This is the override constructor + + @param parentFrame The parent frame which open the dialog + @param modal true means the dialog is modal dialog; false means the dialog is not modal dialog + **/ + public IDialog(IDialog parentFrame, boolean modal) { + super(parentFrame, modal); + initialize(); + } /** This method initializes this diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java index 028ad8aaed..d87fca0d82 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/module/ui/ModulePCDs.java @@ -580,7 +580,7 @@ public class ModulePCDs extends IInternalFrame { // Check TokenSpaceGuid // if (!isEmpty(this.jTextFieldTokenSpaceGuid.getText())) { - if (!DataValidation.isGuid(this.jTextFieldTokenSpaceGuid.getText())) { + if (!DataValidation.isC_NameType(this.jTextFieldTokenSpaceGuid.getText())) { Log.err("Incorrect data type for Token Space C_Name"); return false; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java index 73fba9a861..a87ab07794 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/workspace/WorkspaceTools.java @@ -20,6 +20,7 @@ import java.util.Vector; import org.apache.xmlbeans.XmlException; import org.tianocore.DbPathAndFilename; import org.tianocore.FrameworkDatabaseDocument; +import org.tianocore.IndustryStdIncludesDocument.IndustryStdIncludes; import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea; import org.tianocore.MsaFilesDocument.MsaFiles; import org.tianocore.MsaHeaderDocument.MsaHeader; @@ -96,6 +97,34 @@ public class WorkspaceTools { } return modulePath; } + + /** + Get all Industry Std Includes' paths from one package + + @return a Vector with all paths + + **/ + public Vector getAllIndustryStdIncludesOfPackage(String path) { + Vector includePath = new Vector(); + try { + IndustryStdIncludes files = OpenFile.openSpdFile(path).getIndustryStdIncludes(); + if (files != null) { + for (int index = 0; index < files.getIndustryStdHeaderList().size(); index++) { + String temp = files.getIndustryStdHeaderList().get(index).getName(); + temp = Tools.addFileSeparator(Tools.getFilePathOnly(path)) + temp; + temp = Tools.convertPathToCurrentOsType(temp); + includePath.addElement(temp); + } + } + } catch (IOException e) { + e.printStackTrace(); + } catch (XmlException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return includePath; + } /** Get all package basic information form the FrameworkDatabase.db file @@ -583,7 +612,7 @@ public class WorkspaceTools { @throws Exception **/ - public Vector getAllModuleFiles(String path) throws IOException, XmlException, Exception { + public Vector getAllModuleFilesPath(String path) throws IOException, XmlException, Exception { Vector v = new Vector(); path = Tools.convertPathToCurrentOsType(path); v.addElement(path); @@ -615,7 +644,7 @@ public class WorkspaceTools { @throws Exception **/ - public Vector getAllPakcageFiles(String path) throws IOException, XmlException, Exception { + public Vector getAllPakcageFilesPath(String path) throws IOException, XmlException, Exception { Vector v = new Vector(); path = Tools.convertPathToCurrentOsType(path); // @@ -624,17 +653,25 @@ public class WorkspaceTools { v.addElement(path); // - // Add module's files one by one + // Add the package's industry std includes one by one // Vector f1 = new Vector(); + f1 = getAllIndustryStdIncludesOfPackage(path); + for (int index = 0; index < f1.size(); index++) { + v.addElement(f1.get(index)); + } + + // + // Add module's files one by one + // + f1 = new Vector(); f1 = getAllModulesOfPackage(path); for (int indexI = 0; indexI < f1.size(); indexI++) { - Vector f2 = getAllModuleFiles(f1.get(indexI)); + Vector f2 = getAllModuleFilesPath(f1.get(indexI)); for (int indexJ = 0; indexJ < f2.size(); indexJ++) { v.addElement(f2.get(indexJ)); } } - //v.add(0, path); return v; }