Browse Source

Adds StandardMessageDialog

Adds "blocking" code to StandardDialog
Adds a getResult message to StandardQuestionDialog
Removes all uses of JOptionPane from the swing UI

Fixes issue 3663

Change-Id: Id91412c262d4bb812ffbfe6eef72d8ca99cd40f0
Reviewed-on: http://gerrit.dmdirc.com/710
Automatic-Compile: Shane Mc Cormack <shane@dmdirc.com>
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3
Gregory Holmes 14 years ago
parent
commit
daddc85ff8

+ 66
- 42
src/com/dmdirc/addons/ui_swing/SwingController.java View File

@@ -38,6 +38,8 @@ import com.dmdirc.addons.ui_swing.components.statusbar.FeedbackNag;
38 38
 import com.dmdirc.addons.ui_swing.components.statusbar.SwingStatusBar;
39 39
 import com.dmdirc.addons.ui_swing.components.themepanel.ThemePanel;
40 40
 import com.dmdirc.addons.ui_swing.dialogs.DialogKeyListener;
41
+import com.dmdirc.addons.ui_swing.dialogs.StandardInputDialog;
42
+import com.dmdirc.addons.ui_swing.dialogs.StandardMessageDialog;
41 43
 import com.dmdirc.addons.ui_swing.dialogs.channelsetting.ChannelSettingsDialog;
42 44
 import com.dmdirc.addons.ui_swing.dialogs.error.ErrorListDialog;
43 45
 import com.dmdirc.addons.ui_swing.dialogs.prefs.SwingPreferencesDialog;
@@ -58,6 +60,7 @@ import com.dmdirc.config.prefs.PreferencesInterface;
58 60
 import com.dmdirc.config.prefs.PreferencesManager;
59 61
 import com.dmdirc.config.prefs.PreferencesSetting;
60 62
 import com.dmdirc.config.prefs.PreferencesType;
63
+import com.dmdirc.config.prefs.validator.NotEmptyValidator;
61 64
 import com.dmdirc.config.prefs.validator.NumericalValidator;
62 65
 import com.dmdirc.logger.ErrorLevel;
63 66
 import com.dmdirc.logger.Logger;
@@ -73,6 +76,7 @@ import com.dmdirc.ui.interfaces.UIController;
73 76
 import com.dmdirc.ui.interfaces.Window;
74 77
 import com.dmdirc.updater.Update;
75 78
 import com.dmdirc.util.ReturnableThread;
79
+import java.awt.Dialog.ModalityType;
76 80
 
77 81
 import java.awt.Font;
78 82
 import java.awt.GraphicsEnvironment;
@@ -86,7 +90,6 @@ import java.util.Map;
86 90
 import java.util.concurrent.Semaphore;
87 91
 
88 92
 import java.util.concurrent.atomic.AtomicBoolean;
89
-import javax.swing.JOptionPane;
90 93
 import javax.swing.SwingUtilities;
91 94
 import javax.swing.UIManager;
92 95
 import javax.swing.UIManager.LookAndFeelInfo;
@@ -163,7 +166,7 @@ public final class SwingController extends Plugin implements UIController {
163 166
 
164 167
     /**
165 168
      * Retrieves the Swing Status Bar used by this UI.
166
-     * 
169
+     *
167 170
      * @return This UI's status bar
168 171
      */
169 172
     public SwingStatusBar getSwingStatusBar() {
@@ -268,7 +271,7 @@ public final class SwingController extends Plugin implements UIController {
268 271
 
269 272
     /**
270 273
      * Shows a first run wizard, or a migration wizard.
271
-     * 
274
+     *
272 275
      * @param firstRun First run?
273 276
      */
274 277
     private synchronized void showFirstRunWizard(final boolean firstRun) {
@@ -373,20 +376,16 @@ public final class SwingController extends Plugin implements UIController {
373 376
             });
374 377
         } catch (ClassNotFoundException ex) {
375 378
             Logger.userError(ErrorLevel.LOW,
376
-                    "Unable to change Look and Feel: " +
377
-                    ex.getMessage());
379
+                    "Unable to change Look and Feel: " + ex.getMessage());
378 380
         } catch (InstantiationException ex) {
379 381
             Logger.userError(ErrorLevel.LOW,
380
-                    "Unable to change Look and Feel: " +
381
-                    ex.getMessage());
382
+                    "Unable to change Look and Feel: " + ex.getMessage());
382 383
         } catch (IllegalAccessException ex) {
383 384
             Logger.userError(ErrorLevel.LOW,
384
-                    "Unable to change Look and Feel: " +
385
-                    ex.getMessage());
385
+                    "Unable to change Look and Feel: " + ex.getMessage());
386 386
         } catch (UnsupportedLookAndFeelException ex) {
387 387
             Logger.userError(ErrorLevel.LOW,
388
-                    "Unable to change Look and Feel: " +
389
-                    ex.getMessage());
388
+                    "Unable to change Look and Feel: " + ex.getMessage());
390 389
         }
