]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/platform/ui/FpdFlash.java
Make opening dialogs re-gain focus when user switch back to main UI from other window...
[mirror_edk2.git] / Tools / Java / Source / FrameworkWizard / src / org / tianocore / frameworkwizard / platform / ui / FpdFlash.java
index af164d7032ed9f4506a53205a5033610c4e0f4c9..05617288485512b22c8b5f682eaffc484154f93c 100644 (file)
@@ -17,13 +17,13 @@ import javax.swing.JPanel;
 \r
 import javax.swing.AbstractAction;\r
 import javax.swing.JFileChooser;\r
-import javax.swing.JFrame;\r
 import javax.swing.JOptionPane;\r
 import javax.swing.JTabbedPane;\r
 import javax.swing.JButton;\r
 import javax.swing.ListSelectionModel;\r
 \r
 import org.tianocore.PlatformSurfaceAreaDocument;\r
+import org.tianocore.frameworkwizard.FrameworkWizardUI;\r
 import org.tianocore.frameworkwizard.common.DataValidation;\r
 import org.tianocore.frameworkwizard.common.IDefaultTableModel;\r
 import org.tianocore.frameworkwizard.common.Identifications.OpeningPlatformType;\r
@@ -77,7 +77,6 @@ public class FpdFlash extends IInternalFrame {
      */\r
     private static final long serialVersionUID = 1L;\r
     private final int startIndexOfDynamicTab = 2;\r
-    static JFrame frame;\r
     private JPanel jContentPane = null;\r
     private JPanel jPanelContentEast = null;\r
     private JPanel jPanelContentSouth = null;\r
@@ -203,7 +202,7 @@ public class FpdFlash extends IInternalFrame {
         docConsole = opt;\r
         if (memModified) {\r
             docConsole.setSaved(false);\r
-            JOptionPane.showMessageDialog(frame, "Platform Synced with FDF file.");\r
+            JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "Platform Synced with FDF file.");\r
             memModified = false;\r
         }\r
     }\r
@@ -1117,13 +1116,13 @@ public class FpdFlash extends IInternalFrame {
                     JFileChooser chooser = new JFileChooser(wsDir);\r
                     chooser.setMultiSelectionEnabled(false);\r
                     chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);\r
-                    int retval = chooser.showOpenDialog(frame);\r
+                    int retval = chooser.showOpenDialog(FpdFlash.this);\r
                     if (retval == JFileChooser.APPROVE_OPTION) {\r
 \r
                         File theFile = chooser.getSelectedFile();\r
                         String filePath = theFile.getPath();\r
                         if (!filePath.startsWith(wsDir)) {\r
-                            JOptionPane.showMessageDialog(frame, "You can only select files in current WORKSPACE.");\r
+                            JOptionPane.showMessageDialog(FpdFlash.this, "You can only select files in current WORKSPACE.");\r
                             return;\r
                         }\r
                         jTextFieldFdf.setText(filePath.substring(wsDir.length() + 1).replace('\\', '/'));\r
@@ -1184,7 +1183,7 @@ public class FpdFlash extends IInternalFrame {
         getFvInfoFromFdf(fdfPath, vFvInfo);\r
         getFlashInfoFromFdf (fdfPath);\r
         if (!erasePolarity.equals("1") && !erasePolarity.equals("0")) {\r
-            JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid Erase Polarity.");\r
+            JOptionPane.showMessageDialog(FrameworkWizardUI.getInstance(), "FDF file does NOT contain valid Erase Polarity.");\r
         }\r
         else {\r
             ffc.setTypedFvImageNameValue("Attributes", "EFI_ERASE_POLARITY", erasePolarity);\r
@@ -1196,7 +1195,7 @@ public class FpdFlash extends IInternalFrame {
         if (vBlockSize.size() > 0) {\r
             blkSize = vBlockSize.get(0);\r
             if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {\r
-                JOptionPane.showMessageDialog(frame, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used.");\r
+                JOptionPane.showMessageDialog(FpdFlash.this, "FDF file does NOT contain valid FV block size. Default size 0x10000 will be used.");\r
                 blkSize = defaultBlkSize;\r
             }\r
         }\r
@@ -1252,7 +1251,7 @@ public class FpdFlash extends IInternalFrame {
                 }\r
             }\r
             catch (NumberFormatException e){\r
-                JOptionPane.showMessageDialog(frame, e.getMessage());\r
+                JOptionPane.showMessageDialog(FpdFlash.this, e.getMessage());\r
             }\r
         }\r
 \r
@@ -1787,7 +1786,7 @@ public class FpdFlash extends IInternalFrame {
                                 return;\r
                             }\r
                             if (fvNameExists(newFvName)) {\r
-                                JOptionPane.showMessageDialog(frame, "This FV already exists. Please choose another FV name.");\r
+                                JOptionPane.showMessageDialog(FpdFlash.this, "This FV already exists. Please choose another FV name.");\r
                                 m.setValueAt(oldFvName, row, 0);\r
                                 return;\r
                             }\r
@@ -1819,7 +1818,7 @@ public class FpdFlash extends IInternalFrame {
                         if (col == 1 && !sizeFromOptionDlg) {\r
                             String fvSize = m.getValueAt(row, col) + "";\r
                             if (!DataValidation.isInt(fvSize) && !DataValidation.isHexDoubleWordDataType(fvSize)) {\r
-                                JOptionPane.showMessageDialog(frame, "FV size should be Integer or Hex format.");\r
+                                JOptionPane.showMessageDialog(FpdFlash.this, "FV size should be Integer or Hex format.");\r
                                 return;\r
                             }\r
                             HashMap<String, String> mFvOpts = new HashMap<String, String>();\r
@@ -1840,7 +1839,7 @@ public class FpdFlash extends IInternalFrame {
                             }\r
                             else {\r
                                 if (!DataValidation.isInt(blkSize) && !DataValidation.isHexDoubleWordDataType(blkSize)) {\r
-                                    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);\r
+                                    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);\r
                                     if (retVal == JOptionPane.YES_OPTION) {\r
                                         ffc.setTypedNamedFvImageNameValue(oldFvName, "Options", "EFI_BLOCK_SIZE", defaultBlkSize, null);\r
                                         int fs = Integer.decode(fvSize);\r
@@ -2029,11 +2028,11 @@ public class FpdFlash extends IInternalFrame {
             boolean numOfBlockWellFormat = true;\r
             if (!DataValidation.isHexDoubleWordDataType(bSize) && !DataValidation.isInt(bSize)) {\r
                blockSizeWellFormat = false;\r
-               JOptionPane.showMessageDialog(frame, fvName + " block size bad format.");\r
+               JOptionPane.showMessageDialog(FpdFlash.this, fvName + " block size bad format.");\r
             } \r
             if (!DataValidation.isHexDoubleWordDataType(numBlks) && !DataValidation.isInt(numBlks)) {\r
                numOfBlockWellFormat = false;\r
-               JOptionPane.showMessageDialog(frame, fvName + " number of blocks bad format.");\r
+               JOptionPane.showMessageDialog(FpdFlash.this, fvName + " number of blocks bad format.");\r
             }\r
             if (blockSizeWellFormat && numOfBlockWellFormat) {\r
                 int size = Integer.decode(bSize);\r