From: jlin16 Date: Tue, 4 Jul 2006 08:11:49 +0000 (+0000) Subject: Add ModuleSA BuildOptions X-Git-Tag: edk2-stable201903~25100 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=1800d80f22f225e931a318c785646f581562d608 Add ModuleSA BuildOptions git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@737 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java index e48ff495c2..b94e695ecc 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java @@ -15,10 +15,8 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; -import java.awt.Dimension; import javax.swing.JPanel; -import javax.swing.JDialog; import javax.swing.JTabbedPane; import javax.swing.JCheckBox; import javax.swing.JLabel; @@ -26,18 +24,13 @@ import java.awt.FlowLayout; import javax.swing.AbstractAction; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import javax.swing.ButtonGroup; import javax.swing.DefaultCellEditor; -import javax.swing.DefaultListModel; import javax.swing.JTextField; import javax.swing.JButton; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JComboBox; -import javax.swing.JRadioButton; import javax.swing.ListSelectionModel; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; @@ -51,11 +44,11 @@ import javax.swing.table.TableModel; import org.tianocore.PlatformSurfaceAreaDocument; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; -import java.awt.CardLayout; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Set; +import java.util.Vector; public class FpdBuildOptions extends IInternalFrame { @@ -109,7 +102,6 @@ public class FpdBuildOptions extends IInternalFrame { private JTable jTable5 = null; private JButton jButton10 = null; private JButton jButton11 = null; - private DefaultListModel listModel = new DefaultListModel(); private JButton jButton17 = null; private JButton jButton18 = null; private FpdFileContents ffc = null; @@ -856,9 +848,22 @@ public class FpdBuildOptions extends IInternalFrame { TableModel m = (TableModel)arg0.getSource(); if (arg0.getType() == TableModelEvent.UPDATE){ //ToDo Data Validition check. - String targetName = m.getValueAt(row, 0) + ""; + String targets = m.getValueAt(row, 0) + ""; + Vector targetName = new Vector(); + String[] sArray = targets.split("( )+"); + for (int i = 0; i < sArray.length; ++i) { + targetName.add(sArray[i]); + } String toolChain = m.getValueAt(row, 1) + ""; - String supArch = m.getValueAt(row, 2) + ""; + String archs = m.getValueAt(row, 2) + ""; + Vector supArch = new Vector(); + String[] sArray1 = archs.split("( )+"); + for (int i = 0; i < sArray1.length; ++i) { + supArch.add(sArray1[i]); + } + if (supArch.size() == 0) { + supArch.add("IA32"); + } String toolCmd = m.getValueAt(row, 3) + ""; String tagName = m.getValueAt(row, 4) + ""; String contents = m.getValueAt(row, 5) + ""; @@ -893,13 +898,23 @@ public class FpdBuildOptions extends IInternalFrame { Object[] o = {jTextField12.getText(), jComboBox2.getSelectedItem(), s, jTextField8.getText(), jTextField13.getText(), jTextField7.getText()}; optionsTableModel.addRow(o); - ffc.genBuildOptionsOpt(jTextField12.getText(), jComboBox2.getSelectedItem()+"", jTextField13.getText(), jTextField8.getText(), s, jTextField7.getText()); + + ffc.genBuildOptionsOpt(stringToVector(jTextField12.getText()), jComboBox2.getSelectedItem()+"", jTextField13.getText(), jTextField8.getText(), stringToVector(s), jTextField7.getText()); } }); } return jButton10; } + private Vector stringToVector(String s) { + String[] sArray = s.split(" "); + Vector v = new Vector(); + for (int i = 0; i < sArray.length; ++i) { + v.add(sArray[i]); + } + return v; + } + private String boolToList (boolean[] bool) { String s = " "; if (bool[0]) { @@ -920,7 +935,9 @@ public class FpdBuildOptions extends IInternalFrame { if (bool[5]) { s += "PPC "; } - + if (s == " ") { + s += "IA32"; + } return s.trim(); } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java index b9e772e0b3..21e0a5b25b 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFileContents.java @@ -391,6 +391,149 @@ public class FpdFileContents { instance.setPackageVersion(pv); } + + public String getFvBinding(String moduleKey){ + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa == null || msa.getModuleSaBuildOptions() == null) { + return null; + } + return msa.getModuleSaBuildOptions().getFvBinding(); + } + + public void setFvBinding(String moduleKey, String fvBinding){ + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa == null ) { + return; + } + if(msa.getModuleSaBuildOptions() == null){ + msa.addNewModuleSaBuildOptions().setFvBinding(fvBinding); + return; + } + msa.getModuleSaBuildOptions().setFvBinding(fvBinding); + } + + public String getFfsFileNameGuid(String moduleKey){ + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa == null || msa.getModuleSaBuildOptions() == null) { + return null; + } + return msa.getModuleSaBuildOptions().getFfsFileNameGuid(); + } + + public void setFfsFileNameGuid(String moduleKey, String fileGuid){ + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa == null ) { + return; + } + if(msa.getModuleSaBuildOptions() == null){ + msa.addNewModuleSaBuildOptions().setFfsFileNameGuid(fileGuid); + return; + } + msa.getModuleSaBuildOptions().setFfsFileNameGuid(fileGuid); + } + + public String getFfsFormatKey(String moduleKey){ + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa == null || msa.getModuleSaBuildOptions() == null) { + return null; + } + return msa.getModuleSaBuildOptions().getFfsFormatKey(); + } + + public void setFfsFormatKey(String moduleKey, String ffsKey){ + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa == null ) { + return; + } + if(msa.getModuleSaBuildOptions() == null){ + msa.addNewModuleSaBuildOptions().setFfsFormatKey(ffsKey); + return; + } + msa.getModuleSaBuildOptions().setFvBinding(ffsKey); + } + + public void getModuleSAOptions(String moduleKey, String[][] saa) { + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null + || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) { + return ; + } + + List lOpt = msa.getModuleSaBuildOptions().getOptions().getOptionList(); + ListIterator li = lOpt.listIterator(); + int i = 0; + while(li.hasNext()) { + OptionDocument.Option opt = (OptionDocument.Option)li.next(); + if (opt.getBuildTargets() != null) { + saa[i][0] = listToString(opt.getBuildTargets()); + } + saa[i][1] = opt.getToolChainFamily(); + if (opt.getSupArchList() != null){ + saa[i][2] = listToString(opt.getSupArchList()); + + } + saa[i][3] = opt.getToolCode(); + saa[i][4] = opt.getTagName(); + saa[i][5] = opt.getStringValue(); + + ++i; + } + } + + public int getModuleSAOptionsCount(String moduleKey){ + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null + || msa.getModuleSaBuildOptions().getOptions().getOptionList() == null) { + return 0; + } + return msa.getModuleSaBuildOptions().getOptions().getOptionList().size(); + } + + public void genModuleSAOptionsOpt(String moduleKey, Vector buildTargets, String toolChain, String tagName, String toolCmd, Vector archList, String contents) { + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa.getModuleSaBuildOptions() == null) { + msa.addNewModuleSaBuildOptions(); + } + if (msa.getModuleSaBuildOptions().getOptions() == null){ + msa.getModuleSaBuildOptions().addNewOptions(); + } + OptionDocument.Option opt = msa.getModuleSaBuildOptions().getOptions().addNewOption(); + setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt); + } + + public void removeModuleSAOptionsOpt(String moduleKey, int i) { + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) { + return ; + } + OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions(); + XmlCursor cursor = opts.newCursor(); + if (cursor.toFirstChild()) { + for (int j = 0; j < i; ++j){ + cursor.toNextSibling(); + } + cursor.removeXml(); + } + cursor.dispose(); + } + + public void updateModuleSAOptionsOpt(String moduleKey, int i, Vector buildTargets, String toolChain, String tagName, String toolCmd, Vector archList, String contents) { + ModuleSADocument.ModuleSA msa = getModuleSA(moduleKey); + if (msa.getModuleSaBuildOptions() == null || msa.getModuleSaBuildOptions().getOptions() == null) { + return ; + } + OptionsDocument.Options opts = msa.getModuleSaBuildOptions().getOptions(); + XmlCursor cursor = opts.newCursor(); + if (cursor.toFirstChild()) { + for (int j = 0; j < i; ++j){ + cursor.toNextSibling(); + } + OptionDocument.Option opt = (OptionDocument.Option)cursor.getObject(); + setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt); + } + cursor.dispose(); + } + /**add pcd information of module mi to a ModuleSA. * @param mi * @param moduleSa if null, generate a new ModuleSA. @@ -1050,7 +1193,7 @@ public class FpdFileContents { ++i; } } - public void genBuildOptionsOpt(String buildTargets, String toolChain, String tagName, String toolCmd, String archList, String contents) { + public void genBuildOptionsOpt(Vector buildTargets, String toolChain, String tagName, String toolCmd, Vector archList, String contents) { OptionsDocument.Options opts = getfpdBuildOpts().getOptions(); if (opts == null) { opts = getfpdBuildOpts().addNewOptions(); @@ -1059,18 +1202,15 @@ public class FpdFileContents { setBuildOptionsOpt(buildTargets, toolChain, tagName, toolCmd, archList, contents, opt); } - private void setBuildOptionsOpt(String buildTargets, String toolChain, String tagName, String toolCmd, String archList, String contents, OptionDocument.Option opt){ + private void setBuildOptionsOpt(Vector buildTargets, String toolChain, String tagName, String toolCmd, Vector archList, String contents, OptionDocument.Option opt){ opt.setStringValue(contents); -// opt.setBuildTargets(buildTargets); + + opt.setBuildTargets(buildTargets); opt.setToolChainFamily(toolChain); opt.setTagName(tagName); opt.setToolCode(toolCmd); - String[] s = archList.split(" "); - ArrayList al = new ArrayList(); - for (int i = 0; i < s.length; ++i) { - al.add(s[i]); - } - opt.setSupArchList(al); + + opt.setSupArchList(archList); } public void removeBuildOptionsOpt(int i){ @@ -1090,7 +1230,7 @@ public class FpdFileContents { cursor.dispose(); } - public void updateBuildOptionsOpt(int i, String buildTargets, String toolChain, String tagName, String toolCmd, String archList, String contents) { + public void updateBuildOptionsOpt(int i, Vector buildTargets, String toolChain, String tagName, String toolCmd, Vector archList, String contents) { XmlObject o = getfpdBuildOpts().getOptions(); if (o == null) { return; @@ -1374,8 +1514,8 @@ public class FpdFileContents { while(li.hasNext()) { BuildOptionsDocument.BuildOptions.Ffs.Sections.Sections2.Section section = li.next(); if (section.isSetSectionType()) { - al.add(section.getSectionType().toString()); - } + al.add(section.getSectionType().toString()); + } } } @@ -2002,7 +2142,7 @@ public class FpdFileContents { } - private String listToString(List l) { + private String listToString(List l) { if (l == null) { return null; } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java index 087a7f68a0..40a3473058 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java @@ -23,7 +23,6 @@ import javax.swing.JTabbedPane; import javax.swing.JButton; import javax.swing.ListSelectionModel; -import org.tianocore.FvImagesDocument; import org.tianocore.PlatformSurfaceAreaDocument; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; @@ -36,7 +35,6 @@ import java.awt.event.ComponentEvent; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.io.File; -import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; @@ -719,11 +717,11 @@ public class FpdFlash extends IInternalFrame { if (jPanel5 == null) { //ToDo add ButtonGroup for RadioButtons jLabel6 = new JLabel(); - jLabel6.setEnabled(false); + jLabel6.setEnabled(true); jLabel6.setText("Value"); jLabel6.setPreferredSize(new Dimension(38, 20)); jLabel5 = new JLabel(); - jLabel5.setEnabled(false); + jLabel5.setEnabled(true); jLabel5.setText("Name"); jLabel5.setPreferredSize(new Dimension(38, 20)); jPanel5 = new JPanel(); @@ -924,7 +922,7 @@ public class FpdFlash extends IInternalFrame { public void itemStateChanged(ItemEvent arg0) { // TODO Auto-generated method stub - boolean selected = jCheckBox3.isSelected(); +// boolean selected = jCheckBox3.isSelected(); if (!jCheckBox2.isSelected() || jComboBox.getSelectedIndex() == 0) { return; @@ -1086,7 +1084,7 @@ public class FpdFlash extends IInternalFrame { private JTextField getJTextField4() { if (jTextField4 == null) { jTextField4 = new JTextField(); - jTextField4.setEnabled(false); + jTextField4.setEnabled(true); jTextField4.setPreferredSize(new Dimension(100, 20)); } return jTextField4; @@ -1100,7 +1098,7 @@ public class FpdFlash extends IInternalFrame { private JTextField getJTextField5() { if (jTextField5 == null) { jTextField5 = new JTextField(); - jTextField5.setEnabled(false); + jTextField5.setEnabled(true); jTextField5.setPreferredSize(new Dimension(100, 20)); } return jTextField5; diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index 6dda51be00..58c181dcd3 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -36,6 +36,8 @@ import java.util.Iterator; import java.util.ListIterator; import java.util.Map; import java.util.Set; +import java.util.Vector; + import javax.swing.JTextField; public class FpdModuleSA extends JDialog implements ActionListener { @@ -82,6 +84,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { private LibraryTableModel model1 = null; private LibraryTableModel model2 = null; private LibraryTableModel model3 = null; + private DefaultTableModel optionsTableModel = null; private FpdFileContents ffc = null; private String moduleKey = null; private HashMap> classInstanceMap = null; @@ -96,6 +99,8 @@ public class FpdModuleSA extends JDialog implements ActionListener { private JTextField jTextField2 = null; private JScrollPane jScrollPane6 = null; private JTable jTable4 = null; + private JButton jButton4 = null; + private JButton jButton5 = null; /** * This is the default constructor */ @@ -150,6 +155,21 @@ public class FpdModuleSA extends JDialog implements ActionListener { // display library classes that need to be resolved. also potential instances for them. // resolveLibraryInstances(key); + // + // display module SA options + // + String fvBinding = ffc.getFvBinding(key); + if (fvBinding != null) { + jTextField.setText(fvBinding); + } + String fileGuid = ffc.getFfsFileNameGuid(key); + if (fileGuid != null) { + jTextField1.setText(fileGuid); + } + String ffsKey = ffc.getFfsFormatKey(key); + if (ffsKey != null) { + jTextField2.setText(ffsKey); + } } private void resolveLibraryInstances(String key) { @@ -995,6 +1015,8 @@ public class FpdModuleSA extends JDialog implements ActionListener { jPanel8.add(jLabel8, null); jPanel8.add(getJTextField2(), null); jPanel8.add(getJScrollPane6(), null); + jPanel8.add(getJButton4(), null); + jPanel8.add(getJButton5(), null); } return jPanel8; } @@ -1007,6 +1029,11 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTextField == null) { jTextField = new JTextField(); jTextField.setPreferredSize(new java.awt.Dimension(100,20)); + jTextField.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusLost(java.awt.event.FocusEvent e) { + ffc.setFvBinding(moduleKey, jTextField.getText()); + } + }); } return jTextField; } @@ -1019,6 +1046,11 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTextField1 == null) { jTextField1 = new JTextField(); jTextField1.setPreferredSize(new java.awt.Dimension(100,20)); + jTextField1.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusLost(java.awt.event.FocusEvent e) { + ffc.setFfsFileNameGuid(moduleKey, jTextField1.getText()); + } + }); } return jTextField1; } @@ -1031,6 +1063,11 @@ public class FpdModuleSA extends JDialog implements ActionListener { if (jTextField2 == null) { jTextField2 = new JTextField(); jTextField2.setPreferredSize(new java.awt.Dimension(100,20)); + jTextField2.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusLost(java.awt.event.FocusEvent e) { + ffc.setFfsFormatKey(moduleKey, jTextField2.getText()); + } + }); } return jTextField2; } @@ -1054,10 +1091,96 @@ public class FpdModuleSA extends JDialog implements ActionListener { */ private JTable getJTable4() { if (jTable4 == null) { - jTable4 = new JTable(); + optionsTableModel = new DefaultTableModel(); + optionsTableModel.addColumn("BuildTargets"); + optionsTableModel.addColumn("ToolChainFamily"); + optionsTableModel.addColumn("TagName"); + optionsTableModel.addColumn("ToolCode"); + optionsTableModel.addColumn("SupportedArchs"); + optionsTableModel.addColumn("Contents"); + jTable4 = new JTable(optionsTableModel); + jTable4.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + jTable4.getModel().addTableModelListener(new TableModelListener() { + public void tableChanged(TableModelEvent arg0) { + // TODO Auto-generated method stub + int row = arg0.getFirstRow(); + TableModel m = (TableModel)arg0.getSource(); + + if (arg0.getType() == TableModelEvent.UPDATE){ + //ToDo Data Validition check. + String targets = m.getValueAt(row, 0) + ""; + Vector targetName = new Vector(); + String[] sArray = targets.split(" "); + for (int i = 0; i < sArray.length; ++i) { + targetName.add(sArray[i]); + } + String toolChain = m.getValueAt(row, 1) + ""; + String tagName = m.getValueAt(row, 2) + ""; + String toolCode = m.getValueAt(row, 3) + ""; + String archs = m.getValueAt(row, 4) + ""; + Vector supArch = new Vector(); + String[] sArray1 = archs.split(" "); + for (int i = 0; i < sArray1.length; ++i) { + supArch.add(sArray1[i]); + } + if (supArch.size() == 0) { + supArch.add("IA32"); + } + String contents = m.getValueAt(row, 5) + ""; + + ffc.updateModuleSAOptionsOpt(moduleKey, row, targetName, toolChain, tagName, toolCode, supArch, contents); + } + } + }); } return jTable4; } + /** + * This method initializes jButton4 + * + * @return javax.swing.JButton + */ + private JButton getJButton4() { + if (jButton4 == null) { + jButton4 = new JButton(); + jButton4.setPreferredSize(new java.awt.Dimension(80,20)); + jButton4.setText("New"); + jButton4.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + String[] row = {"", "", "", "", "IA32", ""}; + optionsTableModel.addRow(row); + Vector v = new Vector(); + Vector v1 = new Vector(); + v1.add("IA32"); + ffc.genModuleSAOptionsOpt(moduleKey, v, "", "", "", v1, ""); + } + }); + } + return jButton4; + } + /** + * This method initializes jButton5 + * + * @return javax.swing.JButton + */ + private JButton getJButton5() { + if (jButton5 == null) { + jButton5 = new JButton(); + jButton5.setPreferredSize(new java.awt.Dimension(80,20)); + jButton5.setText("Delete"); + jButton5.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + if (jTable4.getSelectedRow() < 0) { + return; + } + + ffc.removeModuleSAOptionsOpt(moduleKey, jTable4.getSelectedRow()); + optionsTableModel.removeRow(jTable4.getSelectedRow()); + } + }); + } + return jButton5; + } } // @jve:decl-index=0:visual-constraint="10,10"