|
@@ -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) {
|