391 390
     }
392 391
 
@@ -439,8 +438,8 @@ public final class SwingController extends Plugin implements UIController {
439 438
 
440 439
     /**
441 440
      * {@inheritDoc}
442
-     * 
443
-     * @deprecated 
441
+     *
442
+     * @deprecated
444 443
      */
445 444
     @Override
446 445
     @Deprecated
@@ -450,8 +449,8 @@ public final class SwingController extends Plugin implements UIController {
450 449
 
451 450
     /**
452 451
      * {@inheritDoc}
453
-     * 
454
-     * @deprecated 
452
+     *
453
+     * @deprecated
455 454
      */
456 455
     @Override
457 456
     @Deprecated
@@ -516,8 +515,8 @@ public final class SwingController extends Plugin implements UIController {
516 515
             /** {@inheritDoc} */
517 516
             @Override
518 517
             public void run() {
519
-                JOptionPane.showMessageDialog(null, message, title,
520
-                        JOptionPane.PLAIN_MESSAGE);
518
+                new StandardMessageDialog(me, ModalityType.MODELESS, title,
519
+                        message).display();
521 520
             }
522 521
         });
523 522
     }
@@ -532,7 +531,29 @@ public final class SwingController extends Plugin implements UIController {
532 531
     /** {@inheritDoc} */
533 532
     @Override
534 533
     public String getUserInput(final String prompt) {
535
-        return JOptionPane.showInputDialog(prompt);
534
+        final StandardInputDialog dialog = new StandardInputDialog(me,
535
+                ModalityType.MODELESS, "Input required", prompt,
536
+                new NotEmptyValidator()) {
537
+
538
+            /**
539
+             * A version number for this class. It should be changed whenever the class
540
+             * structure is changed (or anything else that would prevent serialized
541
+             * objects being unserialized with the new class).
542
+             */
543
+            private static final long serialVersionUID = 1;
544
+
545
+            /** {@inheritDoc} */
546
+            @Override
547
+            public boolean save() {
548
+                return true;
549
+            }
550
+
551
+            /** {@inheritDoc} */
552
+            @Override
553
+            public void cancelled() {}
554
+        };
555
+        dialog.displayBlocking();
556
+        return dialog.getText();
536 557
     }
537 558
 
538 559
     /** {@inheritDoc} */
@@ -589,7 +610,7 @@ public final class SwingController extends Plugin implements UIController {
589 610
 
590 611
     /**
591 612
      * Returns the current look and feel.
592
-     * 
613
+     *
593 614
      * @return Current look and feel
594 615
      */
595 616
     public static String getLookAndFeel() {
@@ -628,10 +649,10 @@ public final class SwingController extends Plugin implements UIController {
628 649
         }
629 650
 
630 651
         if (System.getProperty("java.vm.name", "unknown").contains("OpenJDK")) {
631
-            JOptionPane.showMessageDialog(null, "OpenJDK has known graphical " +
632
-                    "issues and as such is unsupported by DMDirc.  Please " +
633
-                    "consider using the official JRE.", "Unsupported JRE",
634
-                    JOptionPane.WARNING_MESSAGE);
652
+            new StandardMessageDialog(me, ModalityType.MODELESS,
653
+                    "Unsupported JRE", "OpenJDK has known graphical "
654
+                    + "issues and as such is unsupported by DMDirc.  Please "
655
+                    + "consider using the official JRE.").display();
635 656
         }
636 657
 
637 658
         Main.setUI(this);
@@ -676,8 +697,8 @@ public final class SwingController extends Plugin implements UIController {
676 697
      */
677 698
     private PreferencesCategory createGeneralCategory() {
678 699
         final PreferencesCategory general = new PluginPreferencesCategory(
679
-                getPluginInfo(), "Swing UI", "These config options apply " +
680
-                "only to the swing UI.", "category-gui");
700
+                getPluginInfo(), "Swing UI", "These config options apply "
701
+                + "only to the swing UI.", "category-gui");
681 702
 
682 703
         final Map<String, String> lafs = new HashMap<String, String>();
683 704
         final Map<String, String> framemanagers = new HashMap<String, String>();
@@ -708,8 +729,8 @@ public final class SwingController extends Plugin implements UIController {
708 729
                 "Window manager", "Which window manager should be used?",
709 730
                 framemanagers).setRestartNeeded());
710 731
         general.addSetting(new PreferencesSetting("ui", "framemanagerPosition",
711
-                "Window manager position", "Where should the window " +
712
-                "manager be positioned?", fmpositions).setRestartNeeded());
732
+                "Window manager position", "Where should the window "
733
+                + "manager be positioned?", fmpositions).setRestartNeeded());
713 734
         general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
714 735
                 "ui", "stylelinks", "Style links", "Style links in text areas"));
