diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java index 5bac8be0cd..b16a1e5089 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdFileContents.java @@ -129,6 +129,10 @@ public class SpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getSpdPcdDefinitionCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -156,6 +160,10 @@ public class SpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getSpdPpiDeclarationCount() == 0){ + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -182,6 +190,10 @@ public class SpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getSpdProtocolDeclarationCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -208,7 +220,10 @@ public class SpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); - + if (getSpdGuidDeclarationCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -236,6 +251,10 @@ public class SpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getSpdPackageHeaderCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -263,6 +282,10 @@ public class SpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getSpdMsaFileCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -290,6 +313,10 @@ public class SpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getSpdLibClassDeclarationCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java index 5531919695..91f4ba64de 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java @@ -164,7 +164,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ protected JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(5,256,472,196)); + jScrollPane.setBounds(new java.awt.Rectangle(5,256,472,292)); jScrollPane.setViewportView(getJTable()); } return jScrollPane; @@ -253,7 +253,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ TableModel m = (TableModel)arg0.getSource(); if (arg0.getType() == TableModelEvent.UPDATE){ if (docConsole != null) { - docConsole.setSaved(false); + docConsole.setSaved(false); } updateRow(row, m); } @@ -549,8 +549,11 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ if (!dataValidation(row)) { return; } - docConsole.setSaved(false); + if (docConsole != null) { + docConsole.setSaved(false); + } model.addRow(row); + jTable.changeSelection(model.getRowCount()-1, 0, false, false); addRow(row); } // diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java index ce4922e362..1eb8a8e166 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java @@ -16,13 +16,16 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; import java.util.Vector; import javax.swing.AbstractAction; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.JPanel; -import javax.swing.JRadioButton; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.JComboBox; @@ -40,6 +43,7 @@ import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; +import org.apache.xmlbeans.XmlObject; import org.tianocore.PackageSurfaceAreaDocument; import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.Tools; @@ -48,8 +52,11 @@ import org.tianocore.frameworkwizard.common.ui.IInternalFrame; import org.tianocore.frameworkwizard.common.ui.StarLabel; import org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList; import org.tianocore.frameworkwizard.platform.ui.ListEditor; +import org.tianocore.frameworkwizard.platform.ui.global.GlobalData; +import org.tianocore.frameworkwizard.platform.ui.global.SurfaceAreaQuery; +import org.tianocore.frameworkwizard.platform.ui.id.ModuleIdentification; +import org.tianocore.frameworkwizard.platform.ui.id.PackageIdentification; -import javax.swing.JCheckBox; /** GUI for create library definition elements of spd file. @@ -70,10 +77,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JPanel jContentPane = null; - private JRadioButton jRadioButtonAdd = null; - - private JRadioButton jRadioButtonSelect = null; - private JTextField jTextFieldAdd = null; private JComboBox jComboBoxSelect = null; @@ -122,23 +125,20 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JLabel jLabel5 = null; - private JCheckBox jCheckBox = null; - - private JCheckBox jCheckBox1 = null; - - private JCheckBox jCheckBox2 = null; - - private JCheckBox jCheckBox3 = null; - private JLabel jLabel6 = null; private JScrollPane jScrollPaneArch = null; + private JScrollPane jScrollPane1 = null; + private ICheckBoxList iCheckBoxListArch = null; - private JCheckBox jCheckBox4 = null; + private ICheckBoxList iCheckBoxList = null; + + private JComboBox jComboBox = null; + + HashMap libNameGuidMap = new HashMap(); - private JCheckBox jCheckBox5 = null; /** This method initializes this @@ -150,40 +150,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen } - /** - This method initializes jRadioButtonAdd - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonAdd() { - if (jRadioButtonAdd == null) { - jRadioButtonAdd = new JRadioButton(); - jRadioButtonAdd.setBounds(new java.awt.Rectangle(9,63,197,20)); - jRadioButtonAdd.setText("Library Class Name"); - jRadioButtonAdd.addActionListener(this); - jRadioButtonAdd.setSelected(true); - jRadioButtonAdd.setVisible(false); - } - return jRadioButtonAdd; - } - - /** - This method initializes jRadioButtonSelect - - @return javax.swing.JRadioButton - **/ - private JRadioButton getJRadioButtonSelect() { - if (jRadioButtonSelect == null) { - jRadioButtonSelect = new JRadioButton(); - jRadioButtonSelect.setBounds(new java.awt.Rectangle(9,10,198,20)); - jRadioButtonSelect.setText("Select Existing Library Class"); - jRadioButtonSelect.addActionListener(this); - jRadioButtonSelect.setSelected(true); - jRadioButtonSelect.setVisible(false); - } - return jRadioButtonSelect; - } - /** This method initializes jTextFieldAdd @@ -223,7 +189,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(12,351,608,139)); + jScrollPane.setBounds(new java.awt.Rectangle(12,351,608,253)); jScrollPane.setPreferredSize(new java.awt.Dimension(330,150)); jScrollPane.setViewportView(getJTable()); } @@ -333,7 +299,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jButtonAdd = new JButton(); jButtonAdd.setText("Add"); jButtonAdd.setSize(new java.awt.Dimension(80,20)); - jButtonAdd.setLocation(new java.awt.Point(365,315)); + jButtonAdd.setLocation(new java.awt.Point(359,326)); jButtonAdd.addActionListener(this); } return jButtonAdd; @@ -349,7 +315,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jButtonRemove = new JButton(); jButtonRemove.setText("Remove"); jButtonRemove.setSize(new java.awt.Dimension(80,20)); - jButtonRemove.setLocation(new java.awt.Point(449,315)); + jButtonRemove.setLocation(new java.awt.Point(443,326)); jButtonRemove.addActionListener(this); } return jButtonRemove; @@ -365,7 +331,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jButtonClearAll = new JButton(); jButtonClearAll.setText("Clear All"); jButtonClearAll.setSize(new java.awt.Dimension(86,20)); - jButtonClearAll.setLocation(new java.awt.Point(536,315)); + jButtonClearAll.setLocation(new java.awt.Point(530,326)); jButtonClearAll.addActionListener(this); } return jButtonClearAll; @@ -447,7 +413,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jLabel6.setText("Supported Module"); jLabel6.setEnabled(true); jLabel5 = new JLabel(); - jLabel5.setBounds(new java.awt.Rectangle(16,215,93,16)); + jLabel5.setBounds(new java.awt.Rectangle(15,169,93,16)); jLabel5.setText("Supported Arch"); jLabel5.setEnabled(true); jLabel4 = new JLabel(); @@ -457,7 +423,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jLabel3 = new JLabel(); jLabel3.setBounds(new java.awt.Rectangle(17,112,195,16)); jLabel3.setEnabled(true); - jLabel3.setText("Recommended Instance GUID"); + jLabel3.setText("Recommended Instance Name"); jLabel2 = new JLabel(); jLabel2.setBounds(new java.awt.Rectangle(16,33,82,20)); jLabel2.setText("Help Text"); @@ -480,8 +446,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jContentPane.add(jLabel, null); jContentPane.add(jStarLabel1, null); jContentPane.add(jStarLabel2, null); - jContentPane.add(getJRadioButtonAdd(), null); - jContentPane.add(getJRadioButtonSelect(), null); jContentPane.add(getJTextFieldAdd(), null); jContentPane.add(getJComboBoxSelect(), null); jContentPane.add(getJScrollPane(), null); @@ -500,15 +464,12 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen jContentPane.add(jLabel4, null); jContentPane.add(getJTextField2(), null); jContentPane.add(jLabel5, null); - jContentPane.add(getJCheckBox(), null); - jContentPane.add(getJCheckBox1(), null); - jContentPane.add(getJCheckBox2(), null); - jContentPane.add(getJCheckBox3(), null); jContentPane.add(jLabel6, null); jContentPane.add(getJScrollPaneArch(), null); - jContentPane.add(getJCheckBox4(), null); - jContentPane.add(getJCheckBox5(), null); + jContentPane.add(getJScrollPane1(), null); + jContentPane.add(getJComboBox(), null); + } return jContentPane; @@ -571,7 +532,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen row[0] = jTextFieldAdd.getText(); row[1] = jTextField.getText().replace('\\', '/'); row[2] = jTextFieldHelp.getText(); - row[5] = booleanToString(jCheckBox.isSelected(), jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected(), jCheckBox5.isSelected()); + row[5] = vectorToString(iCheckBoxList.getAllCheckedItemsString()); if (row[5].length() == 0){ row[5] = null; } @@ -583,6 +544,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen return; } model.addRow(row); + jTable.changeSelection(model.getRowCount()-1, 0, false, false); docConsole.setSaved(false); sfc.genSpdLibClassDeclarations(row[0], row[3], row[1], row[2], row[5], null, null, row[4], null, row[6]); @@ -609,32 +571,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen model.setRowCount(0); sfc.removeSpdLibClass(); } - - if (arg0.getSource() == jRadioButtonAdd) { - if (jRadioButtonAdd.isSelected()) { - jRadioButtonSelect.setSelected(false); - jTextFieldAdd.setEnabled(true); - jComboBoxSelect.setEnabled(false); - } - if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) { - jRadioButtonAdd.setSelected(true); - jTextFieldAdd.setEnabled(true); - jComboBoxSelect.setEnabled(false); - } - } - - if (arg0.getSource() == jRadioButtonSelect) { - if (jRadioButtonSelect.isSelected()) { - jRadioButtonAdd.setSelected(false); - jTextFieldAdd.setEnabled(false); - jComboBoxSelect.setEnabled(true); - } - if (!jRadioButtonSelect.isSelected() && !jRadioButtonAdd.isSelected()) { - jRadioButtonSelect.setSelected(true); - jTextFieldAdd.setEnabled(false); - jComboBoxSelect.setEnabled(true); - } - } } private boolean dataValidation(String[] row) { @@ -665,7 +601,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JTextField getJTextField() { if (jTextField == null) { jTextField = new JTextField(); - jTextField.setBounds(new java.awt.Rectangle(221,75,290,21)); + jTextField.setBounds(new java.awt.Rectangle(218,75,290,21)); jTextField.setPreferredSize(new java.awt.Dimension(260,20)); } return jTextField; @@ -757,8 +693,9 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private JTextField getJTextField1() { if (jTextField1 == null) { jTextField1 = new JTextField(); - jTextField1.setBounds(new java.awt.Rectangle(220,110,291,20)); + jTextField1.setBounds(new java.awt.Rectangle(218,110,291,20)); jTextField1.setEnabled(true); + jTextField1.setVisible(false); } return jTextField1; } @@ -777,71 +714,10 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen return jTextField2; } - /** - * This method initializes jCheckBox - * - * @return javax.swing.JCheckBox - */ - private JCheckBox getJCheckBox() { - if (jCheckBox == null) { - jCheckBox = new JCheckBox(); - jCheckBox.setBounds(new java.awt.Rectangle(123,213,57,21)); - jCheckBox.setText("IA32"); - jCheckBox.setPreferredSize(new java.awt.Dimension(21,20)); - } - return jCheckBox; - } - - /** - * This method initializes jCheckBox1 - * - * @return javax.swing.JCheckBox - */ - private JCheckBox getJCheckBox1() { - if (jCheckBox1 == null) { - jCheckBox1 = new JCheckBox(); - jCheckBox1.setBounds(new java.awt.Rectangle(182,213,49,20)); - jCheckBox1.setText("X64"); - jCheckBox1.setPreferredSize(new java.awt.Dimension(21,20)); - } - return jCheckBox1; - } - - /** - * This method initializes jCheckBox2 - * - * @return javax.swing.JCheckBox - */ - private JCheckBox getJCheckBox2() { - if (jCheckBox2 == null) { - jCheckBox2 = new JCheckBox(); - jCheckBox2.setText("IPF"); - jCheckBox2.setSize(new java.awt.Dimension(50,20)); - jCheckBox2.setLocation(new java.awt.Point(237,213)); - jCheckBox2.setPreferredSize(new java.awt.Dimension(21,20)); - } - return jCheckBox2; - } - - /** - * This method initializes jCheckBox3 - * - * @return javax.swing.JCheckBox - */ - private JCheckBox getJCheckBox3() { - if (jCheckBox3 == null) { - jCheckBox3 = new JCheckBox(); - jCheckBox3.setBounds(new java.awt.Rectangle(286,213,50,20)); - jCheckBox3.setText("EBC"); - jCheckBox3.setPreferredSize(new java.awt.Dimension(21,20)); - } - return jCheckBox3; - } - private JScrollPane getJScrollPaneArch() { if (jScrollPaneArch == null) { jScrollPaneArch = new JScrollPane(); - jScrollPaneArch.setBounds(new java.awt.Rectangle(130,252,230,88)); + jScrollPaneArch.setBounds(new java.awt.Rectangle(218,245,293,73)); jScrollPaneArch.setPreferredSize(new java.awt.Dimension(320, 80)); jScrollPaneArch.setViewportView(getICheckBoxListSupportedArchitectures()); } @@ -851,6 +727,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private ICheckBoxList getICheckBoxListSupportedArchitectures() { if (iCheckBoxListArch == null) { iCheckBoxListArch = new ICheckBoxList(); + iCheckBoxListArch.setBounds(new java.awt.Rectangle(218,246,292,73)); Vector v = new Vector(); v.add("BASE"); v.add("SEC"); @@ -869,29 +746,6 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen return iCheckBoxListArch; } - private String booleanToString(boolean b1, boolean b2, boolean b3, boolean b4, boolean b5, boolean b6){ - String s = " "; - if (b1){ - s += "IA32 "; - } - if (b2){ - s += "X64 "; - } - if (b3){ - s += "IPF "; - } - if (b4){ - s += "EBC "; - } - if (b5){ - s += "ARM "; - } - if (b6){ - s += "PPC "; - } - return s.trim(); - } - private String vectorToString(Vector v) { String s = " "; for (int i = 0; i < v.size(); ++i) { @@ -900,39 +754,99 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen } return s.trim(); } - /** - * This method initializes jCheckBox4 - * - * @return javax.swing.JCheckBox - */ - private JCheckBox getJCheckBox4() { - if (jCheckBox4 == null) { - jCheckBox4 = new JCheckBox(); - jCheckBox4.setBounds(new java.awt.Rectangle(343,213,60,20)); - jCheckBox4.setText("ARM"); - jCheckBox4.setPreferredSize(new Dimension(60, 20)); + + private JScrollPane getJScrollPane1() { + if (jScrollPane1 == null) { + jScrollPane1 = new JScrollPane(); + jScrollPane1.setBounds(new java.awt.Rectangle(218,170,293,73)); + jScrollPane1.setPreferredSize(new java.awt.Dimension(320, 80)); + jScrollPane1.setViewportView(getICheckBoxList()); } - return jCheckBox4; + return jScrollPane1; + } + /** + * This method initializes iCheckBoxList + * + * @return org.tianocore.frameworkwizard.common.ui.iCheckBoxList.ICheckBoxList + */ + private ICheckBoxList getICheckBoxList() { + if (iCheckBoxList == null) { + iCheckBoxList = new ICheckBoxList(); + iCheckBoxList.setBounds(new java.awt.Rectangle(218,171,292,66)); + Vector v = new Vector(); + v.add("IA32"); + v.add("X64"); + v.add("IPF"); + v.add("EBC"); + v.add("ARM"); + v.add("PPC"); + iCheckBoxList.setAllItems(v); + } + return iCheckBoxList; } /** - * This method initializes jCheckBox5 + * This method initializes jComboBox * - * @return javax.swing.JCheckBox + * @return javax.swing.JComboBox */ - private JCheckBox getJCheckBox5() { - if (jCheckBox5 == null) { - jCheckBox5 = new JCheckBox(); - jCheckBox5.setBounds(new java.awt.Rectangle(400,213,60,20)); - jCheckBox5.setText("PPC"); - jCheckBox5.setPreferredSize(new Dimension(60, 20)); + private JComboBox getJComboBox() { + if (jComboBox == null) { + jComboBox = new JComboBox(); + jComboBox.setPreferredSize(new java.awt.Dimension(31,20)); + jComboBox.setSize(new java.awt.Dimension(290,20)); + jComboBox.setLocation(new java.awt.Point(218,111)); + jComboBox.addFocusListener(new java.awt.event.FocusAdapter() { + public void focusGained(java.awt.event.FocusEvent e) { + if (jTextFieldAdd.getText().length() == 0) { + return; + } + jComboBox.removeAllItems(); + getLibInstances(jTextFieldAdd.getText()); + Set libNames = libNameGuidMap.keySet(); + Iterator si = libNames.iterator(); + while(si.hasNext()) { + jComboBox.addItem(si.next()); + } + } + }); + } - return jCheckBox5; + return jComboBox; } - public static void main(String[] args){ - new SpdLibClassDecls().setVisible(true); + private void getLibInstances(String libClass){ + libNameGuidMap.clear(); + try { + GlobalData.initInfo("Tools" + File.separator + "Conf" + File.separator + "FrameworkDatabase.db", System.getenv("WORKSPACE")); + + Set spi = GlobalData.getPackageList(); + Iterator ispi = spi.iterator(); + + while (ispi.hasNext()) { + PackageIdentification pi = (PackageIdentification) ispi.next(); + + Set smi = GlobalData.getModules(pi); + Iterator ismi = smi.iterator(); + while (ismi.hasNext()) { + ModuleIdentification mi = (ModuleIdentification) ismi.next(); + Map m = GlobalData.getNativeMsa(mi); + SurfaceAreaQuery.setDoc(m); + String[] classProduced = SurfaceAreaQuery.getLibraryClasses("ALWAYS_PRODUCED"); + for (int i = 0; i < classProduced.length; ++i) { + if (classProduced[i].equals(libClass)) { + libNameGuidMap.put(mi.getName(), mi.getGuid()); + } + } + } + } + } + catch(Exception e){ + JOptionPane.showMessageDialog(frame, "Search Instances Fail."); + } + } + } diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java index c53e082e1f..4c7a69d1ae 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java @@ -108,7 +108,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ private JScrollPane getJScrollPane1() { if (jScrollPane1 == null) { jScrollPane1 = new JScrollPane(); - jScrollPane1.setBounds(new java.awt.Rectangle(13,177,461,139)); + jScrollPane1.setBounds(new java.awt.Rectangle(13,177,461,421)); jScrollPane1.setViewportView(getJTable()); } return jScrollPane1; @@ -351,6 +351,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ return; } model.addRow(row); + jTable.changeSelection(model.getRowCount()-1, 0, false, false); sfc.genSpdMsaFiles(row[0], null, null, null); } // diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java index 9f408a43d7..84eee46b16 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java @@ -385,6 +385,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe return; } model.addRow(row); + jTable.changeSelection(model.getRowCount()-1, 0, false, false); sfc.genSpdModuleHeaders(row[0], row[1], null, null, null, null, null, null); } // @@ -504,7 +505,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe private JScrollPane getJScrollPane1() { if (jScrollPane1 == null) { jScrollPane1 = new JScrollPane(); - jScrollPane1.setBounds(new java.awt.Rectangle(13,149,453,165)); + jScrollPane1.setBounds(new java.awt.Rectangle(13,149,453,258)); jScrollPane1.setViewportView(getJTable()); } return jScrollPane1; diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java index a2cff01201..742081a4b5 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java @@ -287,7 +287,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ for (int k = 0; k < 6; ++k) { rowData[k] = saa[i][k]; } - for (int m = 7; m < 11; ++m) { + for (int m = 6; m < 11; ++m) { rowData[m] = new Boolean("false"); } int j = 0; @@ -476,7 +476,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ return; } model.addRow(row); - + jTable.changeSelection(model.getRowCount()-1, 0, false, false); String usage = getValidUsage(jCheckBox.isSelected(), jCheckBox1.isSelected(), jCheckBox2.isSelected(), jCheckBox3.isSelected(), jCheckBox4.isSelected()); if (usage.length() == 0) { usage = null; @@ -627,7 +627,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JScrollPane getJScrollPane() { if (jScrollPane == null) { jScrollPane = new JScrollPane(); - jScrollPane.setBounds(new java.awt.Rectangle(5,301,1473,137)); + jScrollPane.setBounds(new java.awt.Rectangle(5,301,1473,259)); jScrollPane.setViewportView(getJTable()); } return jScrollPane; @@ -769,7 +769,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private JCheckBox getJCheckBox1() { if (jCheckBox1 == null) { jCheckBox1 = new JCheckBox(); - jCheckBox1.setBounds(new java.awt.Rectangle(302,133,108,20)); + jCheckBox1.setBounds(new java.awt.Rectangle(312,133,108,20)); jCheckBox1.setText("Fixed at Build"); jCheckBox1.setPreferredSize(new java.awt.Dimension(21,20)); } 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 875ddac7fe..f273d8db66 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 @@ -26,6 +26,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.DefaultCellEditor; +import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; @@ -41,18 +42,20 @@ import javax.swing.event.ListSelectionListener; import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import org.tianocore.PlatformSurfaceAreaDocument; import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; + +import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Set; import java.util.Vector; +import java.awt.Dimension; public class FpdBuildOptions extends IInternalFrame { @@ -111,7 +114,6 @@ public class FpdBuildOptions extends IInternalFrame { private JButton jButton18 = null; private FpdFileContents ffc = null; private OpeningPlatformType docConsole = null; - private JButton jButton19 = null; private JCheckBox jCheckBox9 = null; private JCheckBox jCheckBox10 = null; private JCheckBox jCheckBox11 = null; @@ -146,6 +148,8 @@ public class FpdBuildOptions extends IInternalFrame { private JButton jButton7 = null; private JScrollPane jScrollPane4 = null; private JTable jTable6 = null; + private JButton jButton12 = null; + private JTextField jTextField1 = null; /** * This method initializes jPanel * @@ -245,6 +249,7 @@ public class FpdBuildOptions extends IInternalFrame { jPanel9.setLayout(flowLayout8); jPanel9.add(jLabel, null); jPanel9.add(getJTextField2(), null); + jPanel9.add(getJButton12(), null); jPanel9.add(jLabel3, null); jPanel9.add(getJTextField3(), null); } @@ -325,14 +330,14 @@ public class FpdBuildOptions extends IInternalFrame { jButton4.setText("Add"); jButton4.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - if (!DataValidation.isInt(jTextField3.getText())) { - JOptionPane.showMessageDialog(frame, "ID must be an integer."); + if (!DataValidation.isInt(jTextField3.getText()) || jTextField3.getText().length() != 8) { + JOptionPane.showMessageDialog(frame, "ID must be an 8-digit integer."); return; } Object[] o = {jTextField3.getText(), null, null}; o[1] = jTextField2.getText(); o[2] = jTextField4.getText(); - ffc.genBuildOptionsUserDefAntTask(o[0]+"", null, o[2]+""); + ffc.genBuildOptionsUserDefAntTask(o[0]+"", o[1]+"", o[2]+""); antTaskTableModel.addRow(o); docConsole.setSaved(false); } @@ -736,6 +741,7 @@ public class FpdBuildOptions extends IInternalFrame { jPanel20.add(jLabel14, null); jPanel20.add(getJTextField12(), null); jPanel20.add(jLabel10, null); + jPanel20.add(getJTextField1(), null); jPanel20.add(getJComboBox2(), null); jPanel20.add(jLabel12, null); jPanel20.add(getJTextField8(), null); @@ -752,7 +758,6 @@ public class FpdBuildOptions extends IInternalFrame { jPanel20.add(getJTextField7(), null); jPanel20.add(getJButton10(), null); jPanel20.add(getJButton11(), null); - jPanel20.add(getJButton19(), null); jPanel20.add(getJScrollPane6(), null); } return jPanel20; @@ -785,6 +790,7 @@ public class FpdBuildOptions extends IInternalFrame { jComboBox2.addItem("CYGWIN"); jComboBox2.addItem("INTEL"); jComboBox2.setSelectedIndex(0); + jComboBox2.setVisible(false); } return jComboBox2; } @@ -833,13 +839,13 @@ public class FpdBuildOptions extends IInternalFrame { optionsTableModel.addColumn("TagName"); optionsTableModel.addColumn("Contents"); - TableColumn toolFamilyCol = jTable5.getColumnModel().getColumn(1); - JComboBox cb = new JComboBox(); - cb.addItem("MSFT"); - cb.addItem("GCC"); - cb.addItem("CYGWIN"); - cb.addItem("INTEL"); - toolFamilyCol.setCellEditor(new DefaultCellEditor(cb)); +// TableColumn toolFamilyCol = jTable5.getColumnModel().getColumn(1); +// JComboBox cb = new JComboBox(); +// cb.addItem("MSFT"); +// cb.addItem("GCC"); +// cb.addItem("CYGWIN"); +// cb.addItem("INTEL"); +// toolFamilyCol.setCellEditor(new DefaultCellEditor(cb)); Vector vArch = new Vector(); vArch.add("IA32"); vArch.add("X64"); @@ -910,7 +916,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jButton10 == null) { jButton10 = new JButton(); jButton10.setText("Add"); - jButton10.setPreferredSize(new java.awt.Dimension(70,20)); + jButton10.setPreferredSize(new java.awt.Dimension(90,20)); jButton10.addActionListener(new AbstractAction() { /** * @@ -921,11 +927,11 @@ public class FpdBuildOptions extends IInternalFrame { boolean[] boolArray = {jCheckBox9.isSelected(),jCheckBox10.isSelected(),jCheckBox11.isSelected(), jCheckBox12.isSelected(),jCheckBox13.isSelected(),jCheckBox14.isSelected()}; String s = boolToList(boolArray); - Object[] o = {jTextField12.getText(), jComboBox2.getSelectedItem(), s, + Object[] o = {jTextField12.getText(), jTextField1.getText(), s, jTextField8.getText(), jTextField13.getText(), jTextField7.getText()}; optionsTableModel.addRow(o); docConsole.setSaved(false); - ffc.genBuildOptionsOpt(stringToVector(jTextField12.getText()), jComboBox2.getSelectedItem()+"", jTextField13.getText(), jTextField8.getText(), stringToVector(s), jTextField7.getText()); + ffc.genBuildOptionsOpt(stringToVector(jTextField12.getText()), jTextField1.getText(), jTextField13.getText(), jTextField8.getText(), stringToVector(s), jTextField7.getText()); } }); } @@ -979,7 +985,7 @@ public class FpdBuildOptions extends IInternalFrame { if (jButton11 == null) { jButton11 = new JButton(); jButton11.setText("Delete"); - jButton11.setPreferredSize(new java.awt.Dimension(70,20)); + jButton11.setPreferredSize(new java.awt.Dimension(90,20)); jButton11.addActionListener(new AbstractAction() { /** * @@ -1059,21 +1065,6 @@ public class FpdBuildOptions extends IInternalFrame { return jButton18; } - /** - * This method initializes jButton19 - * - * @return javax.swing.JButton - */ - private JButton getJButton19() { - if (jButton19 == null) { - jButton19 = new JButton(); - jButton19.setPreferredSize(new java.awt.Dimension(75,20)); - jButton19.setEnabled(false); - jButton19.setText("Update"); - } - return jButton19; - } - /** * This method initializes jCheckBox9 * @@ -1657,6 +1648,67 @@ public class FpdBuildOptions extends IInternalFrame { return jTable6; } + /** + * This method initializes jButton12 + * + * @return javax.swing.JButton + */ + private JButton getJButton12() { + if (jButton12 == null) { + jButton12 = new JButton(); + jButton12.setPreferredSize(new Dimension(90, 20)); + jButton12.setText("Browse"); + jButton12.addActionListener(new AbstractAction() { + private static final long serialVersionUID = 1L; + + public void actionPerformed(ActionEvent arg0) { + // + // Select files from current workspace + // + String dirPrefix = System.getenv("WORKSPACE"); + JFileChooser chooser = new JFileChooser(dirPrefix); + File theFile = null; + String headerDest = null; + + chooser.setMultiSelectionEnabled(false); + chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + int retval = chooser.showOpenDialog(frame); + if (retval == JFileChooser.APPROVE_OPTION) { + + theFile = chooser.getSelectedFile(); + String file = theFile.getPath(); + if (!file.startsWith(dirPrefix)) { + JOptionPane.showMessageDialog(frame, "You can only select files in current package!"); + return; + } + } + else { + return; + } + + headerDest = theFile.getPath(); + jTextField2.setText(headerDest.substring(dirPrefix.length()).replace('\\', '/')); + + } + + }); + } + return jButton12; + } + + /** + * This method initializes jTextField1 + * + * @return javax.swing.JTextField + */ + private JTextField getJTextField1() { + if (jTextField1 == null) { + jTextField1 = new JTextField(); + jTextField1.setPreferredSize(new java.awt.Dimension(85,20)); + } + return jTextField1; + } + /** * @param args */ 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 0fc11f08b2..0fbffe0837 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 @@ -264,6 +264,10 @@ public class FpdFileContents { } } cursor.removeXml(); + if (getFrameworkModulesCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -390,7 +394,7 @@ public class FpdFileContents { } catch (Exception e){ - e.printStackTrace(); +// e.printStackTrace(); throw e; } @@ -653,13 +657,15 @@ public class FpdFileContents { //ToDo add Arch filter try { + if (moduleSa == null) { + moduleSa = genModuleSA(mi); + } + ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = (ModuleSurfaceAreaDocument.ModuleSurfaceArea)GlobalData.getModuleXmlObject(mi); if (msa.getPcdCoded() == null) { return; } - if (moduleSa == null) { - moduleSa = genModuleSA(mi); - } + Map m = new HashMap(); m.put("ModuleSurfaceArea", msa); SurfaceAreaQuery.setDoc(m); @@ -688,7 +694,7 @@ public class FpdFileContents { } catch (Exception e){ - e.printStackTrace(); +// e.printStackTrace(); throw e; } @@ -1003,22 +1009,20 @@ public class FpdFileContents { XmlCursor cursor = o.newCursor(); if (cursor.toFirstChild()) { - DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData = - (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject(); - if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) { - cursor.removeXml(); - cursor.dispose(); - return; - } - while (cursor.toNextSibling()) { - - pcdBuildData = (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject(); + do { + DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData pcdBuildData = + (DynamicPcdBuildDefinitionsDocument.DynamicPcdBuildDefinitions.PcdBuildData)cursor.getObject(); if (pcdBuildData.getCName().equals(cName) && pcdBuildData.getTokenSpaceGuidCName().equals(tsGuid)) { cursor.removeXml(); + if (getDynamicPcdBuildDataCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } cursor.dispose(); return; } } + while (cursor.toNextSibling()); } cursor.dispose(); } @@ -1257,6 +1261,10 @@ public class FpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getBuildOptionsUserDefAntTaskCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -1341,6 +1349,10 @@ public class FpdFileContents { cursor.toNextSibling(); } cursor.removeXml(); + if (getBuildOptionsOptCount() == 0) { + cursor.toParent(); + cursor.removeXml(); + } } cursor.dispose(); } @@ -1576,10 +1588,15 @@ public class FpdFileContents { cursor.toNextSibling(qSections); } if (cursor.toFirstChild()) { - for (int m = 0; m < k; ++m) { + int m = 0; + for (; m < k; ++m) { cursor.toNextSibling(); } cursor.removeXml(); + if (m == 0) { + cursor.toParent(); + cursor.removeXml(); + } } } cursor.dispose(); @@ -1858,7 +1875,16 @@ public class FpdFileContents { } public void setPlatformDefsOutputDir(String outputDir) { - getfpdPlatformDefs().setOutputDirectory(outputDir); + if (outputDir != null && outputDir.length() > 0) { + getfpdPlatformDefs().setOutputDirectory(outputDir); + } + else{ + XmlCursor cursor = getfpdPlatformDefs().newCursor(); + if (cursor.toChild(new QName(xmlNs, "OutputDirectory"))) { + cursor.removeXml(); + } + cursor.dispose(); + } } public FlashDocument.Flash getfpdFlash() { diff --git a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 4133c72a85..cb2a5aa420 100644 --- a/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -199,13 +199,16 @@ public class FpdFrameworkModules extends IInternalFrame { row[4] = mi.getPackage().getVersion(); } model1.addRow(row); + docConsole.setSaved(false); try{ - ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null); - } + ffc.addFrameworkModulesPcdBuildDefs(miList.get(selectedRow), null); + } catch (Exception exception) { JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage()); } + JOptionPane.showMessageDialog(frame, "This Module Added Successfully."); + jTable1.changeSelection(model1.getRowCount()-1, 0, false, false); } }); } 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 a849f5ab46..4857311522 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 @@ -132,6 +132,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { public void setKey(String k){ this.moduleKey = k; jTabbedPane.setSelectedIndex(0); + initPcdBuildDefinition(k); } /**