diff options
author | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-26 06:53:56 +0000 |
---|---|---|
committer | jlin16 <jlin16@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-05-26 06:53:56 +0000 |
commit | 24dba7f3c138af82b9cc7de2e77dddef46d75741 (patch) | |
tree | 42266e010e00a79dca20bbc021b514b78bb28f6a /Tools/Source/PackageEditor | |
parent | 9a7cf04ab4bdfd59df8d08d8663e3a9747922d84 (diff) | |
download | edk2-platforms-24dba7f3c138af82b9cc7de2e77dddef46d75741.tar.xz |
Fix the problem "update action multiple times fail".
Enhanced GUID value editor.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@289 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/PackageEditor')
11 files changed, 713 insertions, 4 deletions
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java b/Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java index e372812e1f..311370d85d 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/common/Tools.java @@ -25,6 +25,8 @@ import java.util.UUID; **/
public class Tools {
+ public static final String guidArrayPat = "0x[a-fA-F0-9]{1,8},( )*0x[a-fA-F0-9]{1,4},( )*0x[a-fA-F0-9]{1,4}(,( )*\\{)?(,?( )*0x[a-fA-F0-9]{1,2}){8}( )*(\\})?";
+ public static final String guidRegistryPat = "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}";
/**
get current date and time, then return
@return String
@@ -70,4 +72,88 @@ public class Tools { return UUID.randomUUID().toString();
}
+ public static String formatGuidString (String guidNameConv) {
+ String[] strList;
+ String guid = "";
+ int index = 0;
+ if (guidNameConv
+ .matches(Tools.guidRegistryPat)) {
+ strList = guidNameConv.split("-");
+ guid = "0x" + strList[0] + ", ";
+ guid = guid + "0x" + strList[1] + ", ";
+ guid = guid + "0x" + strList[2] + ", ";
+// guid = guid + "{";
+ guid = guid + "0x" + strList[3].substring(0, 2) + ", ";
+ guid = guid + "0x" + strList[3].substring(2, 4);
+
+ while (index < strList[4].length()) {
+ guid = guid + ", ";
+ guid = guid + "0x" + strList[4].substring(index, index + 2);
+ index = index + 2;
+ }
+// guid = guid + "}";
+ return guid;
+ }
+ else if (guidNameConv
+ .matches(Tools.guidArrayPat)) {
+ strList = guidNameConv.split(",");
+
+ //
+ // chang ANSI c form to registry form
+ //
+ for (int i = 0; i < strList.length; i++){
+ strList[i] = strList[i].substring(strList[i].lastIndexOf("x") + 1);
+ }
+ if (strList[strList.length - 1].endsWith("}")) {
+ strList[strList.length -1] = strList[strList.length-1].substring(0, strList[strList.length-1].length()-1);
+ }
+ //
+ //inserting necessary leading zeros
+ //
+
+ int segLen = strList[0].length();
+ if (segLen < 8){
+ for (int i = 0; i < 8 - segLen; ++i){
+ strList[0] = "0" + strList[0];
+ }
+ }
+
+ segLen = strList[1].length();
+ if (segLen < 4){
+ for (int i = 0; i < 4 - segLen; ++i){
+ strList[1] = "0" + strList[1];
+ }
+ }
+ segLen = strList[2].length();
+ if (segLen < 4){
+ for (int i = 0; i < 4 - segLen; ++i){
+ strList[2] = "0" + strList[2];
+ }
+ }
+ for (int i = 3; i < 11; ++i) {
+ segLen = strList[i].length();
+ if (segLen < 2){
+ strList[i] = "0" + strList[i];
+ }
+ }
+
+ for (int i = 0; i < 3; i++){
+ guid += strList[i] + "-";
+ }
+
+ guid += strList[3];
+ guid += strList[4] + "-";
+
+ for (int i = 5; i < strList.length; ++i){
+ guid += strList[i];
+ }
+
+
+ return guid;
+ } else {
+
+ return "0";
+
+ }
+ }
}
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GenGuidDialog.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GenGuidDialog.java new file mode 100644 index 0000000000..c58010a9d7 --- /dev/null +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GenGuidDialog.java @@ -0,0 +1,391 @@ +/** @file
+ Java class GenGuidDialog.
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+**/
+package org.tianocore.packaging;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+
+import javax.swing.JPanel;
+import javax.swing.JDialog;
+import java.awt.GridLayout;
+
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JTextField;
+import javax.swing.JLabel;
+import javax.swing.JRadioButton;
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+
+import org.tianocore.common.Tools;
+
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+
+/**
+ Dialog for GUID generation.
+ @since PackageEditor 1.0
+**/
+public class GenGuidDialog extends JDialog implements ActionListener{
+
+ static private JFrame frame;
+ private JPanel jContentPane = null;
+ private JPanel jPanel = null;
+ private JPanel jPanel1 = null;
+ private JPanel jPanel2 = null;
+ private JPanel jPanel3 = null;
+ private JPanel jPanel4 = null;
+ private JTextField jTextField = null;
+ private JLabel jLabel = null;
+ private JRadioButton jRadioButton = null;
+ private JRadioButton jRadioButton1 = null;
+ private JButton jButton = null;
+ private JButton jButton1 = null;
+ private JButton jButton2 = null;
+
+// private String guid = null;
+
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ if (arg0.getSource() == jButton1){
+ String uuid = Tools.generateUuidString();
+ if (jRadioButton1.isSelected()) {
+ jTextField.setText(uuid);
+ }
+ else {
+ //ToDo: transform to comma-sep guid
+ String s = Tools.formatGuidString(uuid);
+ if (s.equals("0")) {
+ JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
+ return;
+ }
+ jTextField.setText(s);
+ }
+ }
+
+ if (arg0.getSource() == jRadioButton1){
+
+ //ToDo: check text field value against RegExp and transform if needed
+ if (jTextField.getText().matches(Tools.guidRegistryPat)){
+ return;
+ }
+ if (jTextField.getText().matches(Tools.guidArrayPat)) {
+ jTextField.setText(Tools.formatGuidString(jTextField.getText()));
+ return;
+ }
+
+ JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
+
+ }
+
+ if (arg0.getSource() == jRadioButton){
+
+ //ToDo: check text field value against RegExp and transform if needed
+ if (jTextField.getText().matches(Tools.guidArrayPat)){
+ return;
+ }
+ if (jTextField.getText().matches(Tools.guidRegistryPat)) {
+ jTextField.setText(Tools.formatGuidString(jTextField.getText()));
+ return;
+ }
+
+ JOptionPane.showMessageDialog(frame, "Check GUID Value, it don't conform to the schema.");
+
+ }
+
+ if (arg0.getSource() == jButton2){
+// if (jTextField.getText().matches(Tools.guidArrayPat)
+// || jTextField.getText().matches(Tools.guidRegistryPat)){
+// this.setVisible(false);
+// }
+// else {
+// JOptionPane.showMessageDialog(frame, "Incorrect GUID Value Format.");
+// }
+ this.dispose();
+ }
+
+ if (arg0.getSource() == jButton){
+ this.dispose();
+ }
+ }
+
+ /**
+ * This method initializes jPanel
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJPanel() {
+ if (jPanel == null) {
+ FlowLayout flowLayout = new FlowLayout();
+ flowLayout.setVgap(10);
+ jPanel = new JPanel();
+ jPanel.setLayout(flowLayout);
+ jPanel.setPreferredSize(new java.awt.Dimension(100,30));
+ jPanel.add(getJButton1(), null);
+ jPanel.add(getJButton2(), null);
+ jPanel.add(getJButton(), null);
+ }
+ return jPanel;
+ }
+
+ /**
+ * This method initializes jPanel1
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJPanel1() {
+ if (jPanel1 == null) {
+ jPanel1 = new JPanel();
+ }
+ return jPanel1;
+ }
+
+ /**
+ * This method initializes jPanel2
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJPanel2() {
+ if (jPanel2 == null) {
+ jPanel2 = new JPanel();
+ }
+ return jPanel2;
+ }
+
+ /**
+ * This method initializes jPanel3
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJPanel3() {
+ if (jPanel3 == null) {
+ jPanel3 = new JPanel();
+ }
+ return jPanel3;
+ }
+
+ /**
+ * This method initializes jPanel4
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJPanel4() {
+ if (jPanel4 == null) {
+ jLabel = new JLabel();
+ jLabel.setText("GUID Value");
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.setRows(4);
+ jPanel4 = new JPanel();
+ jPanel4.setLayout(gridLayout);
+ jPanel4.add(getJRadioButton1(), null);
+ jPanel4.add(getJRadioButton(), null);
+ jPanel4.add(jLabel, null);
+ jPanel4.add(getJTextField(), null);
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(jRadioButton1);
+ bg.add(jRadioButton);
+ }
+ return jPanel4;
+ }
+
+ /**
+ * This method initializes jTextField
+ *
+ * @return javax.swing.JTextField
+ */
+ private JTextField getJTextField() {
+ if (jTextField == null) {
+ jTextField = new JTextField();
+ jTextField.setHorizontalAlignment(JTextField.LEADING);
+ jTextField.setPreferredSize(new java.awt.Dimension(100,20));
+ }
+ return jTextField;
+ }
+
+ /**
+ * This method initializes jRadioButton
+ *
+ * @return javax.swing.JRadioButton
+ */
+ private JRadioButton getJRadioButton() {
+ if (jRadioButton == null) {
+ jRadioButton = new JRadioButton();
+ jRadioButton.setText("Comma-Seperated Format");
+ jRadioButton.addActionListener(this);
+ }
+ return jRadioButton;
+ }
+
+ /**
+ * This method initializes jRadioButton1
+ *
+ * @return javax.swing.JRadioButton
+ */
+ private JRadioButton getJRadioButton1() {
+ if (jRadioButton1 == null) {
+ jRadioButton1 = new JRadioButton();
+ jRadioButton1.setText("Registry Format");
+ jRadioButton1.setSelected(true);
+ jRadioButton1.addActionListener(this);
+ }
+ return jRadioButton1;
+ }
+
+ /**
+ * This method initializes jButton
+ *
+ * @return javax.swing.JButton
+ */
+ private JButton getJButton() {
+ if (jButton == null) {
+ jButton = new JButton();
+ jButton.setPreferredSize(new java.awt.Dimension(80,20));
+ jButton.setText("Cancel");
+ jButton.addActionListener(this);
+ }
+ return jButton;
+ }
+
+ /**
+ * This method initializes jButton1
+ *
+ * @return javax.swing.JButton
+ */
+ private JButton getJButton1() {
+ if (jButton1 == null) {
+ jButton1 = new JButton();
+ jButton1.setPreferredSize(new java.awt.Dimension(80,20));
+ jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
+ jButton1.setText("New");
+ jButton1.addActionListener(this);
+ }
+ return jButton1;
+ }
+
+ /**
+ * This method initializes jButton2
+ *
+ * @return javax.swing.JButton
+ */
+ private JButton getJButton2() {
+ if (jButton2 == null) {
+ jButton2 = new JButton();
+ jButton2.setPreferredSize(new java.awt.Dimension(80,20));
+ jButton2.setText("Ok");
+ jButton2.addActionListener(this);
+ }
+ return jButton2;
+ }
+
+ /**
+
+ @param args
+ **/
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+ new GenGuidDialog().setVisible(true);
+ }
+
+ public String getGuid(){
+ return jTextField.getText();
+ }
+
+ public void setGuid(String s){
+ jTextField.setText(s);
+ }
+ /**
+ * This is the default constructor
+ */
+ public GenGuidDialog() {
+ super();
+ initialize();
+ }
+
+ public GenGuidDialog(ActionListener i){
+ super();
+ initialize();
+ jButton2.addActionListener(i);
+ this.addWindowListener(new WindowAdapter(){
+
+ @Override
+ public void windowActivated(WindowEvent arg0) {
+ // TODO Auto-generated method stub
+ super.windowActivated(arg0);
+ if ((jRadioButton1.isSelected() && jTextField.getText().matches(Tools.guidArrayPat))
+ || (jRadioButton.isSelected() && jTextField.getText().matches(Tools.guidRegistryPat))) {
+ jTextField.setText(Tools.formatGuidString(jTextField.getText()));
+ }
+
+// if (!jTextField.getText().matches(Tools.guidArrayPat) || !jTextField.getText().matches(Tools.guidRegistryPat)) {
+// JOptionPane.showMessageDialog(frame, "InitVal: Incorrect GUID Value Format.");
+// return;
+// }
+ }
+
+ });
+ }
+
+ /**
+ * This method initializes this
+ *
+ * @return void
+ */
+ private void initialize() {
+ this.setSize(466, 157);
+ this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ this.setModal(true);
+ this.setTitle("Editing GUID Value");
+ this.setContentPane(getJContentPane());
+ this.centerWindow();
+ }
+
+ /**
+ * This method initializes jContentPane
+ *
+ * @return javax.swing.JPanel
+ */
+ private JPanel getJContentPane() {
+ if (jContentPane == null) {
+ jContentPane = new JPanel();
+ jContentPane.setLayout(new BorderLayout());
+ jContentPane.add(getJPanel(), java.awt.BorderLayout.EAST);
+ jContentPane.add(getJPanel1(), java.awt.BorderLayout.WEST);
+ jContentPane.add(getJPanel2(), java.awt.BorderLayout.NORTH);
+ jContentPane.add(getJPanel3(), java.awt.BorderLayout.SOUTH);
+ jContentPane.add(getJPanel4(), java.awt.BorderLayout.CENTER);
+ }
+ return jContentPane;
+ }
+
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
+ }
+
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
+ }
+
+} // @jve:decl-index=0:visual-constraint="10,10"
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuidEditor.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuidEditor.java new file mode 100644 index 0000000000..cac74dfc1c --- /dev/null +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/GuidEditor.java @@ -0,0 +1,93 @@ +/** @file
+ Java class GuidEditor.
+
+Copyright (c) 2006, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+package org.tianocore.packaging;
+
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JTable;
+import javax.swing.table.TableCellEditor;
+
+import org.tianocore.common.Tools;
+
+/**
+ Editor for table cell with GUID value.
+ @since PackageEditor 1.0
+ **/
+public class GuidEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
+
+ String currentGuid;
+ JButton button;
+ static JFrame frame;
+ GenGuidDialog dialog;
+ protected static final String EDIT = "edit";
+
+ public GuidEditor() {
+
+ button = new JButton();
+ button.setActionCommand(EDIT);
+ button.addActionListener(this);
+ button.setBorderPainted(false);
+
+
+ dialog = new GenGuidDialog(this);
+
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int)
+ */
+ public Component getTableCellEditorComponent(JTable arg0, Object arg1, boolean arg2, int arg3, int arg4) {
+ // TODO Auto-generated method stub
+ currentGuid = (String)arg1;
+ return button;
+ }
+
+ /* (non-Javadoc)
+ * @see javax.swing.CellEditor#getCellEditorValue()
+ */
+ public Object getCellEditorValue() {
+ // TODO Auto-generated method stub
+ return currentGuid;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ public void actionPerformed(ActionEvent arg0) {
+ // TODO Auto-generated method stub
+ if (EDIT.equals(arg0.getActionCommand())) {
+ //The user has clicked the cell, so
+ //bring up the dialog.
+ button.setText(currentGuid);
+ dialog.setGuid(currentGuid);
+ dialog.setVisible(true);
+
+ //Make the renderer reappear.
+ fireEditingStopped();
+ }
+ else { //User pressed dialog's "OK" button.
+ currentGuid = dialog.getGuid();
+// button.setText(currentGuid);
+// fireEditingStopped();
+ }
+
+ }
+
+}
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java index b6e573a1fd..e165656b92 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/SpdFileContents.java @@ -125,6 +125,7 @@ public class SpdFileContents { return;
XmlCursor cursor = o.newCursor();
cursor.removeXml();
+ spdPcdDefinitions = null;
}
/**
@@ -136,6 +137,7 @@ public class SpdFileContents { return;
XmlCursor cursor = o.newCursor();
cursor.removeXml();
+ spdPpiDeclarations = null;
}
/**
@@ -147,6 +149,7 @@ public class SpdFileContents { return;
XmlCursor cursor = o.newCursor();
cursor.removeXml();
+ spdProtocolDeclarations = null;
}
/**
@@ -158,10 +161,11 @@ public class SpdFileContents { return;
XmlCursor cursor = o.newCursor();
cursor.removeXml();
+ spdGuidDeclarations = null;
}
/**
- Remove existing spd package header using XmlCursor
+ Remove existing spd package include files using XmlCursor
**/
public void removeSpdPkgHeader() {
XmlObject o = psaRoot.getPackageHeaders();
@@ -169,6 +173,7 @@ public class SpdFileContents { return;
XmlCursor cursor = o.newCursor();
cursor.removeXml();
+ spdModHdrs = null;
}
/**
@@ -180,6 +185,7 @@ public class SpdFileContents { return;
XmlCursor cursor = o.newCursor();
cursor.removeXml();
+ spdMsaFiles = null;
}
/**
@@ -191,7 +197,7 @@ public class SpdFileContents { return;
XmlCursor cursor = o.newCursor();
cursor.removeXml();
-
+ spdLibClassDeclarations = null;
}
/**
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java index 943a782f4e..6193073473 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateGuids.java @@ -24,6 +24,8 @@ import javax.swing.table.*; import org.tianocore.common.Tools;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
@@ -83,10 +85,11 @@ public class UpdateGuids extends JFrame implements ActionListener { @return void
**/
private void initialize() {
- this.setSize(604, 553);
+ this.setSize(669, 568);
this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Update GUID Declarations");
this.setContentPane(getJContentPane());
+ this.centerWindow();
}
/**
@@ -114,7 +117,7 @@ public class UpdateGuids extends JFrame implements ActionListener { private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
- jScrollPane.setBounds(new java.awt.Rectangle(38, 45, 453, 419));
+ jScrollPane.setBounds(new java.awt.Rectangle(38,45,586,315));
jScrollPane.setViewportView(getJTable());
}
return jScrollPane;
@@ -147,6 +150,7 @@ public class UpdateGuids extends JFrame implements ActionListener { i++;
}
+ jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());
}
return jTable;
}
@@ -226,4 +230,20 @@ public class UpdateGuids extends JFrame implements ActionListener { }
return jButton;
}
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
+ }
+
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
+ }
} // @jve:decl-index=0:visual-constraint="11,7"
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java index 8e796d48f1..4bd6a13630 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateLibraryClass.java @@ -24,6 +24,8 @@ import javax.swing.table.*; import org.tianocore.common.Tools;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
@@ -88,6 +90,23 @@ public class UpdateLibraryClass extends JFrame implements ActionListener { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Update Library Class Declarations");
this.setContentPane(getJContentPane());
+ this.centerWindow();
+ }
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
+ }
+
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
}
/**
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java index c6fc235015..4327fd565d 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateMsaFile.java @@ -24,6 +24,8 @@ import javax.swing.table.*; import org.tianocore.common.Tools;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -86,9 +88,25 @@ public class UpdateMsaFile extends JFrame implements ActionListener { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Update MSA Files");
this.setContentPane(getJContentPane());
+ this.centerWindow();
+ }
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
}
/**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
+ }
+ /**
This method initializes jContentPane
@return javax.swing.JPanel
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java index 44d8970dc6..765e331432 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePCD.java @@ -26,6 +26,8 @@ import javax.swing.table.*; import org.tianocore.common.Tools;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
@@ -92,9 +94,25 @@ public class UpdatePCD extends JFrame implements ActionListener { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Update PCD Definitions");
this.setContentPane(getJContentPane());
+ this.centerWindow();
+ }
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
}
/**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
+ }
+ /**
This method initializes jContentPane
@return javax.swing.JPanel
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java index 77c8ff5642..5f9356cf8d 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePkgHeader.java @@ -26,6 +26,8 @@ import javax.swing.table.*; import org.tianocore.common.Tools;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
@@ -90,9 +92,25 @@ public class UpdatePkgHeader extends JFrame implements ActionListener { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Update Package Headers");
this.setContentPane(getJContentPane());
+ this.centerWindow();
+ }
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
}
/**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
+ }
+ /**
This method initializes jContentPane
@return javax.swing.JPanel
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java index 17fb13f428..be58e1c848 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdatePpi.java @@ -24,6 +24,8 @@ import javax.swing.table.*; import org.tianocore.common.Tools;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
@@ -88,9 +90,25 @@ public class UpdatePpi extends JFrame implements ActionListener { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Update PPI Declarations");
this.setContentPane(getJContentPane());
+ this.centerWindow();
+ }
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
}
/**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
+ }
+ /**
This method initializes jContentPane
@return javax.swing.JPanel
@@ -148,6 +166,7 @@ public class UpdatePpi extends JFrame implements ActionListener { i++;
}
+ jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());
}
return jTable;
}
diff --git a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java index 552186752b..4408ec1ffc 100644 --- a/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java +++ b/Tools/Source/PackageEditor/src/org/tianocore/packaging/UpdateProtocols.java @@ -24,6 +24,8 @@ import javax.swing.table.*; import org.tianocore.common.Tools;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
@@ -88,9 +90,26 @@ public class UpdateProtocols extends JFrame implements ActionListener { this.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
this.setTitle("Update Protocol Declarations");
this.setContentPane(getJContentPane());
+ this.centerWindow();
}
/**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow(int intWidth, int intHeight) {
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ this.setLocation((d.width - intWidth) / 2, (d.height - intHeight) / 2);
+ }
+
+ /**
+ Start the window at the center of screen
+
+ **/
+ protected void centerWindow() {
+ centerWindow(this.getSize().width, this.getSize().height);
+ }
+ /**
This method initializes jContentPane
@return javax.swing.JPanel
@@ -148,6 +167,8 @@ public class UpdateProtocols extends JFrame implements ActionListener { i++;
}
+ jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor());
+
}
return jTable;
}
|