715 736
         general.addSetting(new PreferencesSetting(PreferencesType.FONT,
@@ -740,8 +761,8 @@ public final class SwingController extends Plugin implements UIController {
740 761
 
741 762
         advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
742 763
                 new NumericalValidator(10, -1), "ui", "frameBufferSize",
743
-                "Window buffer size", "The maximum number of lines in a window" +
744
-                " buffer"));
764
+                "Window buffer size", "The maximum number of lines in a window"
765
+                + " buffer"));
745 766
         advanced.addSetting(new PreferencesSetting("ui", "mdiBarVisibility",
746 767
                 "MDI Bar Visibility", "Controls the visibility of the MDI bar",
747 768
                 options));
@@ -749,26 +770,29 @@ public final class SwingController extends Plugin implements UIController {
749 770
                 new PreferencesSetting(PreferencesType.BOOLEAN, "ui",
750 771
                 "useOneTouchExpandable", "Use one touch expandable split panes?",
751 772
                 "Use one touch expandable arrows for collapsing/expanding the split panes"));
752
-       advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(),
753
-               "windowMenuItems", "Window menu item count",
754
-               "Number of items to show in the window menu"));
755
-       advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER, getDomain(),
756
-               "windowMenuScrollInterval", "Window menu scroll interval",
757
-               "Number of milliseconds to pause when autoscrolling in the window menu"));
758
-       advanced.addSetting(
773
+        advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
774
+                getDomain(), "windowMenuItems", "Window menu item count",
775
+                "Number of items to show in the window menu"));
776
+        advanced.addSetting(
777
+                new PreferencesSetting(PreferencesType.INTEGER, getDomain(),
778
+                "windowMenuScrollInterval", "Window menu scroll interval",
779
+                "Number of milliseconds to pause when autoscrolling in the window menu"));
780
+        advanced.addSetting(
759 781
                 new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(),
760 782
                 "showtopicbar", "Show topic bar",
761 783
                 "Shows a graphical topic bar in channels."));
762
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(),
763
-               "shownicklist", "Show nicklist?", "Do you want the nicklist visible"));
784
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
785
+                getDomain(),
786
+                "shownicklist", "Show nicklist?",
787
+                "Do you want the nicklist visible"));
764 788
         //TODO issue 3251
765 789
         //advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, getDomain(),
766 790
         //       "showfulltopic", "Show full topic in topic bar?",
767 791
         //       "Do you want to show the full topic in the topic bar or just" +
768 792
         //       "first line?"));
