import java.awt.event.MouseEvent;\r
import java.awt.event.MouseListener;\r
import java.awt.event.WindowEvent;\r
+import java.io.BufferedWriter;\r
+import java.io.File;\r
+import java.io.FileWriter;\r
import java.io.IOException;\r
import java.util.Iterator;\r
import java.util.Set;\r
///\r
private static FrameworkWizardUI fwui = null;\r
\r
+ private JMenuItem jMenuItemToolsGenerateGuidsXref = null;\r
+\r
/**\r
If the class hasn't an instnace, new one.\r
\r
jMenuFile.add(getJMenuItemFileSaveAs());\r
jMenuFile.add(getJMenuItemFileSaveAll());\r
jMenuFile.addSeparator();\r
- \r
+\r
jMenuFile.add(getJMenuItemFileRefresh());\r
jMenuFile.addSeparator();\r
\r
\r
jMenuTools.add(getJMenuItemToolsToolChainConfiguration());\r
jMenuTools.add(getJMenuItemToolsBuildPreferences());\r
+ jMenuTools.addSeparator();\r
+\r
+ jMenuTools.add(getJMenuItemToolsGenerateGuidsXref());\r
}\r
return jMenuTools;\r
}\r
return jMenuItemEditFindLibraryInstance;\r
}\r
\r
+ /**\r
+ * This method initializes jMenuItemProjectGenerateGuidsXref \r
+ * \r
+ * @return javax.swing.JMenuItem \r
+ */\r
+ private JMenuItem getJMenuItemToolsGenerateGuidsXref() {\r
+ if (jMenuItemToolsGenerateGuidsXref == null) {\r
+ jMenuItemToolsGenerateGuidsXref = new JMenuItem();\r
+ jMenuItemToolsGenerateGuidsXref.setText("Generate guids.xref");\r
+ jMenuItemToolsGenerateGuidsXref.setMnemonic('G');\r
+ jMenuItemToolsGenerateGuidsXref.addActionListener(this);\r
+ }\r
+ return jMenuItemToolsGenerateGuidsXref;\r
+ }\r
+\r
/* (non-Javadoc)\r
* @see org.tianocore.packaging.common.ui.IFrame#main(java.lang.String[])\r
*\r
if (arg0.getSource() == this.jMenuItemFileSaveAll) {\r
this.saveAll();\r
}\r
- \r
+\r
if (arg0.getSource() == this.jMenuItemFileRefresh) {\r
this.closeAll();\r
this.refresh();\r
this.setupToolChainConfiguration();\r
}\r
\r
+ if (arg0.getSource() == this.jMenuItemToolsGenerateGuidsXref) {\r
+ this.generateGuidsXref();\r
+ }\r
+\r
if (arg0.getSource() == this.jMenuItemHelpAbout) {\r
About a = new About(this, true);\r
int result = a.showDialog();\r
IDefaultMutableTreeNode belongNode = null;\r
\r
try {\r
- id = iTree.getSelectNode().getId();\r
- intCategory = iTree.getSelectCategory();\r
- belongNode = iTree.getSelectNode().getBelongNode();\r
+ //\r
+ // Get selected tree node\r
+ //\r
+ if (iTree.getSelectNode() != null) {\r
+ id = iTree.getSelectNode().getId();\r
+ }\r
\r
//\r
// If id is null, return directly\r
return;\r
}\r
\r
+ intCategory = iTree.getSelectCategory();\r
+ belongNode = iTree.getSelectNode().getBelongNode();\r
+\r
// \r
// If the node is not opened yet\r
// Insert top level elements first\r
}\r
}\r
}\r
+\r
+ /**\r
+ Search whole workspace and find all module's name and guid, and save them to a file\r
+ \r
+ **/\r
+ private void generateGuidsXref() {\r
+ //\r
+ // Init File Chooser\r
+ //\r
+ JFileChooser fc = new JFileChooser();\r
+ fc.setCurrentDirectory(new File(Workspace.getCurrentWorkspace()));\r
+ fc.setSelectedFile(new File(Workspace.getCurrentWorkspace() + DataType.FILE_SEPARATOR\r
+ + DataType.GUIDS_XREF_FILE_NAME));\r
+ fc.setMultiSelectionEnabled(false);\r
+\r
+ //\r
+ // Get guids xref and save to file\r
+ //\r
+ int result = fc.showOpenDialog(new JPanel());\r
+ if (result == JFileChooser.APPROVE_OPTION) {\r
+ Vector<String> v = wt.getAllModuleGuidXref();\r
+ if (v.size() < 1) {\r
+ Log.wrn("No guids found!!!");\r
+ return;\r
+ }\r
+ File f = fc.getSelectedFile();\r
+ if (!f.exists()) {\r
+ try {\r
+ f.createNewFile();\r
+ } catch (IOException e) {\r
+ Log.wrn("Fail to create file", e.getMessage());\r
+ Log.err("Fail to create file when generating guids.xref", e.getMessage());\r
+ }\r
+ }\r
+ FileWriter fw = null;\r
+ BufferedWriter bw = null;\r
+ try {\r
+ fw = new FileWriter(f);\r
+ bw = new BufferedWriter(fw);\r
+ for (int index = 0; index < v.size(); index++) {\r
+ bw.write(v.get(index));\r
+ bw.newLine();\r
+ }\r
+ bw.flush();\r
+ fw.flush();\r
+ bw.close();\r
+ fw.close();\r
+ } catch (IOException e) {\r
+ Log.wrn("Fail to write file", e.getMessage());\r
+ Log.err("Fail to write file when generating guids.xref", e.getMessage());\r
+ }\r
+ }\r
+ }\r
}\r
import java.awt.event.FocusEvent;\r
import java.util.Vector;\r
\r
+import javax.swing.ButtonGroup;\r
import javax.swing.JButton;\r
import javax.swing.JCheckBox;\r
import javax.swing.JComboBox;\r
import org.tianocore.frameworkwizard.common.Identifications.OpeningModuleType;\r
import org.tianocore.frameworkwizard.common.ui.IInternalFrame;\r
import org.tianocore.frameworkwizard.common.ui.StarLabel;\r
+import javax.swing.JRadioButton;\r
\r
/**\r
The class is used to create, update MsaHeader of MSA file\r
\r
private JLabel jLabelBinaryModule = null;\r
\r
- private JComboBox jComboBoxBinaryModule = null;\r
-\r
private JLabel jLabelOutputFileBasename = null;\r
\r
private JTextField jTextFieldOutputFileBasename = null;\r
\r
private EnumerationData ed = new EnumerationData();\r
\r
+ private JRadioButton jRadioButtonBinaryModuleTrue = null;\r
+\r
+ private JRadioButton jRadioButtonBinaryModuleFalse = null;\r
+\r
/**\r
* This method initializes jCheckBoxIa32 \r
* \r
return jTextAreaCopyright;\r
}\r
\r
- /**\r
- * This method initializes jComboBoxBinaryModule \r
- * \r
- * @return javax.swing.JComboBox \r
- */\r
- private JComboBox getJComboBoxBinaryModule() {\r
- if (jComboBoxBinaryModule == null) {\r
- jComboBoxBinaryModule = new JComboBox();\r
- jComboBoxBinaryModule.setBounds(new java.awt.Rectangle(valueCol, 480, valueWidth, 20));\r
- jComboBoxBinaryModule.setPreferredSize(new java.awt.Dimension(valueWidth, 20));\r
- jComboBoxBinaryModule.addFocusListener(this);\r
- jComboBoxBinaryModule.setToolTipText("<html>Modules are either source modules <br>"\r
- + "which can be compiled or binary <br>"\r
- + "modules which are linked. <br>"\r
- + "A module cannot contain both. <br>"\r
- + "The GUID numbers should be identical <br>"\r
- + "for a binary and source MSA, <br>"\r
- + "however the BINARY MSA should have <br>"\r
- + "a higher version number.</html>");\r
- }\r
- return jComboBoxBinaryModule;\r
- }\r
-\r
/**\r
* This method initializes jTextFieldOutputFileBasename \r
* \r
this.setSelectedItems(Tools.convertListToVector(md.getSupportedArchitectures()));\r
}\r
if (md.getBinaryModule()) {\r
- this.jComboBoxBinaryModule.setSelectedIndex(1);\r
+ this.jRadioButtonBinaryModuleTrue.setSelected(true);\r
} else {\r
- this.jComboBoxBinaryModule.setSelectedIndex(0);\r
+ this.jRadioButtonBinaryModuleFalse.setSelected(true);\r
}\r
if (md.getOutputFileBasename() != null) {\r
this.jTextFieldOutputFileBasename.setText(md.getOutputFileBasename());\r
jContentPane.add(jLabelOutputFileBasename, null);\r
jContentPane.add(getJTextFieldOutputFileBasename(), null);\r
jContentPane.add(jLabelBinaryModule, null);\r
- jContentPane.add(getJComboBoxBinaryModule(), null);\r
jContentPane.add(jLabelArch, null);\r
\r
jStarLabel1 = new StarLabel();\r
jContentPane.add(getJCheckBoxArm(), null);\r
jContentPane.add(getJCheckBoxPpc(), null);\r
\r
- \r
jContentPane.add(getJCheckBoxPcd(), null);\r
jContentPane.add(getJComboBoxPcdIsDriver(), null);\r
- \r
jContentPane.add(getJCheckBoxFlashMap(), null);\r
+\r
+ ButtonGroup bg = new ButtonGroup();\r
+ jContentPane.add(getJRadioButtonBinaryModuleTrue(), null);\r
+ jContentPane.add(getJRadioButtonBinaryModuleFalse(), null);\r
+ bg.add(getJRadioButtonBinaryModuleTrue());\r
+ bg.add(getJRadioButtonBinaryModuleFalse());\r
}\r
return jContentPane;\r
}\r
private void initFrame() {\r
EnumerationData ed = new EnumerationData();\r
Tools.generateComboBoxByVector(jComboBoxModuleType, ed.getVModuleType());\r
- Tools.generateComboBoxByVector(jComboBoxBinaryModule, ed.getVBoolean());\r
this.setSelectedItems(ed.getVSupportedArchitectures());\r
}\r
\r
Tools.resizeComponentWidth(this.jTextFieldURL, intCurrentWidth, intPreferredWidth);\r
Tools.resizeComponentWidth(this.jScrollPaneCopyright, intCurrentWidth, intPreferredWidth);\r
Tools.resizeComponentWidth(this.jScrollPaneDescription, intCurrentWidth, intPreferredWidth);\r
- // Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);\r
+ Tools.resizeComponentWidth(this.jTextFieldSpecification, intCurrentWidth, intPreferredWidth);\r
Tools.resizeComponentWidth(this.jTextFieldAbstract, intCurrentWidth, intPreferredWidth);\r
- // Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);\r
- // Tools.resizeComponentWidth(this.jComboBoxBinaryModule, intCurrentWidth, intPreferredWidth);\r
+ Tools.resizeComponentWidth(this.jComboBoxModuleType, intCurrentWidth, intPreferredWidth);\r
Tools.resizeComponentWidth(this.jTextFieldOutputFileBasename, intCurrentWidth, intPreferredWidth);\r
- // Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);\r
+ Tools.resizeComponentWidth(this.jComboBoxPcdIsDriver, intCurrentWidth, intPreferredWidth);\r
\r
Tools.relocateComponentX(this.jButtonGenerateGuid, intCurrentWidth, intPreferredWidth,\r
- DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON - 5);\r
+ DataType.SPACE_TO_RIGHT_FOR_GENERATE_BUTTON);\r
}\r
\r
public void focusLost(FocusEvent arg0) {\r
//\r
// Check Binary Module Type\r
//\r
- if (arg0.getSource() == this.jComboBoxBinaryModule) {\r
- if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.TRUE)) {\r
+ if (arg0.getSource() == this.jRadioButtonBinaryModuleTrue) {\r
+ if (jRadioButtonBinaryModuleTrue.isSelected()) {\r
if (md.getBinaryModule()) {\r
return;\r
} else {\r
md.setBinaryModule(true);\r
}\r
- } else if (jComboBoxBinaryModule.getSelectedItem().toString().equals(DataType.FALSE)) {\r
+ }\r
+ }\r
+\r
+ //\r
+ // Check Binary Module Type\r
+ //\r
+ if (arg0.getSource() == this.jRadioButtonBinaryModuleFalse) {\r
+ if (jRadioButtonBinaryModuleFalse.isSelected()) {\r
if (md.getBinaryModule()) {\r
md.setBinaryModule(false);\r
} else {\r
}\r
return jCheckBoxFlashMap;\r
}\r
- \r
+\r
+ /**\r
+ * This method initializes jRadioButtonBinaryModuleTrue \r
+ * \r
+ * @return javax.swing.JRadioButton \r
+ */\r
+ private JRadioButton getJRadioButtonBinaryModuleTrue() {\r
+ if (jRadioButtonBinaryModuleTrue == null) {\r
+ jRadioButtonBinaryModuleTrue = new JRadioButton();\r
+ jRadioButtonBinaryModuleTrue.setBounds(new java.awt.Rectangle(valueCol, 480, 140, 20));\r
+ jRadioButtonBinaryModuleTrue.setText("True");\r
+ jRadioButtonBinaryModuleTrue.setSelected(true);\r
+ jRadioButtonBinaryModuleTrue.addFocusListener(this);\r
+ jRadioButtonBinaryModuleTrue.setToolTipText("<html>Modules are either source modules <br>"\r
+ + "which can be compiled or binary <br>"\r
+ + "modules which are linked. <br>"\r
+ + "A module cannot contain both. <br>"\r
+ + "The GUID numbers should be identical <br>"\r
+ + "for a binary and source MSA, <br>"\r
+ + "however the BINARY MSA should have <br>"\r
+ + "a higher version number.</html>");\r
+ }\r
+ return jRadioButtonBinaryModuleTrue;\r
+ }\r
+\r
+ /**\r
+ * This method initializes jRadioButtonBinaryModuleFalse \r
+ * \r
+ * @return javax.swing.JRadioButton \r
+ */\r
+ private JRadioButton getJRadioButtonBinaryModuleFalse() {\r
+ if (jRadioButtonBinaryModuleFalse == null) {\r
+ jRadioButtonBinaryModuleFalse = new JRadioButton();\r
+ jRadioButtonBinaryModuleFalse.setBounds(new java.awt.Rectangle(valueCol + 140, 480, 140, 20));\r
+ jRadioButtonBinaryModuleFalse.setText("False");\r
+ jRadioButtonBinaryModuleFalse.addFocusListener(this);\r
+ jRadioButtonBinaryModuleFalse.setToolTipText("<html>Modules are either source modules <br>"\r
+ + "which can be compiled or binary <br>"\r
+ + "modules which are linked. <br>"\r
+ + "A module cannot contain both. <br>"\r
+ + "The GUID numbers should be identical <br>"\r
+ + "for a binary and source MSA, <br>"\r
+ + "however the BINARY MSA should have <br>"\r
+ + "a higher version number.</html>");\r
+ }\r
+ return jRadioButtonBinaryModuleFalse;\r
+ }\r
}\r