Browse Source

issue 2451; fixes issue 2344

tags/0.6.3m1rc1
Gregory Holmes 15 years ago
parent
commit
cff10039b3

+ 39
- 18
src/com/dmdirc/addons/ui_swing/MainFrame.java View File

19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
  * SOFTWARE.
20
  * SOFTWARE.
21
  */
21
  */
22
+
22
 package com.dmdirc.addons.ui_swing;
23
 package com.dmdirc.addons.ui_swing;
23
 
24
 
24
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
25
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
70
         MainWindow, ConfigChangeListener, FrameManager, PropertyChangeListener {
71
         MainWindow, ConfigChangeListener, FrameManager, PropertyChangeListener {
71
 
72
 
72
     /** Logger to use. */
73
     /** Logger to use. */
73
-    private static final java.util.logging.Logger LOGGER = java.util.logging
74
-            .Logger.getLogger(MainFrame.class.getName());
75
-
74
+    private static final java.util.logging.Logger LOGGER =
75
+            java.util.logging.Logger.getLogger(MainFrame.class.getName());
76
     /**
76
     /**
77
      * A version number for this class. It should be changed whenever the class
77
      * A version number for this class. It should be changed whenever the class
78
      * structure is changed (or anything else that would prevent serialized
78
      * structure is changed (or anything else that would prevent serialized
124
 
124
 
125
         addWindowListener(this);
125
         addWindowListener(this);
126
 
126
 
127
-        showVersion = IdentityManager.getGlobalConfig().getOptionBool("ui", "showversion");
128
-        IdentityManager.getGlobalConfig().addChangeListener("ui", "lookandfeel", this);
129
-        IdentityManager.getGlobalConfig().addChangeListener("ui", "showversion", this);
127
+        showVersion = IdentityManager.getGlobalConfig().getOptionBool("ui",
128
+                "showversion");
129
+        IdentityManager.getGlobalConfig().addChangeListener("ui", "lookandfeel",
130
+                this);
131
+        IdentityManager.getGlobalConfig().addChangeListener("ui", "showversion",
132
+                this);
130
         IdentityManager.getGlobalConfig().addChangeListener("icon", "icon", this);
133
         IdentityManager.getGlobalConfig().addChangeListener("icon", "icon", this);
131
 
134
 
132
 
135
 
235
     @Override
238
     @Override
236
     public String getTitlePrefix() {
239
     public String getTitlePrefix() {
237
         if (showVersion) {
240
         if (showVersion) {
238
-            return "DMDirc " + IdentityManager.getGlobalConfig().getOption("version", "version");
241
+            return "DMDirc " + IdentityManager.getGlobalConfig().getOption(
242
+                    "version", "version");
239
         } else {
243
         } else {
240
             return "DMDirc";
244
             return "DMDirc";
241
         }
245
         }
290
      */
294
      */
291
     @Override
295
     @Override
292
     public void windowClosed(final WindowEvent windowEvent) {
296
     public void windowClosed(final WindowEvent windowEvent) {
293
-        Main.quit(exitCode);
297
+        new Thread(new Runnable() {
298
+
299
+            /** {@inheritDoc} */
300
+            @Override
301
+            public void run() {
302
+                Main.quit(exitCode);
303
+            }
304
+        }, "Quit thread").start();
294
     }
305
     }
295
 
306
 
296
     /** 
307
     /** 
340
             /** {@inheritDoc} */
351
             /** {@inheritDoc} */
341
             @Override
352
             @Override
342
             public void run() {
353
             public void run() {
343
-                final String manager = IdentityManager.getGlobalConfig().getOption("ui",
354
+                final String manager = IdentityManager.getGlobalConfig().
355
+                        getOption("ui",
344
                         "framemanager");
356
                         "framemanager");
345
 
357
 
346
                 try {
358
                 try {
377
 
389
 
378
         setPreferredSize(new Dimension(800, 600));
390
         setPreferredSize(new Dimension(800, 600));
379
 
391
 
380
-        getContentPane().setLayout(new MigLayout("fill, ins rel, wrap 1, hidemode 2"));
392
+        getContentPane().setLayout(new MigLayout(
393
+                "fill, ins rel, wrap 1, hidemode 2"));
381
         getContentPane().add(initSplitPane(), "grow, push");
394
         getContentPane().add(initSplitPane(), "grow, push");
382
-        getContentPane().add(statusBar, "hmax 20, wmax 100%-2*rel, wmin 100%-2*rel");
395
+        getContentPane().add(statusBar,
396
+                "hmax 20, wmax 100%-2*rel, wmin 100%-2*rel");
383
 
397
 
384
         setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
398
         setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
385
 
399
 
421
                 mainSplitPane.setBottomComponent(desktopPane);
435
                 mainSplitPane.setBottomComponent(desktopPane);
422
                 mainSplitPane.setResizeWeight(0.0);
436
                 mainSplitPane.setResizeWeight(0.0);
423
                 mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
437
                 mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
424
-                frameManagerPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE,
438
+                frameManagerPanel.setPreferredSize(new Dimension(
439
+                        Integer.MAX_VALUE,
425
                         IdentityManager.getGlobalConfig().
440
                         IdentityManager.getGlobalConfig().
426
                         getOptionInt("ui", "frameManagerSize")));
441
                         getOptionInt("ui", "frameManagerSize")));
427
                 break;
442
                 break;
439
                 mainSplitPane.setBottomComponent(frameManagerPanel);
454
                 mainSplitPane.setBottomComponent(frameManagerPanel);
440
                 mainSplitPane.setResizeWeight(1.0);
455
                 mainSplitPane.setResizeWeight(1.0);
441
                 mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
456
                 mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
442
-                frameManagerPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE,
457
+                frameManagerPanel.setPreferredSize(new Dimension(
458
+                        Integer.MAX_VALUE,
443
                         IdentityManager.getGlobalConfig().
459
                         IdentityManager.getGlobalConfig().
444
                         getOptionInt("ui", "frameManagerSize")));
460
                         getOptionInt("ui", "frameManagerSize")));
445
                 break;
461
                 break;
471
      * @param exitCode Exit code
487
      * @param exitCode Exit code
472
      */
488
      */
473
     public void quit(final int exitCode) {
489
     public void quit(final int exitCode) {
474
-        if (exitCode == 0 && IdentityManager.getGlobalConfig().getOptionBool("ui", "confirmQuit") && JOptionPane.showConfirmDialog(this,
490
+        if (exitCode == 0 && IdentityManager.getGlobalConfig().getOptionBool(
491
+                "ui", "confirmQuit") && JOptionPane.showConfirmDialog(this,
475
                 "You are about to quit DMDirc, are you sure?", "Quit confirm",
492
                 "You are about to quit DMDirc, are you sure?", "Quit confirm",
476
                 JOptionPane.YES_NO_OPTION,
493
                 JOptionPane.YES_NO_OPTION,
477
                 JOptionPane.WARNING_MESSAGE) !=
494
                 JOptionPane.WARNING_MESSAGE) !=
487
             @Override
504
             @Override
488
             protected Object doInBackground() throws Exception {
505
             protected Object doInBackground() throws Exception {
489
                 ActionManager.processEvent(CoreActionType.CLIENT_CLOSING, null);
506
                 ActionManager.processEvent(CoreActionType.CLIENT_CLOSING, null);
490
-                ServerManager.getServerManager().closeAll(IdentityManager.getGlobalConfig().getOption("general", "closemessage"));
507
+                ServerManager.getServerManager().closeAll(IdentityManager.
508
+                        getGlobalConfig().getOption("general", "closemessage"));
491
                 IdentityManager.getConfigIdentity().setOption("ui",
509
                 IdentityManager.getConfigIdentity().setOption("ui",
492
-                        "frameManagerSize", String.valueOf(getFrameManagerSize()));
510
+                        "frameManagerSize",
511
+                        String.valueOf(getFrameManagerSize()));
493
                 return null;
512
                 return null;
494
             }
513
             }
495
 
514
 
509
             if ("lookandfeel".equals(key)) {
528
             if ("lookandfeel".equals(key)) {
510
                 controller.updateLookAndFeel();
529
                 controller.updateLookAndFeel();
511
             } else {
530
             } else {
512
-                showVersion = IdentityManager.getGlobalConfig().getOptionBool("ui",
531
+                showVersion = IdentityManager.getGlobalConfig().getOptionBool(
532
+                        "ui",
513
                         "showversion");
533
                         "showversion");
514
             }
534
             }
515
         } else {
535
         } else {
516
-            imageIcon = new ImageIcon(IconManager.getIconManager().getImage("icon"));
536
+            imageIcon = new ImageIcon(IconManager.getIconManager().getImage(
537
+                    "icon"));
517
             setIconImage(imageIcon.getImage());
538
             setIconImage(imageIcon.getImage());
518
         }
539
         }
519
     }
540
     }

+ 2
- 2
src/com/dmdirc/addons/ui_swing/components/desktopPane/DMDircDesktopPane.java View File

143
      * @param index Index for insertion
143
      * @param index Index for insertion
144
      */
144
      */
145
     public void add(final JComponent comp, final int index) {
145
     public void add(final JComponent comp, final int index) {
146
-        UIUtilities.invokeAndWait(new Runnable() {
146
+        UIUtilities.invokeLater(new Runnable() {
147
 
147
 
148
             /** {@inheritDoc} */
148
             /** {@inheritDoc} */
149
             @Override
149
             @Override
297
     /** {@inheritDoc} */
297
     /** {@inheritDoc} */
298
     @Override
298
     @Override
299
     public void selectionChanged(final Window window) {
299
     public void selectionChanged(final Window window) {
300
-        UIUtilities.invokeAndWait(new Runnable() {
300
+        UIUtilities.invokeLater(new Runnable() {
301
 
301
 
302
             /** {@inheritDoc} */
302
             /** {@inheritDoc} */
303
             @Override
303
             @Override

Loading…
Cancel
Save