769
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN, 
793
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
770 794
                 getDomain(), "hideEmptyTopicBar", "Hide empty topic bar?",
771
-               "Do you want to hide the topic bar when there is no topic"));
795
+                "Do you want to hide the topic bar when there is no topic"));
772 796
 
773 797
         return advanced;
774 798
     }
@@ -845,7 +869,7 @@ public final class SwingController extends Plugin implements UIController {
845 869
 
846 870
     /**
847 871
      * Adds a top level window to the window list.
848
-     * 
872
+     *
849 873
      * @param source New window
850 874
      */
851 875
     protected void addTopLevelWindow(final java.awt.Window source) {
@@ -856,7 +880,7 @@ public final class SwingController extends Plugin implements UIController {
856 880
 
857 881
     /**
858 882
      * Deletes a top level window to the window list.
859
-     * 
883
+     *
860 884
      * @param source Old window
861 885
      */
862 886
     protected void delTopLevelWindow(final java.awt.Window source) {

+ 29
- 11
src/com/dmdirc/addons/ui_swing/components/SwingSearchBar.java View File

@@ -30,6 +30,7 @@ import com.dmdirc.ui.interfaces.SearchBar;
30 30
 import com.dmdirc.addons.ui_swing.UIUtilities;
31 31
 import com.dmdirc.addons.ui_swing.actions.SearchAction;
32 32
 import com.dmdirc.addons.ui_swing.components.validating.ValidatingJTextField;
33
+import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
33 34
 import com.dmdirc.addons.ui_swing.textpane.IRCDocument;
34 35
 import com.dmdirc.addons.ui_swing.textpane.IRCDocumentSearcher;
35 36
 import com.dmdirc.addons.ui_swing.textpane.LinePosition;
@@ -38,6 +39,7 @@ import com.dmdirc.config.IdentityManager;
38 39
 import com.dmdirc.config.prefs.validator.Validator;
39 40
 import com.dmdirc.interfaces.ConfigChangeListener;
40 41
 import com.dmdirc.util.ListenerList;
42
+import java.awt.Dialog.ModalityType;
41 43
 
42 44
 import java.awt.Window;
43 45
 import java.awt.event.ActionEvent;
@@ -48,7 +50,6 @@ import java.awt.event.KeyListener;
48 50
 import javax.swing.JButton;
49 51
 import javax.swing.JCheckBox;
50 52
 import javax.swing.JComponent;
51
-import javax.swing.JOptionPane;
52 53
 import javax.swing.JPanel;
53 54
 import javax.swing.KeyStroke;
54 55
 import javax.swing.SwingUtilities;
@@ -92,7 +93,7 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
92 93
 
93 94
     /**
94 95
      * Creates a new instance of StatusBar.
95
-     * 
96
+     *
96 97
      * @param newParent parent frame for the dialog
97 98
      * @param parentWindow Parent window
98 99
      */
@@ -253,15 +254,32 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
253 254
                 && ((up && result.getEndLine() > textPane.getSelectedRange().
254 255
                 getEndLine())
255 256
                 || (!up && result.getStartLine() < textPane.getSelectedRange().
256
-                getStartLine()))
257
-                && JOptionPane.showConfirmDialog(parentWindow,
258
-                "Do you want to continue searching from the " + (up ? "end"
259
-                : "beginning") + "?",
260
-                "No more results", JOptionPane.OK_CANCEL_OPTION,
261
-                JOptionPane.QUESTION_MESSAGE) != JOptionPane.OK_OPTION) {
262
-            // It's wrapped, and they don't want to continue searching
263
-
264
-            foundText = false;
257
+                getStartLine()))) {
258
+            final StandardQuestionDialog dialog = new StandardQuestionDialog(
259
+                    parentWindow, ModalityType.MODELESS, "No more results",
260
+                    "Do you want to continue searching from the "
261
+                    + (up ? "end" : "beginning") + "?") {
262
+
263
+                /**
264
+                 * A version number for this class. It should be changed whenever the class
265
+                 * structure is changed (or anything else that would prevent serialized
266
+                 * objects being unserialized with the new class).
267
+                 */
268
+                 private static final long serialVersionUID = 1;
269
+
270
+                 /**{@inheritDoc} */
271
+                 @Override
272
+                 public boolean save() {
273
+                     return true;
274
+                 }
275
+
276
+                 @Override
277
+                 public void cancelled() {
278
+                     //Continue
279
+                 }
280
+            };
281
+            dialog.displayBlocking();
282
+            foundText = dialog.getResult();
265 283
         } else {
266 284
             //found, select and return found
267 285
             textPane.setScrollBarPosition(result.getEndLine());

+ 31
- 1
src/com/dmdirc/addons/ui_swing/dialogs/StandardDialog.java View File

@@ -31,9 +31,11 @@ import java.awt.Frame;
31 31
 import java.awt.Window;
32 32
 import java.awt.event.WindowAdapter;
33 33
 import java.awt.event.WindowEvent;
34
+import java.util.concurrent.Semaphore;
34 35
 
35 36
 import javax.swing.JButton;
36 37
 import javax.swing.JDialog;
38
+import javax.swing.SwingUtilities;
37 39
 
38 40
 /**
39 41
  * Provides common methods for dialogs.
@@ -107,7 +109,7 @@ public class StandardDialog extends JDialog {
107 109
      *
108 110
      * @param owner Window to center on
109 111
      */
110
-    public void display(Component owner) {
112
+    public void display(final Component owner) {
111 113
         addWindowListener(new WindowAdapter() {
112 114
 
113 115
             /** {@inheritDoc} */
@@ -122,6 +124,34 @@ public class StandardDialog extends JDialog {
122 124
         setVisible(true);
123 125
     }
124 126
 
127
+    /**
128
+     * Displays the dialog centering on the parent window, blocking until
129
+     * complete.
130
+     */
131
+    public void displayBlocking() {
132
+        displayBlocking(owner);
133
+    }
134
+
135
+    /**
136
+     * Displays the dialog centering on the specified window, blocking until
137
+     * complete.
138
+     *
139
+     * @param owner Window to center on
140
+     */
141
+    public void displayBlocking(final Component owner) {
142
+        SwingUtilities.invokeLater(new Runnable() {
143
+
144
+            /** {@inheritDoc} */
145
+            @Override
146
+            public void run() {
147
+                display(owner);
148
+            }
149
+        });
150
+        while (isVisible()) {
151
+            Thread.yield();
152
+        }
153
+    }
154
+
125 155
 
126 156
     /**
127 157
      * Centres this dialog on its owner, or the screen if no owner is present.

+ 141
- 0
src/com/dmdirc/addons/ui_swing/dialogs/StandardMessageDialog.java View File

@@ -0,0 +1,141 @@
1
+/*
2
+ * 
3
+ * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
4
+ * 
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ * 
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ * 
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ * SOFTWARE.
22
+ */
23
+
24
+package com.dmdirc.addons.ui_swing.dialogs;
25
+
26
+import com.dmdirc.addons.ui_swing.components.text.TextLabel;
27
+
28
+import java.awt.Window;
29
+import java.awt.event.ActionEvent;
30
+import java.awt.event.ActionListener;
31
+import java.awt.event.WindowAdapter;
32
+import java.awt.event.WindowEvent;
33
+
34
+import javax.swing.JButton;
35
+
36
+import net.miginfocom.swing.MigLayout;
37
+
38
+/**
39
+ * Abstract standard dialog for showing messages.
40
+ */
41
+public class StandardMessageDialog extends StandardDialog {
42
+
43
+    /**
44
+     * A version number for this class. It should be changed whenever the class
45
+     * structure is changed (or anything else that would prevent serialized
46
+     * objects being unserialized with the new class).
47
+     */
48
+    private static final long serialVersionUID = 1;
49
+    /** Blurb label. */
50
+    private TextLabel blurb;
51
+    /** Message. */
52
+    private String message;
53
+
54
+    /**
55
+     * Instantiates a new standard input dialog.
56
+     *
57
+     * @param owner Dialog owner
58
+     * @param modal modality type
59
+     * @param title Dialog title
60
+     * @param message Dialog message
61
+     */
62
+    public StandardMessageDialog(Window owner, ModalityType modal,
63
+            final String title, final String message) {
64
+        super(owner, modal);
65
+
66
+        this.message = message;
67
+
68
+        setTitle(title);
69
+        setDefaultCloseOperation(StandardInputDialog.DISPOSE_ON_CLOSE);
70
+
71
+        initComponents();
72
+        addListeners();
73
+        layoutComponents();
74
+    }
75
+
76
+    /**
77
+     * Called when the dialog's OK button is clicked.
78
+     *
79
+     * @return whether the dialog can close
80
+     */
81
+    public boolean save() {
82
+        return true;
83
+    }
84
+
85
+    /**
86
+     * Called when the dialog's cancel button is clicked, or otherwise closed.
87
+     */
88
+    public void cancelled() {
89
+    }
90
+
91
+    /**
92
+     * Initialises the components.
93
+     */
94
+    private final void initComponents() {
95
+        orderButtons(new JButton(), new JButton());
96
+        getOkButton().setText("OK");
97
+        blurb = new TextLabel(message);
98
+    }
99
+
100
+    /**
101
+     * Adds the listeners
102
+     */
103
+    private final void addListeners() {
104
+        final ActionListener listener = new ActionListener() {
105
+
106
+            /** {@inheritDoc} */
107
+            @Override
108
+            public void actionPerformed(ActionEvent e) {
109
+                if (save()) {
110
+                    dispose();
111
+                }
112
+            }
113
+        };
114
+        getCancelButton().addActionListener(listener);
115
+        getOkButton().addActionListener(listener);
116
+        addWindowListener(new WindowAdapter() {
117
+
118
+            /** {@inheritDoc} */
119
+            @Override
120
+            public void windowOpened(WindowEvent e) {
121
+                //Ignore
122
+            }
123
+
124
+            /** {@inheritDoc} */
125
+            @Override
126
+            public void windowClosed(WindowEvent e) {
127
+                cancelled();
128
+            }
129
+        });
130
+    }
131
+
132
+    /**
133
+     * Lays out the components.
134
+     */
135
+    private final void layoutComponents() {
136
+        setLayout(new MigLayout("fill, wrap 1, hidemode 3"));
137
+
138
+        add(blurb, "growx");
139
+        add(getOkButton(), "right");
140
+    }
141
+}

+ 12
- 0
src/com/dmdirc/addons/ui_swing/dialogs/StandardQuestionDialog.java View File

@@ -43,6 +43,8 @@ public abstract class StandardQuestionDialog extends StandardDialog {
43 43
     private TextLabel blurb;
44 44
     /** Message. */
45 45
     private String message;
46
+    /** Question result. */
47
+    private boolean result = false;
46 48
 
47 49
     /**
48 50
      * Instantiates a new standard input dialog.
@@ -98,6 +100,7 @@ public abstract class StandardQuestionDialog extends StandardDialog {
98 100
             @Override
99 101
             public void actionPerformed(ActionEvent e) {
100 102
                 if (save()) {
103
+                    result = true;
101 104
                     dispose();
102 105
                 }
103 106
             }
@@ -137,4 +140,13 @@ public abstract class StandardQuestionDialog extends StandardDialog {
137 140
         add(getLeftButton(), "split 2, right");
138 141
         add(getRightButton(), "right");
139 142
     }
143
+
144
+    /**
145
+     * Returns the result of the question.
146
+     *
147
+     * @return true iif the user pressed Yes
148
+     */
149
+    public boolean getResult() {
150
+        return result;
151
+    }
140 152
 }

+ 0
- 1
src/com/dmdirc/addons/ui_swing/dialogs/profiles/ProfileDetailPanel.java View File

@@ -46,7 +46,6 @@ import javax.swing.BorderFactory;
46 46
 import javax.swing.DefaultListModel;
47 47
 import javax.swing.JButton;
48 48
 import javax.swing.JLabel;
49
-import javax.swing.JOptionPane;
50 49
 import javax.swing.JPanel;
51 50
 import javax.swing.JScrollPane;
52 51
 import javax.swing.border.Border;

Loading…
Cancel
Save