From: jlin16 Date: Fri, 29 Dec 2006 08:09:48 +0000 (+0000) Subject: Make opening dialogs re-gain focus when user switch back to main UI from other window... X-Git-Tag: edk2-stable201903~23725 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=82484861b558513f1333518d9e4f740d1c1526a6 Make opening dialogs re-gain focus when user switch back to main UI from other windows applications. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2152 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java index cc8a065340..c3452d7b4c 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/FrameworkWizardUI.java @@ -2784,31 +2784,31 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe getJDesktopPanePackage().add(frmSpdHeader, 1); break; case IDefaultMutableTreeNode.SPD_LIBRARYCLASSDECLARATIONS: - SpdLibClassDecls frmSlcd = new SpdLibClassDecls(spd); + SpdLibClassDecls frmSlcd = new SpdLibClassDecls(spd, this); getJDesktopPanePackage().add(frmSlcd, 1); break; case IDefaultMutableTreeNode.SPD_MSAFILES: - SpdMsaFiles frmSmf = new SpdMsaFiles(spd); + SpdMsaFiles frmSmf = new SpdMsaFiles(spd, this); getJDesktopPanePackage().add(frmSmf, 1); break; case IDefaultMutableTreeNode.SPD_PACKAGEHEADERS: - SpdPackageHeaders frmSph = new SpdPackageHeaders(spd); + SpdPackageHeaders frmSph = new SpdPackageHeaders(spd, this); getJDesktopPanePackage().add(frmSph, 1); break; case IDefaultMutableTreeNode.SPD_GUIDDECLARATIONS: - SpdGuidDecls frmSgd = new SpdGuidDecls(spd); + SpdGuidDecls frmSgd = new SpdGuidDecls(spd, this); getJDesktopPanePackage().add(frmSgd, 1); break; case IDefaultMutableTreeNode.SPD_PROTOCOLDECLARATIONS: - SpdProtocolDecls frmSprod = new SpdProtocolDecls(spd); + SpdProtocolDecls frmSprod = new SpdProtocolDecls(spd, this); getJDesktopPanePackage().add(frmSprod, 1); break; case IDefaultMutableTreeNode.SPD_PPIDECLARATIONS: - SpdPpiDecls frmSppid = new SpdPpiDecls(spd); + SpdPpiDecls frmSppid = new SpdPpiDecls(spd, this); getJDesktopPanePackage().add(frmSppid, 1); break; case IDefaultMutableTreeNode.SPD_PCDDECLARATIONS: - SpdPcdDefs frmSpcdd = new SpdPcdDefs(spd); + SpdPcdDefs frmSpcdd = new SpdPcdDefs(spd, this); getJDesktopPanePackage().add(frmSpcdd, 1); break; } @@ -3409,7 +3409,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe int result = cso.showDialog(); if (result == DataType.RETURN_TYPE_OK) { String strReturn = "Far Creation Completed!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, + JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); } cso.dispose(); @@ -3424,7 +3424,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe int result = iso.showDialog(); if (result == DataType.RETURN_TYPE_OK) { String strReturn = "Far Installalation completed!
Refreshing the WORKSPACE!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, + JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); this.closeAll(); this.refresh(); @@ -3442,7 +3442,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe int result = dso.showDialog(); if (result == DataType.RETURN_TYPE_OK) { String strReturn = "Far Deletion completed!
Refreshing the WORKSPACE!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, + JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); this.closeAll(); this.refresh(); @@ -3460,7 +3460,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe int result = uso.showDialog(); if (result == DataType.RETURN_TYPE_OK) { String strReturn = "Far Update completed!
Refreshing the WORKSPACE!"; - JOptionPane.showConfirmDialog(null, strReturn, "Done", JOptionPane.DEFAULT_OPTION, + JOptionPane.showConfirmDialog(this, strReturn, "Done", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); this.closeAll(); this.refresh(); @@ -3707,7 +3707,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe return; } - JOptionPane.showConfirmDialog(null, "File is created", "Generate guids.xref", JOptionPane.DEFAULT_OPTION, + JOptionPane.showConfirmDialog(this, "File is created", "Generate guids.xref", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); } } @@ -3723,7 +3723,7 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe case Workspace.WORKSPACE_NOT_DEFINED: JOptionPane .showConfirmDialog( - null, + this, "WORKSPACE Environment Variable Is Not Defined, Please select a valid WORKSPACE directory. " + DataType.LINE_SEPARATOR + DataType.LINE_SEPARATOR @@ -3743,22 +3743,22 @@ public class FrameworkWizardUI extends IFrame implements KeyListener, MouseListe break; } case Workspace.WORKSPACE_NOT_EXIST: - JOptionPane.showConfirmDialog(null, "Defined WORKSPACE Is Not Existed", "Error", + JOptionPane.showConfirmDialog(this, "Defined WORKSPACE Is Not Existed", "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); this.dispose(); System.exit(0); case Workspace.WORKSPACE_NOT_DIRECTORY: - JOptionPane.showConfirmDialog(null, "Defined WORKSPACE Is Not A Directory", "Error", + JOptionPane.showConfirmDialog(this, "Defined WORKSPACE Is Not A Directory", "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); this.dispose(); System.exit(0); case Workspace.WORKSPACE_NOT_VALID: - JOptionPane.showConfirmDialog(null, "WORKSPACE Environment Variable Is Not Valid", "Error", + JOptionPane.showConfirmDialog(this, "WORKSPACE Environment Variable Is Not Valid", "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); this.dispose(); System.exit(0); case Workspace.WORKSPACE_NO_TARGET_FILE: - JOptionPane.showConfirmDialog(null, "Target.txt File Is Not Existed", "Error", JOptionPane.DEFAULT_OPTION, + JOptionPane.showConfirmDialog(this, "Target.txt File Is Not Existed", "Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); this.dispose(); System.exit(0); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java index 0607658bca..cab190946b 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Log.java @@ -22,6 +22,8 @@ import java.io.IOException; import javax.swing.JOptionPane; +import org.tianocore.frameworkwizard.FrameworkWizardUI; + /** The class is used to provides static interfaces to save log and error information @@ -175,7 +177,7 @@ public class Log { private static void showWrnMessage(String strErr) { String strReturn = Tools.wrapStringByWord(strErr); JOptionPane - .showConfirmDialog(null, strReturn, "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); + .showConfirmDialog(FrameworkWizardUI.getInstance(), strReturn, "Warning", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE); } /** diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java index fe6496199d..6dcb91e931 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/Tools.java @@ -35,6 +35,7 @@ import org.tianocore.PackageSurfaceAreaDocument.PackageSurfaceArea; import org.tianocore.PlatformHeaderDocument.PlatformHeader; import org.tianocore.PlatformSurfaceAreaDocument.PlatformSurfaceArea; import org.tianocore.SpdHeaderDocument.SpdHeader; +import org.tianocore.frameworkwizard.FrameworkWizardUI; import org.tianocore.frameworkwizard.module.Identifications.ModuleIdentification; import org.tianocore.frameworkwizard.packaging.PackageIdentification; import org.tianocore.frameworkwizard.platform.PlatformIdentification; @@ -334,7 +335,7 @@ public class Tools { **/ public static void showInformationMessage(String arg0) { - JOptionPane.showConfirmDialog(null, arg0, "Info", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showConfirmDialog(FrameworkWizardUI.getInstance(), arg0, "Info", JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE); } /** diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java index 101dd999fb..5f3341f696 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/common/ui/IFrame.java @@ -217,7 +217,7 @@ public class IFrame extends JFrame implements ActionListener, WindowListener, Co } public int showSaveDialog() { - return JOptionPane.showConfirmDialog(null, "Save all changed files?", "Save", JOptionPane.YES_NO_CANCEL_OPTION, + return JOptionPane.showConfirmDialog(this, "Save all changed files?", "Save", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java index c0a64be53b..a2e3500c3a 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/far/createui/CreateStepTwo.java @@ -277,7 +277,7 @@ public class CreateStepTwo extends IDialog implements MouseListener { msg += "is un-Repackagable. Do you want to continue? "; if (unRepackablePackages.size() > 0) { - if(JOptionPane.showConfirmDialog(null, msg, "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) { + if(JOptionPane.showConfirmDialog(this, msg, "Warning", JOptionPane.YES_NO_OPTION) == JOptionPane.NO_OPTION) { return ; } } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java index 4e65c3c81d..b219c9ed70 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GenGuidDialog.java @@ -271,15 +271,6 @@ public class GenGuidDialog extends JDialog implements ActionListener{ return jButtonOk; } - /** - - @param args - **/ - public static void main(String[] args) { - // TODO Auto-generated method stub - new GenGuidDialog().setVisible(true); - } - public String getGuid(){ return jTextField.getText(); } @@ -295,8 +286,8 @@ public class GenGuidDialog extends JDialog implements ActionListener{ initialize(); } - public GenGuidDialog(ActionListener i){ - super(); + public GenGuidDialog(ActionListener i, JFrame frame){ + super(frame); outerListener = i; initialize(); jButtonOk.addActionListener(i); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java index c9f73b04bc..0d00f4a014 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/GuidEditor.java @@ -20,8 +20,8 @@ import java.awt.event.ActionListener; import javax.swing.AbstractCellEditor; import javax.swing.JButton; -//import javax.swing.JComponent; import javax.swing.JFrame; +//import javax.swing.JComponent; import javax.swing.JTable; //import javax.swing.KeyStroke; import javax.swing.table.TableCellEditor; @@ -39,11 +39,10 @@ public class GuidEditor extends AbstractCellEditor implements TableCellEditor, A private static final long serialVersionUID = 1L; String currentGuid; JButton button; - static JFrame frame; GenGuidDialog dialog; protected static final String EDIT = "edit"; - public GuidEditor() { + public GuidEditor(JFrame frame) { button = new JButton(); button.setActionCommand(EDIT); @@ -52,7 +51,7 @@ public class GuidEditor extends AbstractCellEditor implements TableCellEditor, A button.setBorderPainted(false); - dialog = new GenGuidDialog(this); + dialog = new GenGuidDialog(this, frame); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java index c0c4b2698c..8f39783a8f 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdGuidDecls.java @@ -19,6 +19,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ComponentEvent; import java.util.Vector; +import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTable; @@ -26,7 +27,6 @@ import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JButton; -import javax.swing.JFrame; import javax.swing.ListSelectionModel; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; @@ -58,8 +58,8 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ * */ private static final long serialVersionUID = 1L; - - static JFrame frame; + + private JFrame topFrame = null; private SpdFileContents sfc = null; @@ -219,8 +219,8 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ column = jTable.getColumnModel().getColumn(6); column.setMinWidth(this.guidTypeMinWidth); - jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor()); - jTable.getColumnModel().getColumn(3).setCellEditor(new LongTextEditor()); + jTable.getColumnModel().getColumn(2).setCellEditor(new GuidEditor(topFrame)); + jTable.getColumnModel().getColumn(3).setCellEditor(new LongTextEditor(topFrame)); Vector vArch = new Vector(); vArch.add("IA32"); @@ -229,7 +229,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ vArch.add("EBC"); vArch.add("ARM"); vArch.add("PPC"); - jTable.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch)); + jTable.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, topFrame)); Vector vModule = new Vector(); vModule.add("BASE"); @@ -244,7 +244,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ vModule.add("UEFI_DRIVER"); vModule.add("UEFI_APPLICATION"); vModule.add("USER_DEFINED"); - jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vModule)); + jTable.getColumnModel().getColumn(5).setCellEditor(new ListEditor(vModule, topFrame)); Vector vGuid = new Vector(); vGuid.add("DATA_HUB_RECORD"); @@ -255,7 +255,7 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ vGuid.add("HII_PACKAGE_LIST"); vGuid.add("HOB"); vGuid.add("TOKEN_SPACE_GUID"); - ListEditor le = new ListEditor(vGuid); + ListEditor le = new ListEditor(vGuid, topFrame); le.setCanNotBeEmpty(true); jTable.getColumnModel().getColumn(6).setCellEditor(le); @@ -416,24 +416,25 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ /** This is the default constructor **/ - public SpdGuidDecls() { + public SpdGuidDecls(JFrame frame) { super(); + topFrame = frame; initialize(); init(); } - public SpdGuidDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){ - this(); + public SpdGuidDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){ + this(frame); sfc = new SpdFileContents(inPsa); init(sfc); } - public SpdGuidDecls(OpeningPackageType opt) { - this(opt.getXmlSpd()); + public SpdGuidDecls(OpeningPackageType opt, JFrame frame) { + this(opt.getXmlSpd(), frame); docConsole = opt; if (sfc.getSpdPkgDefsRdOnly().equals("true")) { - JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table."); + JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table."); } initFrame(); } @@ -896,10 +897,6 @@ public class SpdGuidDecls extends IInternalFrame implements TableModelListener{ return iCheckBoxListMod; } - public static void main(String[] args){ - new SpdGuidDecls().setVisible(true); - } - protected DefaultTableModel getModel() { return model; } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java index 8ee2da170c..a8def0a86b 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdHeader.java @@ -21,7 +21,6 @@ import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import javax.swing.JButton; -import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -102,7 +101,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ // //Define class members // - static JFrame frame; + private IInternalFrame topFrame; private JPanel jContentPane = null; @@ -191,7 +190,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ jPackageNameTextField.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { if (!DataValidation.isUiNameType(jPackageNameTextField.getText())) { - JOptionPane.showMessageDialog(frame, "Package Name must start with a letter."); + JOptionPane.showMessageDialog(topFrame, "Package Name must start with a letter."); return; } if (jPackageNameTextField.getText().equals(sfc.getSpdHdrPkgName())) { @@ -219,7 +218,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ jGuidTextField.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { if (!DataValidation.isGuid(jGuidTextField.getText())) { - JOptionPane.showMessageDialog(frame, "Guid must be in registry (8-4-4-4-12) format."); + JOptionPane.showMessageDialog(topFrame, "Guid must be in registry (8-4-4-4-12) format."); return; } if (jGuidTextField.getText().equals(sfc.getSpdHdrGuidValue())) { @@ -247,7 +246,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ jVersionTextField.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { if (!DataValidation.isVersion(jVersionTextField.getText())) { - JOptionPane.showMessageDialog(frame, "Version must start with a number."); + JOptionPane.showMessageDialog(topFrame, "Version must start with a number."); return; } if (jVersionTextField.getText().equals(sfc.getSpdHdrVer())) { @@ -290,7 +289,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ jLicenseTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { if (jLicenseTextArea.getText().length() == 0) { - JOptionPane.showMessageDialog(frame, "License is a required field."); + JOptionPane.showMessageDialog(topFrame, "License is a required field."); return; } if (jLicenseTextArea.getText().equals(sfc.getSpdHdrLicense())) { @@ -318,7 +317,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ public void focusLost(FocusEvent e) { if (jDescriptionTextArea.getText().length() == 0) { JOptionPane - .showMessageDialog(frame, + .showMessageDialog(topFrame, "Description is a required field, and should reflect the contents of the package."); return; } @@ -405,7 +404,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ jAbstractTextField.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { if (!DataValidation.isAbstract(jAbstractTextField.getText())) { - JOptionPane.showMessageDialog(frame, "Abstract could NOT be empty."); + JOptionPane.showMessageDialog(topFrame, "Abstract could NOT be empty."); return; } if (jAbstractTextField.getText().equals(sfc.getSpdHdrAbs())) { @@ -443,7 +442,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ jCopyrightTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent e) { if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) { - JOptionPane.showMessageDialog(frame, "Copyright must be entered."); + JOptionPane.showMessageDialog(topFrame, "Copyright must be entered."); return; } if (jCopyrightTextArea.getText().equals(sfc.getSpdHdrCopyright())) { @@ -560,6 +559,7 @@ public class SpdHeader extends IInternalFrame implements DocumentListener{ this(opt.getXmlSpd()); docConsole = opt; initFrame(); + topFrame = this; } /** diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java index 9dac18480a..9aac2464c9 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdLibClassDecls.java @@ -70,7 +70,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen */ private static final long serialVersionUID = 1L; - static JFrame frame; + private JFrame topFrame; private JTable jTable = null; @@ -249,7 +249,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen model.addColumn("Supported Architectures"); model.addColumn("Supported Module Types"); - jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor()); + jTable.getColumnModel().getColumn(cnHelpText).setCellEditor(new LongTextEditor(topFrame)); jTable.removeColumn(jTable.getColumnModel().getColumn(3)); jTable.removeColumn(jTable.getColumnModel().getColumn(3)); @@ -261,7 +261,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen vArch.add("EBC"); vArch.add("ARM"); vArch.add("PPC"); - jTable.getColumnModel().getColumn(cnSupArch - 2).setCellEditor(new ListEditor(vArch)); + jTable.getColumnModel().getColumn(cnSupArch - 2).setCellEditor(new ListEditor(vArch, topFrame)); Vector vModule = new Vector(); vModule.add("BASE"); @@ -277,7 +277,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen vModule.add("UEFI_APPLICATION"); vModule.add("USER_DEFINED"); - jTable.getColumnModel().getColumn(cnSupMod - 2).setCellEditor(new ListEditor(vModule)); + jTable.getColumnModel().getColumn(cnSupMod - 2).setCellEditor(new ListEditor(vModule, topFrame)); TableColumn column = jTable.getColumnModel().getColumn(this.cnClassName); column.setMinWidth(this.classNameMinWidth); @@ -435,21 +435,22 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen /** This is the default constructor **/ - public SpdLibClassDecls() { + public SpdLibClassDecls(JFrame frame) { super(); + topFrame = frame; initialize(); init(); } - public SpdLibClassDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){ - this(); + public SpdLibClassDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){ + this(frame); sfc = new SpdFileContents(inPsa); init(sfc); } - public SpdLibClassDecls(OpeningPackageType opt) { - this(opt.getXmlSpd()); + public SpdLibClassDecls(OpeningPackageType opt, JFrame frame) { + this(opt.getXmlSpd(), frame); docConsole = opt; } /** @@ -475,7 +476,7 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private void init(SpdFileContents sfc) { if (sfc.getSpdPkgDefsRdOnly().equals("true")) { - JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table."); + JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table."); } initFrame(); @@ -662,15 +663,15 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen private boolean dataValidation(String[] row) { if (!DataValidation.isKeywordType(row[cnClassName])) { - JOptionPane.showMessageDialog(frame, "Library Class name entered does not match KeyWord datatype."); + JOptionPane.showMessageDialog(this, "Library Class name entered does not match KeyWord datatype."); return false; } if (!DataValidation.isPathAndFilename(row[cnHdrFile])) { - JOptionPane.showMessageDialog(frame, "Include Header does not match the PathAndFilename datatype."); + JOptionPane.showMessageDialog(this, "Include Header does not match the PathAndFilename datatype."); return false; } if (row[cnHelpText].length() == 0) { - JOptionPane.showMessageDialog(frame, "Help Text must be entered!"); + JOptionPane.showMessageDialog(this, "Help Text must be entered!"); return false; } // if (row[cnRecInstVer] != null && row[cnRecInstVer].length() > 0) { @@ -737,13 +738,13 @@ public class SpdLibClassDecls extends IInternalFrame implements TableModelListen chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - int retval = chooser.showOpenDialog(frame); + int retval = chooser.showOpenDialog(topFrame); 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 directory structure!"); + JOptionPane.showMessageDialog(topFrame, "You can only select files in current package directory structure!"); return; } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java index 283c897223..fb23e05659 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdMsaFiles.java @@ -54,7 +54,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ */ private static final long serialVersionUID = 1L; - static JFrame frame; + private JFrame topFrame; private JScrollPane jScrollPane = null; // @jve:decl-index=0:visual-constraint="10,95" @@ -229,21 +229,21 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ /** This is the default constructor **/ - public SpdMsaFiles() { + public SpdMsaFiles(JFrame frame) { super(); initialize(); init(); - + topFrame = frame; } - public SpdMsaFiles(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){ - this(); + public SpdMsaFiles(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){ + this(frame); sfc = new SpdFileContents(inPsa); init(sfc); } - public SpdMsaFiles(OpeningPackageType opt){ - this(opt.getXmlSpd()); + public SpdMsaFiles(OpeningPackageType opt, JFrame frame){ + this(opt.getXmlSpd(), frame); docConsole = opt; } /** @@ -269,7 +269,7 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ private void init(SpdFileContents sfc){ if (sfc.getSpdPkgDefsRdOnly().equals("true")) { - JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table."); + JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table."); } initFrame(); @@ -477,13 +477,13 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - int retval = chooser.showOpenDialog(frame); + int retval = chooser.showOpenDialog(SpdMsaFiles.this); 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!"); + JOptionPane.showMessageDialog(SpdMsaFiles.this, "You can only select files in current package!"); return; } @@ -512,9 +512,6 @@ public class SpdMsaFiles extends IInternalFrame implements TableModelListener{ Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 25); } - public static void main(String[] args){ - new SpdMsaFiles().setVisible(true); - } } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java index 5691e77654..1c1d13a245 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java @@ -57,7 +57,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe */ private static final long serialVersionUID = 1L; - static JFrame frame; + private JFrame topFrame; private SpdFileContents sfc = null; @@ -213,21 +213,21 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe /** This is the default constructor **/ - public SpdPackageHeaders() { + public SpdPackageHeaders(JFrame frame) { super(); initialize(); init(); - + topFrame = frame; } - public SpdPackageHeaders(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa){ - this(); + public SpdPackageHeaders(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame){ + this(frame); sfc = new SpdFileContents(inPsa); init(sfc); } - public SpdPackageHeaders(OpeningPackageType opt) { - this(opt.getXmlSpd()); + public SpdPackageHeaders(OpeningPackageType opt, JFrame frame) { + this(opt.getXmlSpd(), frame); docConsole = opt; } /** @@ -253,7 +253,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe private void init(SpdFileContents sfc){ if (sfc.getSpdPkgDefsRdOnly().equals("true")) { - JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table."); + JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table."); } initFrame(); @@ -445,13 +445,13 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - int retval = chooser.showOpenDialog(frame); + int retval = chooser.showOpenDialog(SpdPackageHeaders.this); 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!"); + JOptionPane.showMessageDialog(SpdPackageHeaders.this, "You can only select files in current package!"); return; } @@ -573,10 +573,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe Tools.resizeComponentWidth(this.jScrollPanePkgHdr, this.getWidth(), intPreferredWidth); Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 30); } - - public static void main(String[] args){ - new SpdPackageHeaders().setVisible(true); - } + } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java index 1ada302753..3886843072 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPcdDefs.java @@ -66,7 +66,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ */ private static final long serialVersionUID = 1L; - static JFrame frame; + private JFrame topFrame; private JPanel jContentPane = null; @@ -163,7 +163,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private final int usageMinWidth = 60; private final int supArchMinWidth = 200; private final int supModMinWidth = 200; - + // private Object boolModifyLock = new Object(); // private boolean exclusiveUsage = false; @@ -262,21 +262,21 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ /** This is the default constructor **/ - public SpdPcdDefs() { + public SpdPcdDefs(JFrame frame) { super(); init(); initialize(); - + topFrame = frame; } - public SpdPcdDefs(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) { - this(); + public SpdPcdDefs(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) { + this(frame); sfc = new SpdFileContents(inPsa); init(sfc); } - public SpdPcdDefs(OpeningPackageType opt) { - this(opt.getXmlSpd()); + public SpdPcdDefs(OpeningPackageType opt, JFrame frame) { + this(opt.getXmlSpd(), frame); docConsole = opt; } /** @@ -301,7 +301,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private void init(SpdFileContents sfc){ if (sfc.getSpdPkgDefsRdOnly().equals("true")) { - JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table."); + JOptionPane.showMessageDialog(topFrame, "This is a read-only package. You will not be able to edit contents in table."); } initFrame(); @@ -525,15 +525,15 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ jCheckBoxPatchInMod.isSelected(), jCheckBoxDyn.isSelected(), jCheckBoxDynEx.isSelected(), archList, modTypeList}; try { - if (!dataValidation(row)) { - return; - } - - if (tokenCNameExisted(jTextFieldToken.getText(),jTextFieldC_Name.getText())) { - return; - } + if (!dataValidation(row)) { + return; + } + + if (tokenCNameExisted(jTextFieldToken.getText(), jTextFieldC_Name.getText())) { + return; + } } catch (Exception e) { - JOptionPane.showMessageDialog(frame, "Illegal Token:"+ e.getCause()); + JOptionPane.showMessageDialog(this, "Illegal Token:"+ e.getCause()); return; } @@ -765,7 +765,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ TableColumn dataTypeColumn = jTable.getColumnModel().getColumn(3); dataTypeColumn.setCellEditor(new DefaultCellEditor(jComboBoxDataType)); - jTable.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor()); + jTable.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(topFrame)); Vector vArch = new Vector(); vArch.add("IA32"); @@ -774,7 +774,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ vArch.add("EBC"); vArch.add("ARM"); vArch.add("PPC"); - jTable.getColumnModel().getColumn(11).setCellEditor(new ListEditor(vArch)); + jTable.getColumnModel().getColumn(11).setCellEditor(new ListEditor(vArch, topFrame)); Vector vModule = new Vector(); vModule.add("BASE"); @@ -789,7 +789,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ vModule.add("UEFI_DRIVER"); vModule.add("UEFI_APPLICATION"); vModule.add("USER_DEFINED"); - jTable.getColumnModel().getColumn(12).setCellEditor(new ListEditor(vModule)); + jTable.getColumnModel().getColumn(12).setCellEditor(new ListEditor(vModule, topFrame)); jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTable.getSelectionModel().addListSelectionListener(new ListSelectionListener(){ @@ -836,7 +836,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ String usage = getValidUsage(new Boolean(m.getValueAt(row, 6)+""), new Boolean(m.getValueAt(row, 7)+""), new Boolean(m.getValueAt(row, 8)+""), new Boolean(m.getValueAt(row, 9)+""), new Boolean(m.getValueAt(row, 10)+"")); if (usage.length() == 0) { - JOptionPane.showMessageDialog(frame, "You must choose at least one usage for PCD entry."); + JOptionPane.showMessageDialog(this, "You must choose at least one usage for PCD entry."); return; } @@ -847,9 +847,9 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ } if (v.contains("FEATURE_FLAG")/* && v.size() > 1 && !exclusiveUsage*/) { if (v.size() > 1) { - JOptionPane.showMessageDialog(frame, "Usage Feature Flag can NOT co-exist with others."); - return; - } + JOptionPane.showMessageDialog(this, "Usage Feature Flag can NOT co-exist with others."); + return; + } // synchronized (boolModifyLock){ // exclusiveUsage = true; // } @@ -906,12 +906,12 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ Object[] o = {cName, token, ts, dataType, defaultVal, help}; try { - if (!dataValidation(o)){ - return; - } + if (!dataValidation(o)){ + return; + } } catch (Exception e) { - JOptionPane.showMessageDialog(frame, "Illegal Token:" + e.getCause()); + JOptionPane.showMessageDialog(this, "Illegal Token:" + e.getCause()); return; } docConsole.setSaved(false); @@ -1065,16 +1065,16 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ for (int i = 0; i < model.getRowCount(); ++i) { if (model.getValueAt(i, 0).equals(cName)) { - JOptionPane.showMessageDialog(frame, "C_Name already existed in table."); + JOptionPane.showMessageDialog(this, "C_Name already existed in table."); return true; } if (model.getValueAt(i, 1).equals(token)) { - JOptionPane.showMessageDialog(frame, "Token already existed in table."); + JOptionPane.showMessageDialog(this, "Token already existed in table."); return true; } Long tokenValue = Long.decode(model.getValueAt(i, 1)+""); if (tokenValue.equals(inputToken)) { - JOptionPane.showMessageDialog(frame, "Same token value already existed in table."); + JOptionPane.showMessageDialog(this, "Same token value already existed in table."); return true; } @@ -1084,7 +1084,7 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private boolean checkValidUsage(boolean[] b) { if (!(b[0] || b[1] || b[2] || b[3] || b[4])){ - JOptionPane.showMessageDialog(frame, "You must specify at least one usage."); + JOptionPane.showMessageDialog(this, "You must specify at least one usage."); return false; } return true; @@ -1092,20 +1092,20 @@ public class SpdPcdDefs extends IInternalFrame implements TableModelListener{ private boolean dataValidation(Object[] row) throws Exception{ if (!DataValidation.isC_NameType(row[0].toString())) { - JOptionPane.showMessageDialog(frame, "C_Name is NOT C_NameType."); + JOptionPane.showMessageDialog(this, "C_Name is NOT C_NameType."); return false; } if (!DataValidation.isHexDoubleWordDataType(row[1].toString()) && !DataValidation.isLongInt(row[1].toString(), 1, Long.MAX_VALUE)) { - JOptionPane.showMessageDialog(frame, "Token is NOT correct."); + JOptionPane.showMessageDialog(this, "Token is NOT correct."); return false; } if (!DataValidation.isC_NameType(row[2].toString())) { - JOptionPane.showMessageDialog(frame, "Token Space is NOT C_NameType"); + JOptionPane.showMessageDialog(this, "Token Space is NOT C_NameType"); return false; } if (row[5].toString().length() == 0) { - JOptionPane.showMessageDialog(frame, "HelpText could NOT be empty."); + JOptionPane.showMessageDialog(this, "HelpText could NOT be empty."); return false; } return true; diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java index d03b2fdd3a..e0b96319a7 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPpiDecls.java @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ package org.tianocore.frameworkwizard.packaging.ui; +import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; @@ -32,24 +33,25 @@ public class SpdPpiDecls extends SpdGuidDecls { */ private static final long serialVersionUID = 1L; private SpdFileContents sfc = null; - private OpeningPackageType docConsole = null; + private OpeningPackageType docConsole = null; +// private JFrame topFrame = null; - public SpdPpiDecls() { - super(); + public SpdPpiDecls(JFrame frame) { + super(frame); // TODO Auto-generated constructor stub } - public SpdPpiDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) { - this(); + public SpdPpiDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) { + this(frame); sfc = new SpdFileContents(inPsa); init(sfc); } - public SpdPpiDecls(OpeningPackageType opt) { - this(opt.getXmlSpd()); + public SpdPpiDecls(OpeningPackageType opt, JFrame frame) { + this(opt.getXmlSpd(), frame); docConsole = opt; if (sfc.getSpdPkgDefsRdOnly().equals("true")) { - JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table."); + JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table."); } initFrame(); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java index 99ed418d1a..1c4c0cf269 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdProtocolDecls.java @@ -12,6 +12,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ package org.tianocore.frameworkwizard.packaging.ui; +import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; @@ -34,22 +35,22 @@ public class SpdProtocolDecls extends SpdGuidDecls { private SpdFileContents sfc = null; private OpeningPackageType docConsole = null; - public SpdProtocolDecls() { - super(); + public SpdProtocolDecls(JFrame frame) { + super(frame); // TODO Auto-generated constructor stub } - public SpdProtocolDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa) { - this(); + public SpdProtocolDecls(PackageSurfaceAreaDocument.PackageSurfaceArea inPsa, JFrame frame) { + this(frame); sfc = new SpdFileContents(inPsa); init(sfc); } - public SpdProtocolDecls(OpeningPackageType opt) { - this(opt.getXmlSpd()); + public SpdProtocolDecls(OpeningPackageType opt, JFrame frame) { + this(opt.getXmlSpd(), frame); docConsole = opt; if (sfc.getSpdPkgDefsRdOnly().equals("true")) { - JOptionPane.showMessageDialog(frame, "This is a read-only package. You will not be able to edit contents in table."); + JOptionPane.showMessageDialog(this, "This is a read-only package. You will not be able to edit contents in table."); } initFrame(); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java index 0bdcfc8a9d..feddaeeb71 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdBuildOptions.java @@ -28,7 +28,6 @@ import java.awt.event.ComponentEvent; import javax.swing.DefaultCellEditor; import javax.swing.JFileChooser; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JButton; @@ -48,6 +47,7 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import org.tianocore.PlatformSurfaceAreaDocument; +import org.tianocore.frameworkwizard.FrameworkWizardUI; import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; @@ -112,8 +112,6 @@ public class FpdBuildOptions extends IInternalFrame { private static final long serialVersionUID = 1L; - static JFrame frame; - private JPanel jContentPane = null; // private JPanel jPanelContentSouth = null; @@ -1183,7 +1181,7 @@ public class FpdBuildOptions extends IInternalFrame { String[] row = { "Compress" }; sectionsTableModel.addRow(row); ffc.genBuildOptionsFfsSectionsSections(jTableFfs.getSelectedRow(), ""); - JOptionPane.showMessageDialog(frame, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry."); + JOptionPane.showMessageDialog(FpdBuildOptions.this, "Add Default Section Type EFI_SECTION_PE32 into the New Sections Entry."); jTableFfsSections.changeSelection(sectionsTableModel.getRowCount()-1, 0, false, false); } }); @@ -1830,9 +1828,9 @@ public class FpdBuildOptions extends IInternalFrame { vArch.add("EBC"); vArch.add("ARM"); vArch.add("PPC"); - jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch)); + jTableOptions.getColumnModel().getColumn(2).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance())); - jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor()); + jTableOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance())); jTableOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); @@ -1964,13 +1962,13 @@ public class FpdBuildOptions extends IInternalFrame { chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - int retval = chooser.showOpenDialog(frame); + int retval = chooser.showOpenDialog(FpdBuildOptions.this); 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!"); + JOptionPane.showMessageDialog(FpdBuildOptions.this, "You can only select files in current package!"); return; } } else { @@ -2103,7 +2101,7 @@ public class FpdBuildOptions extends IInternalFrame { public void actionPerformed(ActionEvent e) { if (!DataValidation.isInt(jTextFieldAntTaskId.getText()) || jTextFieldAntTaskId.getText().length() != 8) { - JOptionPane.showMessageDialog(frame, "ID must be an 8-digit integer."); + JOptionPane.showMessageDialog(FpdBuildOptions.this, "ID must be an 8-digit integer."); return; } Object[] o = { jTextFieldAntTaskId.getText(), null, null }; diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java index af164d7032..0561728848 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java @@ -17,13 +17,13 @@ import javax.swing.JPanel; import javax.swing.AbstractAction; import javax.swing.JFileChooser; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTabbedPane; import javax.swing.JButton; import javax.swing.ListSelectionModel; import org.tianocore.PlatformSurfaceAreaDocument; +import org.tianocore.frameworkwizard.FrameworkWizardUI; import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.IDefaultTableModel; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; @@ -77,7 +77,6 @@ public class FpdFlash extends IInternalFrame { */ private static final long serialVersionUID = 1L; private final int startIndexOfDynamicTab = 2; - static JFrame frame; private JPanel jContentPane = null; private JPanel jPanelContentEast = null; private JPanel jPanelContentSouth = null; @@ -203,7 +202,7 @@ public class FpdFlash extends IInternalFrame { docConsole = opt; if (memModified) { docConsole.setSaved(false); - JOptionPane.showMessageDialog(frame, "Platform Synced with FDF file."); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Platform Synced with FDF file."); memModified = false; } } @@ -1117,13 +1116,13 @@ public class FpdFlash extends IInternalFrame { JFileChooser chooser = new JFileChooser(wsDir); chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - int retval = chooser.showOpenDialog(frame); + int retval = chooser.showOpenDialog(FpdFlash.this); if (retval == JFileChooser.APPROVE_OPTION) { File theFile = chooser.getSelectedFile(); String filePath = theFile.getPath(); if (!filePath.startsWith(wsDir)) { - JOptionPane.showMessageDialog(frame, "You can only select files in current WORKSPACE."); + JOptionPane.showMessageDialog(FpdFlash.this, "You can only select files in current WORKSPACE."); return; } jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/')); @@ -1184,7 +1183,7 @@ public class FpdFlash extends IInternalFrame { getFvInfoFromFdf(fdfPath, vFvInfo); getFlashInfoFromFdf (fdfPath); if (!erasePolarity.equals("1") && !erasePolarity.equals("0")) { - JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid Erase Polarity."); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "FDF file does NOT contain valid Erase Polarity."); } else { ffc.setTypedFvImageNameValue("Attributes", "EFI_ERASE_POLARITY", erasePolarity); @@ -1196,7 +1195,7 @@ public class FpdFlash extends IInternalFrame { if (vBlockSize.size() > 0) { blkSize = vBlockSize.get(0); if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) { - JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used."); + JOptionPane.showMessageDialog(FpdFlash.this, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used."); blkSize = defaultBlkSize; } } @@ -1252,7 +1251,7 @@ public class FpdFlash extends IInternalFrame { } } catch (NumberFormatException e){ - JOptionPane.showMessageDialog(frame, e.getMessage()); + JOptionPane.showMessageDialog(FpdFlash.this, e.getMessage()); } } @@ -1787,7 +1786,7 @@ public class FpdFlash extends IInternalFrame { return; } if (fvNameExists(newFvName)) { - JOptionPane.showMessageDialog(frame, "This FV already exists. Please choose another FV name."); + JOptionPane.showMessageDialog(FpdFlash.this, "This FV already exists. Please choose another FV name."); m.setValueAt(oldFvName, row, 0); return; } @@ -1819,7 +1818,7 @@ public class FpdFlash extends IInternalFrame { if (col == 1 && !sizeFromOptionDlg) { String fvSize = m.getValueAt(row, col) + ""; if (!DataValidation.isInt(fvSize) && !DataValidation.isHexDoubleWordDataType(fvSize)) { - JOptionPane.showMessageDialog(frame, "FV size should be Integer or Hex format."); + JOptionPane.showMessageDialog(FpdFlash.this, "FV size should be Integer or Hex format."); return; } HashMap mFvOpts = new HashMap(); @@ -1840,7 +1839,7 @@ public class FpdFlash extends IInternalFrame { } else { if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) { - int retVal = JOptionPane.showConfirmDialog(frame, "Confirm", "FPD file contains error block size format. Would you like to replace it with a default value?", JOptionPane.YES_NO_OPTION); + int retVal = JOptionPane.showConfirmDialog(FpdFlash.this, "Confirm", "FPD file contains error block size format. Would you like to replace it with a default value?", JOptionPane.YES_NO_OPTION); if (retVal == JOptionPane.YES_OPTION) { ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", defaultBlkSize, null); int fs = Integer.decode(fvSize); @@ -2029,11 +2028,11 @@ public class FpdFlash extends IInternalFrame { boolean numOfBlockWellFormat = true; if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) { blockSizeWellFormat = false; - JOptionPane.showMessageDialog(frame, fvName + " block size bad format."); + JOptionPane.showMessageDialog(FpdFlash.this, fvName + " block size bad format."); } if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) { numOfBlockWellFormat = false; - JOptionPane.showMessageDialog(frame, fvName + " number of blocks bad format."); + JOptionPane.showMessageDialog(FpdFlash.this, fvName + " number of blocks bad format."); } if (blockSizeWellFormat && numOfBlockWellFormat) { int size = Integer.decode(bSize); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java index 9e4df720b0..9e2aa0cb12 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFrameworkModules.java @@ -18,7 +18,6 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FontMetrics; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JSplitPane; @@ -32,6 +31,7 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import org.tianocore.PlatformSurfaceAreaDocument; +import org.tianocore.frameworkwizard.FrameworkWizardUI; import org.tianocore.frameworkwizard.common.GlobalData; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; import org.tianocore.frameworkwizard.common.ui.IInternalFrame; @@ -65,8 +65,6 @@ public class FpdFrameworkModules extends IInternalFrame { public static final int forceDbgColForFpdModTable = 7; - static JFrame frame; - private JSplitPane jSplitPane = null; private JPanel jPanelTop = null; @@ -394,7 +392,7 @@ public class FpdFrameworkModules extends IInternalFrame { vArchs = WorkspaceProfile.getModuleSupArchs(mi); if (vArchs == null) { - JOptionPane.showMessageDialog(frame, "No Supported Architectures specified in MSA file."); + JOptionPane.showMessageDialog(this, "No Supported Architectures specified in MSA file."); return; } @@ -402,7 +400,7 @@ public class FpdFrameworkModules extends IInternalFrame { ffc.getPlatformDefsSupportedArchs(platformSupArch); platformSupArch.retainAll(vArchs); if (platformSupArch.size() == 0) { - JOptionPane.showMessageDialog(frame, "This Module does not support this platform architectures."); + JOptionPane.showMessageDialog(this, "This Module does not support this platform architectures."); return; } @@ -446,7 +444,7 @@ public class FpdFrameworkModules extends IInternalFrame { // Archs this Module supported have already been added. // if (vArchs.size() == 0) { - JOptionPane.showMessageDialog(frame, "This Module has already been added."); + JOptionPane.showMessageDialog(this, "This Module has already been added."); return; } //ToDo put Arch instead of null @@ -474,7 +472,7 @@ public class FpdFrameworkModules extends IInternalFrame { //ToDo : specify archs need to add. ffc.addFrameworkModulesPcdBuildDefs(mi, arch, null); } catch (Exception exception) { - JOptionPane.showMessageDialog(frame, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch + JOptionPane.showMessageDialog(this, "Adding " + row[modNameColForFpdModTable] + " with Supporting Architectures: " + arch + ": " + exception.getMessage()); errorOccurred = true; } @@ -486,7 +484,7 @@ public class FpdFrameworkModules extends IInternalFrame { } else { s += " was added Successfully."; } - JOptionPane.showMessageDialog(frame, s); + JOptionPane.showMessageDialog(this, s); TableSorter sorterFpdModules = (TableSorter)jTableFpdModules.getModel(); int viewIndex = sorterFpdModules.getViewIndexArray()[modelFpdModules.getRowCount() - 1]; jTableFpdModules.changeSelection(viewIndex, 0, false, false); @@ -776,7 +774,7 @@ public class FpdFrameworkModules extends IInternalFrame { ffc.removeModuleSA(selectedRow); } catch (Exception exp) { - JOptionPane.showMessageDialog(frame, exp.getMessage()); + JOptionPane.showMessageDialog(FpdFrameworkModules.this, exp.getMessage()); return; } @@ -857,7 +855,7 @@ public class FpdFrameworkModules extends IInternalFrame { docConsole = opt; Vector vExceptions = new Vector(); if (pcdSync(vExceptions)) { - JOptionPane.showMessageDialog(frame, "PCD in this platform are synchronized with those in MSA files."); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "PCD in this platform are synchronized with those in MSA files."); docConsole.setSaved(false); } if (vExceptions.size() > 0) { @@ -865,7 +863,7 @@ public class FpdFrameworkModules extends IInternalFrame { for (int i = 0; i < vExceptions.size(); ++i) { errorMsg += " " + vExceptions.get(i) + "\n"; } - JOptionPane.showMessageDialog(frame, "Error occurred during synchronization:\n" + errorMsg); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Error occurred during synchronization:\n" + errorMsg); } } @@ -897,7 +895,7 @@ public class FpdFrameworkModules extends IInternalFrame { try { row[pathColForFpdModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1); } catch (Exception e) { - JOptionPane.showMessageDialog(frame, "Show FPD Modules:" + e.getMessage()); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show FPD Modules:" + e.getMessage()); } String fpdMsaKey = saa[i][ffcModGuid] + row[modVerColForFpdModTable] @@ -964,7 +962,7 @@ public class FpdFrameworkModules extends IInternalFrame { try { s[pathColForAllModTable] = mi.getPath().substring(Workspace.getCurrentWorkspace().length() + 1); } catch (Exception e) { - JOptionPane.showMessageDialog(frame, "Show All Modules:" + e.getMessage()); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Show All Modules:" + e.getMessage()); } modelAllModules.addRow(s); miList.add(mi); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java index 186daa44db..b91f0c8f03 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFvOptions.java @@ -36,6 +36,7 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.JButton; +import org.tianocore.frameworkwizard.FrameworkWizardUI; import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType; /** @@ -69,7 +70,7 @@ public class FpdFvOptions extends JDialog { * This is the default constructor */ public FpdFvOptions(String name, DefaultTableModel tm, FpdFileContents ffc, OpeningPlatformType dc) { - super(); + super(FrameworkWizardUI.getInstance()); fvName = name; this.ffc = ffc; this.docConsole = dc; diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java index 06a376bfc5..516b063d66 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdHeader.java @@ -23,7 +23,6 @@ import java.awt.event.FocusEvent; import java.util.Vector; import javax.swing.JButton; -import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -100,7 +99,6 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ /// private static final long serialVersionUID = -8152099582923006900L; - static JFrame frame; // //Define class members // @@ -187,7 +185,7 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ jTextFieldBaseName.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { if (!DataValidation.isUiNameType(jTextFieldBaseName.getText())) { - JOptionPane.showMessageDialog(frame, "Package Name does not match the UiNameType datatype."); + JOptionPane.showMessageDialog(FpdHeader.this, "Package Name does not match the UiNameType datatype."); return; } if (jTextFieldBaseName.getText().equals(ffc.getFpdHdrPlatformName())) { @@ -215,7 +213,7 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ jTextFieldGuid.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { if (!DataValidation.isGuid(jTextFieldGuid.getText())) { - JOptionPane.showMessageDialog(frame, "Guid must be in registry (8-4-4-4-12) format."); + JOptionPane.showMessageDialog(FpdHeader.this, "Guid must be in registry (8-4-4-4-12) format."); return; } if (jTextFieldGuid.getText().equals(ffc.getFpdHdrGuidValue())) { @@ -243,7 +241,7 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ jTextFieldVersion.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { if (!DataValidation.isVersion(jTextFieldVersion.getText())) { - JOptionPane.showMessageDialog(frame, "Version does not match the Version datatype."); + JOptionPane.showMessageDialog(FpdHeader.this, "Version does not match the Version datatype."); return; } if (jTextFieldVersion.getText().equals(ffc.getFpdHdrVer())) { @@ -287,7 +285,7 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ jTextAreaLicense.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { if (jTextAreaLicense.getText().length() == 0) { - JOptionPane.showMessageDialog(frame, "License must be entered!"); + JOptionPane.showMessageDialog(FpdHeader.this, "License must be entered!"); return; } if (jTextAreaLicense.getText().equals(ffc.getFpdHdrLicense())) { @@ -314,7 +312,7 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ jTextAreaDescription.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { if (jTextAreaDescription.getText().length() == 0) { - JOptionPane.showMessageDialog(frame, "Description must be entered."); + JOptionPane.showMessageDialog(FpdHeader.this, "Description must be entered."); return; } if (jTextAreaDescription.getText().equals(ffc.getFpdHdrDescription())) { @@ -432,7 +430,7 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ jTextFieldAbstract.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { if (!DataValidation.isAbstract(jTextFieldAbstract.getText())) { - JOptionPane.showMessageDialog(frame, "Abstract must be entered."); + JOptionPane.showMessageDialog(FpdHeader.this, "Abstract must be entered."); return; } if (jTextFieldAbstract.getText().equals(ffc.getFpdHdrAbs())) { @@ -470,7 +468,7 @@ public class FpdHeader extends IInternalFrame implements DocumentListener{ jCopyrightTextArea.addFocusListener(new FocusAdapter(){ public void focusLost(FocusEvent e) { if (!DataValidation.isCopyright(jCopyrightTextArea.getText())) { - JOptionPane.showMessageDialog(frame, "Copyright must be entered."); + JOptionPane.showMessageDialog(FpdHeader.this, "Copyright must be entered."); return; } if (jCopyrightTextArea.getText().equals(ffc.getFpdHdrCopyright())) { diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java index fc715516ed..1eefec03b8 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdModuleSA.java @@ -4,7 +4,6 @@ import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.Toolkit; -import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JDialog; @@ -24,6 +23,7 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableModel; +import org.tianocore.frameworkwizard.FrameworkWizardUI; import org.tianocore.frameworkwizard.common.DataValidation; import org.tianocore.frameworkwizard.common.GlobalData; import org.tianocore.frameworkwizard.common.IDefaultTableModel; @@ -53,7 +53,6 @@ public class FpdModuleSA extends JDialog implements ActionListener { * */ private static final long serialVersionUID = 1L; - static JFrame frame; private JPanel jContentPane = null; private JTabbedPane jTabbedPane = null; private JPanel jPanelPcd = null; @@ -142,7 +141,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { * This is the default constructor */ public FpdModuleSA() { - super(); + super(FrameworkWizardUI.getInstance()); initialize(); } public FpdModuleSA(FpdFileContents ffc) { @@ -208,7 +207,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { } catch (Exception e) { String exceptionMsg = e.getCause() + " " + e.getMessage(); errorMsg.add(exceptionMsg); - JOptionPane.showMessageDialog(frame, exceptionMsg); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), exceptionMsg); } // // display lib instances already selected for key @@ -236,7 +235,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { } catch (Exception e) { String exceptionMsg = e.getCause() + " " + e.getMessage(); if (!errorMsg.contains(exceptionMsg)) { - JOptionPane.showMessageDialog(frame, e.getCause() + " " + e.getMessage()); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), e.getCause() + " " + e.getMessage()); } } selectedInstancesTableModel.addRow(saa[i]); @@ -249,7 +248,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { for (int i = 0; i < errorMsg.size(); ++i) { errors += " " + errorMsg.get(i) + "\n"; } - JOptionPane.showMessageDialog(frame, errors); + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), errors); } showClassToResolved(); } @@ -767,7 +766,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(model.getValueAt(selectedRow, 6)+"")+""); } catch(Exception except){ - JOptionPane.showMessageDialog(frame, "Unacceptable PCD Value: " + except.getMessage()); + JOptionPane.showMessageDialog(FpdModuleSA.this, "Unacceptable PCD Value: " + except.getMessage()); } } else{ @@ -1198,7 +1197,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { addLibInstance (libMi); } catch (Exception exception) { - JOptionPane.showMessageDialog(frame, "Adding Instance " + libMi.getName() + " : \n"+ exception.getMessage()); + JOptionPane.showMessageDialog(FpdModuleSA.this, "Adding Instance " + libMi.getName() + " : \n"+ exception.getMessage()); return; } docConsole.setSaved(false); @@ -1212,7 +1211,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { resolveLibraryInstances(instanceValue, errorMsg); } catch (Exception exp) { - JOptionPane.showMessageDialog(frame, exp.getMessage()); + JOptionPane.showMessageDialog(FpdModuleSA.this, exp.getMessage()); } if (errorMsg.size() > 0) { @@ -1220,7 +1219,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { for (int i = 0; i < errorMsg.size(); ++i) { errors += " " + errorMsg.get(i) + "\n"; } - JOptionPane.showMessageDialog(frame, errors); + JOptionPane.showMessageDialog(FpdModuleSA.this, errors); } showClassToResolved(); } @@ -1414,7 +1413,7 @@ public class FpdModuleSA extends JDialog implements ActionListener { } if (newFileGuid.length() > 0) { if (!DataValidation.isGuid(newFileGuid)) { - JOptionPane.showMessageDialog(frame, "FFS File Guid is NOT GUID Type."); + JOptionPane.showMessageDialog(FpdModuleSA.this, "FFS File Guid is NOT GUID Type."); return; } } @@ -1509,9 +1508,9 @@ public class FpdModuleSA extends JDialog implements ActionListener { vArch.add("EBC"); vArch.add("ARM"); vArch.add("PPC"); - jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch)); + jTableModuleSaOptions.getColumnModel().getColumn(4).setCellEditor(new ListEditor(vArch, FrameworkWizardUI.getInstance())); - jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor()); + jTableModuleSaOptions.getColumnModel().getColumn(5).setCellEditor(new LongTextEditor(FrameworkWizardUI.getInstance())); jTableModuleSaOptions.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); jTableModuleSaOptions.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_OFF); @@ -1761,7 +1760,7 @@ private void pcdNonDynamicToDynamic(String cName, String tsGuid) { ffc.addDynamicPcdBuildData(cName, model.getValueAt(jTablePcd.getSelectedRow(), 3), tsGuid, "DYNAMIC", model.getValueAt(jTablePcd.getSelectedRow(), 5)+"", jTextFieldPcdDefault.isVisible() ? jTextFieldPcdDefault.getText() : jComboBoxFeatureFlagValue.getSelectedItem()+""); } catch(Exception e){ - JOptionPane.showMessageDialog(frame, "PCD value format: " + e.getMessage()); + JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD value format: " + e.getMessage()); } } @@ -1848,7 +1847,7 @@ private JButton getJButtonUpdatePcd() { jTextFieldMaxDatumSize.setText(ffc.setMaxSizeForPointer(newValue)+""); } catch (Exception exp) { - JOptionPane.showMessageDialog(frame, "PCD Value MalFormed: " + exp.getMessage()); + JOptionPane.showMessageDialog(FpdModuleSA.this, "PCD Value MalFormed: " + exp.getMessage()); return; } } @@ -1859,12 +1858,12 @@ private JButton getJButtonUpdatePcd() { try { boolean changable = itemTypeCouldBeChanged (cName, tsGuid, newItemType, moduleInfo); if (!changable) { - JOptionPane.showMessageDialog(frame, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName()); + JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName()); return; } } catch (Exception exp) { - JOptionPane.showMessageDialog(frame, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName() + " " + exp.getMessage()); + JOptionPane.showMessageDialog(FpdModuleSA.this, "Can NOT Change Pcd Type in: " + moduleInfo.get(0).getName() + " contained in package " + moduleInfo.get(0).getPackageId().getName() + " " + exp.getMessage()); return; } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java index 5f1e76de38..c87f466bdd 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdPlatformDefs.java @@ -15,7 +15,6 @@ package org.tianocore.frameworkwizard.platform.ui; import java.awt.BorderLayout; import javax.swing.JPanel; -import javax.swing.JFrame; import javax.swing.JTabbedPane; import javax.swing.JButton; import javax.swing.ListSelectionModel; @@ -105,8 +104,6 @@ public class FpdPlatformDefs extends IInternalFrame { private final int tableWidth = valueWidth; - static JFrame frame; - private JPanel jContentPane = null; private JTabbedPane jTabbedPane = null; @@ -473,7 +470,7 @@ public class FpdPlatformDefs extends IInternalFrame { Vector v = new Vector(); getSupportedArchitectures(v); if (v.size() == 0) { - JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture."); + JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture."); jCheckBoxIa32.setSelected(true); return; } @@ -499,7 +496,7 @@ public class FpdPlatformDefs extends IInternalFrame { Vector v = new Vector(); getSupportedArchitectures(v); if (v.size() == 0) { - JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture."); + JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture."); jCheckBoxX64.setSelected(true); return; } @@ -525,7 +522,7 @@ public class FpdPlatformDefs extends IInternalFrame { Vector v = new Vector(); getSupportedArchitectures(v); if (v.size() == 0) { - JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture."); + JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture."); jCheckBoxIpf.setSelected(true); return; } @@ -553,7 +550,7 @@ public class FpdPlatformDefs extends IInternalFrame { Vector v = new Vector(); getSupportedArchitectures(v); if (v.size() == 0) { - JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture."); + JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture."); jCheckBoxEbc.setSelected(true); return; } @@ -581,7 +578,7 @@ public class FpdPlatformDefs extends IInternalFrame { Vector v = new Vector(); getSupportedArchitectures(v); if (v.size() == 0) { - JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture."); + JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture."); jCheckBoxArm.setSelected(true); return; } @@ -609,7 +606,7 @@ public class FpdPlatformDefs extends IInternalFrame { Vector v = new Vector(); getSupportedArchitectures(v); if (v.size() == 0) { - JOptionPane.showMessageDialog(frame, "Platform must support at least ONE Architecture."); + JOptionPane.showMessageDialog(FpdPlatformDefs.this, "Platform must support at least ONE Architecture."); jCheckBoxPpc.setSelected(true); return; } @@ -740,7 +737,7 @@ public class FpdPlatformDefs extends IInternalFrame { return; } if (jTableBuildTargets.getRowCount() == 1) { - JOptionPane.showMessageDialog(frame, "At least one build target should be set for this platform."); + JOptionPane.showMessageDialog(FpdPlatformDefs.this, "At least one build target should be set for this platform."); return; } buildTargetTableModel.removeRow(jTableBuildTargets.getSelectedRow()); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java index f4894a3601..ef918f0cd7 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenListDialog.java @@ -17,6 +17,7 @@ import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JComponent; +import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JDialog; import javax.swing.KeyStroke; @@ -181,13 +182,13 @@ public class GenListDialog extends JDialog implements ActionListener{ /** * This is the default constructor */ - public GenListDialog() { - super(); + public GenListDialog(JFrame frame) { + super(frame); initialize(); } - public GenListDialog(ActionListener i){ - this(); + public GenListDialog(ActionListener i, JFrame frame){ + this(frame); jButtonOk.addActionListener(i); jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java index e8aafa7249..856e227180 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/GenLongTextDialog.java @@ -17,6 +17,7 @@ import java.awt.Dimension; import java.awt.Toolkit; import javax.swing.JComponent; +import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JDialog; import javax.swing.JTextArea; @@ -166,13 +167,13 @@ public class GenLongTextDialog extends JDialog implements ActionListener{ /** * This is the default constructor */ - public GenLongTextDialog() { - super(); + public GenLongTextDialog(JFrame frame) { + super(frame); initialize(); } - public GenLongTextDialog(ActionListener i){ - this(); + public GenLongTextDialog(ActionListener i, JFrame frame){ + this(frame); jButtonOk.addActionListener(i); jButtonOk.registerKeyboardAction(i, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false), JComponent.WHEN_FOCUSED); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java index 729af57e22..804dc605f4 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/ListEditor.java @@ -37,26 +37,26 @@ public class ListEditor extends AbstractCellEditor implements TableCellEditor, A */ private static final long serialVersionUID = 1L; private boolean canNotBeEmpty = false; + private JFrame topFrame = null; String archs; JButton button; - static JFrame frame; GenListDialog dialog; protected static final String EDIT = "edit"; - public ListEditor() { - + public ListEditor(JFrame frame) { + topFrame = frame; button = new JButton(); button.setActionCommand(EDIT); button.addActionListener(this); button.setBorderPainted(false); - dialog = new GenListDialog(this); + dialog = new GenListDialog(this, frame); } - public ListEditor(Vector v) { - this(); + public ListEditor(Vector v, JFrame frame) { + this(frame); dialog.initList(v); } @@ -95,7 +95,7 @@ public class ListEditor extends AbstractCellEditor implements TableCellEditor, A else { //User pressed dialog's "OK" button. Vector v = dialog.getList(); if (canNotBeEmpty && v.size() == 0) { - JOptionPane.showMessageDialog(frame, "You must select at least one item."); + JOptionPane.showMessageDialog(topFrame, "You must select at least one item."); return; } String s = " "; diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java index 3d84dce4d2..6e89ba7334 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/LongTextEditor.java @@ -36,18 +36,17 @@ public class LongTextEditor extends AbstractCellEditor implements TableCellEdito private static final long serialVersionUID = 1L; String text; JButton button; - static JFrame frame; GenLongTextDialog dialog; protected static final String EDIT = "editLongText"; - public LongTextEditor() { + public LongTextEditor(JFrame frame) { button = new JButton(); button.setActionCommand(EDIT); button.addActionListener(this); button.setBorderPainted(false); - dialog = new GenLongTextDialog(this); + dialog = new GenLongTextDialog(this, frame); } diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java index 17e5afe7dd..0c23b6a854 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/Preferences.java @@ -30,7 +30,6 @@ import java.util.Scanner; import javax.swing.*; import javax.swing.JScrollPane; import javax.swing.JTextField; -import javax.swing.JFrame; import org.tianocore.frameworkwizard.common.GlobalData; import org.tianocore.frameworkwizard.common.Tools; @@ -98,8 +97,6 @@ public class Preferences extends IFrame { private WorkspaceTools wt = new WorkspaceTools(); - private JFrame frame; - private final int activePlatformId = 0; private final int buildTargetId = 1; @@ -467,13 +464,13 @@ public class Preferences extends IFrame { chooser.setMultiSelectionEnabled(false); chooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - int retval = chooser.showOpenDialog(frame); + int retval = chooser.showOpenDialog(Preferences.this); 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 the Tools" + JOptionPane.showMessageDialog(Preferences.this, "You can only select files in the Tools" + System.getProperty("file.separator") + "Conf directory!"); diff --git a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java index f92f73e68e..b331af363e 100644 --- a/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java +++ b/Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/toolchain/ToolChainId.java @@ -21,6 +21,7 @@ import java.util.ArrayList; import javax.swing.JOptionPane; +import org.tianocore.frameworkwizard.FrameworkWizardUI; import org.tianocore.frameworkwizard.common.DataType; import org.tianocore.frameworkwizard.common.Tools; import org.tianocore.frameworkwizard.common.Log; @@ -222,7 +223,7 @@ public class ToolChainId { e.printStackTrace(); } } else { - JOptionPane.showMessageDialog(null, "" + "Tool Preferences file:
" + strTargetFile + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "" + "Tool Preferences file:
" + strTargetFile + "
does not exist!"); } } @@ -236,7 +237,7 @@ public class ToolChainId { toolsConfFile = Workspace.getCurrentWorkspace() + System.getProperty("file.separator") + resString.trim(); File toolsDefFile = new File(toolsConfFile); if (!toolsDefFile.exists()) { - JOptionPane.showMessageDialog(null, "" + "Tool Definition file, " + toolDefinitionFile + JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "" + "Tool Definition file, " + toolDefinitionFile + "
specified in the target.txt file does not exist!" + "
Using the default Tool Definition File:
" + defaultToolsConf);