Bladeren bron

First run wizard is now application modal.

Fixes issue 3941

Change-Id: I24555abe550ab6ea477560deb9c19477f4ba37d3
Reviewed-on: http://gerrit.dmdirc.com/1091
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.6.4
Greboid 14 jaren geleden
bovenliggende
commit
b350bedaa8

+ 6
- 4
src/com/dmdirc/addons/ui_swing/SwingController.java Bestand weergeven

@@ -269,21 +269,23 @@ public final class SwingController extends Plugin implements Serializable,
269 269
     /** {@inheritDoc} */
270 270
     @Override
271 271
     public void showFirstRunWizard() {
272
-        showFirstRunWizard(true);
272
+        showFirstRunWizard(me, true);
273 273
     }
274 274
 
275 275
     /** {@inheritDoc} */
276 276
     @Override
277 277
     public void showMigrationWizard() {
278
-        showFirstRunWizard(false);
278
+        showFirstRunWizard(me, false);
279 279
     }
280 280
 
281 281
     /**
282 282
      * Shows a first run wizard, or a migration wizard.
283 283
      *
284
+     * @param parentWindow Parent window
284 285
      * @param firstRun First run?
285 286
      */
286
-    private synchronized void showFirstRunWizard(final boolean firstRun) {
287
+    private synchronized void showFirstRunWizard(
288
+            final java.awt.Window parentWindow, final boolean firstRun) {
287 289
         final Semaphore semaphore = new Semaphore(0);
288 290
         UIUtilities.invokeLater(new Runnable() {
289 291
 
@@ -305,7 +307,7 @@ public final class SwingController extends Plugin implements Serializable,
305 307
                     }
306 308
                 };
307 309
                 final SwingFirstRunWizard wizard =
308
-                        new SwingFirstRunWizard(firstRun);
310
+                        new SwingFirstRunWizard(parentWindow, firstRun);
309 311
                 wizard.getWizardDialog().addWizardListener(listener);
310 312
                 wizard.display();
311 313
             }

+ 4
- 2
src/com/dmdirc/addons/ui_swing/wizard/WizardDialog.java Bestand weergeven

@@ -57,10 +57,12 @@ public final class WizardDialog extends StandardDialog implements ActionListener
57 57
      * @param steps Steps for the wizard
58 58
      * @param wizard Wizard to inform of changes
59 59
      * @param parentWindow Parent component
60
+     * @param modality Modality
60 61
      */
61 62
     public WizardDialog(final String title, final List<Step> steps,
62
-            final WizardListener wizard, final Window parentWindow) {
63
-        super(parentWindow, ModalityType.MODELESS);
63
+            final WizardListener wizard, final Window parentWindow,
64
+            final ModalityType modality) {
65
+        super(parentWindow, modality);
64 66
 
65 67
         setTitle(title);
66 68
         setDefaultCloseOperation(DISPOSE_ON_CLOSE);

+ 14
- 7
src/com/dmdirc/addons/ui_swing/wizard/firstrun/SwingFirstRunWizard.java Bestand weergeven

@@ -39,8 +39,10 @@ import com.dmdirc.addons.ui_swing.wizard.WizardDialog;
39 39
 import com.dmdirc.addons.ui_swing.wizard.WizardListener;
40 40
 import com.dmdirc.ui.IconManager;
41 41
 import com.dmdirc.util.resourcemanager.ResourceManager;
42
+import java.awt.Dialog.ModalityType;
42 43
 
43 44
 import java.awt.Dimension;
45
+import java.awt.Window;
44 46
 import java.io.File;
45 47
 import java.io.IOException;
46 48
 import java.util.ArrayList;
@@ -56,22 +58,27 @@ public final class SwingFirstRunWizard implements WizardListener,
56 58
     /** First run or update. */
57 59
     private boolean firstRun = true;
58 60
 
59
-    /** Instatiate the wizard. */
60
-    public SwingFirstRunWizard() {
61
-        this(true);
61
+    /**
62
+     * Instatiate the wizard.
63
+     *
64
+     * @param parentWindow Parent window
65
+     */
66
+    public SwingFirstRunWizard(final Window parentWindow) {
67
+        this(parentWindow, true);
62 68
     }
63 69
 
64 70
     /**
65 71
      * Instantiate the wizard.
66 72
      *
73
+     * @param parentWindow Parent window
67 74
      * @param firstRun is this the first run or an update?
68 75
      */
69
-    public SwingFirstRunWizard(final boolean firstRun) {
76
+    public SwingFirstRunWizard(final Window parentWindow, final boolean firstRun) {
70 77
         this.firstRun = firstRun;
71 78
         
72
-        wizardDialog =
73
-                new WizardDialog("DMDirc: " + (firstRun ? "Setup wizard" :
74
-                    "Migration wizard"), new ArrayList<Step>(), this, null);
79
+        wizardDialog = new WizardDialog("DMDirc: " + (firstRun ? "Setup wizard" 
80
+                : "Migration wizard"), new ArrayList<Step>(), this, parentWindow,
81
+                ModalityType.APPLICATION_MODAL);
75 82
         wizardDialog.setIconImage(IconManager.getIconManager().getImage("icon"));
76 83
         wizardDialog.addWizardListener(this);
77 84
         if(Apple.isAppleUI()) {

Laden…
Annuleren
Opslaan