Преглед на файлове

Remove some depecation warnings, lombok some code.

Change-Id: I76e80c3290656e807dbd4c15913008c1c43dd852
Reviewed-on: http://gerrit.dmdirc.com/2197
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.7rc1
Greg Holmes преди 12 години
родител
ревизия
4ea2214149

Двоични данни
lib/lombok-pg-0.10.0.jar Целия файл


+ 31
- 39
src/com/dmdirc/addons/ui_swing/MainFrame.java Целия файл

@@ -38,7 +38,6 @@ import com.dmdirc.addons.ui_swing.framemanager.FrameManager;
38 38
 import com.dmdirc.addons.ui_swing.framemanager.FramemanagerPosition;
39 39
 import com.dmdirc.addons.ui_swing.framemanager.ctrltab.CtrlTabWindowManager;
40 40
 import com.dmdirc.addons.ui_swing.framemanager.tree.TreeFrameManager;
41
-import com.dmdirc.config.IdentityManager;
42 41
 import com.dmdirc.interfaces.ConfigChangeListener;
43 42
 import com.dmdirc.interfaces.FrameInfoListener;
44 43
 import com.dmdirc.interfaces.NotificationListener;
@@ -65,6 +64,7 @@ import javax.swing.MenuSelectionManager;
65 64
 import javax.swing.SwingUtilities;
66 65
 import javax.swing.WindowConstants;
67 66
 
67
+import lombok.Getter;
68 68
 import net.miginfocom.swing.MigLayout;
69 69
 
70 70
 /**
@@ -107,6 +107,7 @@ public final class MainFrame extends JFrame implements WindowListener,
107 107
     /** Exit code. */
108 108
     private int exitCode = 0;
109 109
     /** Status bar. */
110
+    @Getter
110 111
     private SwingStatusBar statusBar;
111 112
     /** Main split pane. */
112 113
     private SplitPane mainSplitPane;
@@ -126,27 +127,27 @@ public final class MainFrame extends JFrame implements WindowListener,
126 127
         focusOrder = new QueuedLinkedHashSet<TextFrame>();
127 128
         initComponents();
128 129
 
129
-        imageIcon = new ImageIcon(new IconManager(IdentityManager
130
-                .getGlobalConfig()).getImage("icon"));
130
+        imageIcon = new ImageIcon(new IconManager(controller.getGlobalConfig())
131
+                .getImage("icon"));
131 132
         setIconImage(imageIcon.getImage());
132 133
 
133 134
         CoreUIUtils.centreWindow(this);
134 135
 
135 136
         addWindowListener(this);
136 137
 
137
-        showVersion = IdentityManager.getGlobalConfig().getOptionBool("ui",
138
+        showVersion = controller.getGlobalConfig().getOptionBool("ui",
138 139
                 "showversion");
139
-        version = IdentityManager.getGlobalConfig().getOption("version",
140
+        version = controller.getGlobalConfig().getOption("version",
140 141
                 "version");
141
-        IdentityManager.getGlobalConfig().addChangeListener("ui", "lookandfeel",
142
+        controller.getGlobalConfig().addChangeListener("ui", "lookandfeel",
142 143
                 this);
143
-        IdentityManager.getGlobalConfig().addChangeListener("ui", "showversion",
144
+        controller.getGlobalConfig().addChangeListener("ui", "showversion",
144 145
                 this);
145
-        IdentityManager.getGlobalConfig().addChangeListener("ui",
146
+        controller.getGlobalConfig().addChangeListener("ui",
146 147
                 "framemanager", this);
147
-        IdentityManager.getGlobalConfig().addChangeListener("ui",
148
+        controller.getGlobalConfig().addChangeListener("ui",
148 149
                 "framemanagerPosition", this);
149
-        IdentityManager.getGlobalConfig().addChangeListener("icon", "icon",
150
+        controller.getGlobalConfig().addChangeListener("icon", "icon",
150 151
                 this);
151 152
 
152 153
 
@@ -175,15 +176,6 @@ public final class MainFrame extends JFrame implements WindowListener,
175 176
         frameManager = new CtrlTabWindowManager(controller, this, rootPane);
176 177
     }
177 178
 
178
-    /**
179
-     * Returns the status bar for this frame.
180
-     *
181
-     * @return Status bar
182
-     */
183
-    public SwingStatusBar getStatusBar() {
184
-        return statusBar;
185
-    }
186
-
187 179
     /**
188 180
      * Returns the size of the frame manager.
189 181
      *
@@ -337,11 +329,11 @@ public final class MainFrame extends JFrame implements WindowListener,
337 329
                     controller.getWindowFactory().removeWindowListener(
338 330
                             mainFrameManager);
339 331
                 }
340
-                final String manager = IdentityManager.getGlobalConfig().
341
-                        getOption("ui", "framemanager");
332
+                final String manager = controller.getGlobalConfig()
333
+                        .getOption("ui", "framemanager");
342 334
                 try {
343
-                    mainFrameManager = (FrameManager) Class.forName(manager).
344
-                            getConstructor().newInstance();
335
+                    mainFrameManager = (FrameManager) Class.forName(manager)
336
+                            .getConstructor().newInstance();
345 337
                 } catch (InvocationTargetException ex) {
346 338
                     Logger.appError(ErrorLevel.MEDIUM, "Unable to load frame "
347 339
                             + "manager, falling back to default.", ex);
@@ -421,10 +413,10 @@ public final class MainFrame extends JFrame implements WindowListener,
421 413
      * @return Returns the initialised split pane
422 414
      */
423 415
     private SplitPane initSplitPane() {
424
-        final SplitPane splitPane = new SplitPane(SplitPane
425
-                .Orientation.HORIZONTAL);
426
-        position = FramemanagerPosition.getPosition(IdentityManager.
427
-                getGlobalConfig().getOption("ui", "framemanagerPosition"));
416
+        final SplitPane splitPane = new SplitPane(controller.getGlobalConfig(),
417
+                SplitPane.Orientation.HORIZONTAL);
418
+        position = FramemanagerPosition.getPosition(controller
419
+                .getGlobalConfig().getOption("ui", "framemanagerPosition"));
428 420
 
429 421
         if (position == FramemanagerPosition.UNKNOWN) {
430 422
             position = FramemanagerPosition.LEFT;
@@ -448,7 +440,7 @@ public final class MainFrame extends JFrame implements WindowListener,
448 440
                 splitPane.setResizeWeight(0.0);
449 441
                 splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
450 442
                 frameManagerPanel.setPreferredSize(new Dimension(
451
-                        Integer.MAX_VALUE, IdentityManager.getGlobalConfig().
443
+                        Integer.MAX_VALUE, controller.getGlobalConfig().
452 444
                         getOptionInt("ui", "frameManagerSize")));
453 445
                 break;
454 446
             case LEFT:
@@ -457,7 +449,7 @@ public final class MainFrame extends JFrame implements WindowListener,
457 449
                 splitPane.setResizeWeight(0.0);
458 450
                 splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
459 451
                 frameManagerPanel.setPreferredSize(new Dimension(
460
-                        IdentityManager.getGlobalConfig().getOptionInt("ui",
452
+                        controller.getGlobalConfig().getOptionInt("ui",
461 453
                         "frameManagerSize"), Integer.MAX_VALUE));
462 454
                 break;
463 455
             case BOTTOM:
@@ -466,7 +458,7 @@ public final class MainFrame extends JFrame implements WindowListener,
466 458
                 splitPane.setResizeWeight(1.0);
467 459
                 splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
468 460
                 frameManagerPanel.setPreferredSize(new Dimension(
469
-                        Integer.MAX_VALUE, IdentityManager.getGlobalConfig().
461
+                        Integer.MAX_VALUE, controller.getGlobalConfig().
470 462
                         getOptionInt("ui", "frameManagerSize")));
471 463
                 break;
472 464
             case RIGHT:
@@ -475,7 +467,7 @@ public final class MainFrame extends JFrame implements WindowListener,
475 467
                 splitPane.setResizeWeight(1.0);
476 468
                 splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
477 469
                 frameManagerPanel.setPreferredSize(new Dimension(
478
-                        IdentityManager.getGlobalConfig().getOptionInt("ui",
470
+                        controller.getGlobalConfig().getOptionInt("ui",
479 471
                         "frameManagerSize"), Integer.MAX_VALUE));
480 472
                 break;
481 473
             default:
@@ -498,7 +490,7 @@ public final class MainFrame extends JFrame implements WindowListener,
498 490
      * @param exitCode Exit code
499 491
      */
500 492
     public void quit(final int exitCode) {
501
-        if (exitCode == 0 && IdentityManager.getGlobalConfig().getOptionBool(
493
+        if (exitCode == 0 && controller.getGlobalConfig().getOptionBool(
502 494
                 "ui", "confirmQuit")) {
503 495
             final StandardQuestionDialog dialog = new ConfirmQuitDialog(this) {
504 496
 
@@ -538,9 +530,9 @@ public final class MainFrame extends JFrame implements WindowListener,
538 530
             protected Void doInBackground() {
539 531
                 ActionManager.getActionManager().triggerEvent(
540 532
                         CoreActionType.CLIENT_CLOSING, null);
541
-                ServerManager.getServerManager().closeAll(IdentityManager.
542
-                        getGlobalConfig().getOption("general", "closemessage"));
543
-                IdentityManager.getConfigIdentity().setOption("ui",
533
+                ServerManager.getServerManager().closeAll(controller
534
+                        .getGlobalConfig().getOption("general", "closemessage"));
535
+                controller.getGlobalIdentity().setOption("ui",
544 536
                         "frameManagerSize",
545 537
                         String.valueOf(getFrameManagerSize()));
546 538
                 return null;
@@ -577,12 +569,12 @@ public final class MainFrame extends JFrame implements WindowListener,
577 569
                     }
578 570
                 });
579 571
             } else {
580
-                showVersion = IdentityManager.getGlobalConfig().getOptionBool(
572
+                showVersion = controller.getGlobalConfig().getOptionBool(
581 573
                         "ui", "showversion");
582 574
             }
583 575
         } else {
584
-            imageIcon = new ImageIcon(new IconManager(IdentityManager
585
-                    .getGlobalConfig()).getImage("icon"));
576
+            imageIcon = new ImageIcon(new IconManager(controller
577
+                        .getGlobalConfig()).getImage("icon"));
586 578
             UIUtilities.invokeLater(new Runnable() {
587 579
 
588 580
                 /** {@inheritDoc} */
@@ -735,7 +727,7 @@ public final class MainFrame extends JFrame implements WindowListener,
735 727
         if (!quitting) {
736 728
             removeWindowListener(this);
737 729
         }
738
-        IdentityManager.getGlobalConfig().removeListener(this);
730
+        controller.getGlobalConfig().removeListener(this);
739 731
         super.dispose();
740 732
     }
741 733
 }

+ 53
- 68
src/com/dmdirc/addons/ui_swing/SwingController.java Целия файл

@@ -38,6 +38,7 @@ import com.dmdirc.addons.ui_swing.dialogs.serversetting.ServerSettingsDialog;
38 38
 import com.dmdirc.addons.ui_swing.dialogs.url.URLDialog;
39 39
 import com.dmdirc.addons.ui_swing.wizard.WizardListener;
40 40
 import com.dmdirc.addons.ui_swing.wizard.firstrun.SwingFirstRunWizard;
41
+import com.dmdirc.config.ConfigManager;
41 42
 import com.dmdirc.config.Identity;
42 43
 import com.dmdirc.config.IdentityManager;
43 44
 import com.dmdirc.config.prefs.PluginPreferencesCategory;
@@ -78,11 +79,13 @@ import javax.swing.UIManager;
78 79
 import javax.swing.UnsupportedLookAndFeelException;
79 80
 import javax.swing.UIManager.LookAndFeelInfo;
80 81
 
82
+import lombok.Getter;
81 83
 import net.miginfocom.layout.PlatformDefaults;
82 84
 
83 85
 /**
84 86
  * Controls the main swing UI.
85 87
  */
88
+@SuppressWarnings("PMD.UnusedPrivateField")
86 89
 public class SwingController extends BasePlugin implements UIController {
87 90
 
88 91
     /**
@@ -93,16 +96,20 @@ public class SwingController extends BasePlugin implements UIController {
93 96
     private static final long serialVersionUID = 1;
94 97
 
95 98
     /** Window factory. */
99
+    @Getter
96 100
     private final SwingWindowFactory windowFactory =
97 101
             new SwingWindowFactory(this);
98 102
     /** Waiting on mainframe creation. */
99 103
     private final AtomicBoolean mainFrameCreated = new AtomicBoolean(false);
100 104
     /** URL Handler to use. */
101
-    private final URLHandler urlHandler = new URLHandler(this);
105
+    @Getter
106
+    private final URLHandler URLHandler = new URLHandler(this);
102 107
     /** Singleton instance of MainFrame. */
103
-    private MainFrame me;
108
+    @Getter
109
+    private MainFrame mainFrame;
104 110
     /** Status bar. */
105
-    private SwingStatusBar statusBar;
111
+    @Getter
112
+    private SwingStatusBar swingStatusBar;
106 113
     /** Top level window list. */
107 114
     private final List<java.awt.Window> windows;
108 115
     /** Error dialog. */
@@ -113,6 +120,15 @@ public class SwingController extends BasePlugin implements UIController {
113 120
     private DialogKeyListener keyListener;
114 121
     /** This plugin's plugin info object. */
115 122
     private final PluginInfo pluginInfo;
123
+    /** Global config manager. */
124
+    @Getter
125
+    private final ConfigManager globalConfig;
126
+    /** Global config identity. */
127
+    @Getter
128
+    private final Identity globalIdentity;
129
+    /** Addon config identity. */
130
+    @Getter
131
+    private final Identity addonIdentity;
116 132
 
117 133
     /**
118 134
      * Instantiates a new SwingController.
@@ -122,6 +138,12 @@ public class SwingController extends BasePlugin implements UIController {
122 138
     public SwingController(final PluginInfo pluginInfo) {
123 139
         super();
124 140
         this.pluginInfo = pluginInfo;
141
+        globalConfig = IdentityManager.getIdentityManager()
142
+                .getGlobalConfiguration();
143
+        globalIdentity = IdentityManager.getIdentityManager()
144
+                .getGlobalConfigIdentity();
145
+        addonIdentity = IdentityManager.getIdentityManager()
146
+                .getGlobalAddonIdentity();
125 147
         setAntiAlias();
126 148
         windows = new ArrayList<java.awt.Window>();
127 149
         registerCommand(new ServerSettings(), ServerSettings.INFO);
@@ -136,8 +158,8 @@ public class SwingController extends BasePlugin implements UIController {
136 158
      */
137 159
     public final void setAntiAlias() {
138 160
         // For this to work it *HAS* to be before anything else UI related.
139
-        final boolean aaSetting = IdentityManager.getGlobalConfig().
140
-                getOptionBool("ui", "antialias");
161
+        final boolean aaSetting = getGlobalConfig()
162
+                .getOptionBool("ui", "antialias");
141 163
         System.setProperty("awt.useSystemAAFontSettings",
142 164
                 Boolean.toString(aaSetting));
143 165
         System.setProperty("swing.aatext", Boolean.toString(aaSetting));
@@ -152,44 +174,6 @@ public class SwingController extends BasePlugin implements UIController {
152 174
         return mainFrameCreated.get();
153 175
     }
154 176
 
155
-    /**
156
-     * Returns a URL Handler which may be used when working with the Swing UI.
157
-     *
158
-     * @return A URL handler for use with the swing UI
159
-     * @since 0.6.5
160
-     */
161
-    public URLHandler getURLHandler() {
162
-        return urlHandler;
163
-    }
164
-
165
-    /**
166
-     * Returns the window factory used by this controller.
167
-     *
168
-     * @return This controller's window factory
169
-     * @since 0.6.4
170
-     */
171
-    public SwingWindowFactory getWindowFactory() {
172
-        return windowFactory;
173
-    }
174
-
175
-    /**
176
-     * Retrieves the main window used by this UI.
177
-     *
178
-     * @return This UI's main window
179
-     */
180
-    public MainFrame getMainFrame() {
181
-        return me;
182
-    }
183
-
184
-    /**
185
-     * Retrieves the Swing Status Bar used by this UI.
186
-     *
187
-     * @return This UI's status bar
188
-     */
189
-    public SwingStatusBar getSwingStatusBar() {
190
-        return statusBar;
191
-    }
192
-
193 177
     /** {@inheritDoc} */
194 178
     @Override
195 179
     public void showFirstRunWizard() {
@@ -213,8 +197,8 @@ public class SwingController extends BasePlugin implements UIController {
213 197
                         semaphore.release();
214 198
                     }
215 199
                 };
216
-                final SwingFirstRunWizard wizard = new SwingFirstRunWizard(me,
217
-                        SwingController.this);
200
+                final SwingFirstRunWizard wizard = new SwingFirstRunWizard(
201
+                        getMainFrame(), SwingController.this);
218 202
                 wizard.getWizardDialog().addWizardListener(listener);
219 203
                 wizard.display();
220 204
             }
@@ -230,9 +214,9 @@ public class SwingController extends BasePlugin implements UIController {
230 214
             /** {@inheritDoc} */
231 215
             @Override
232 216
             public void run() {
233
-                ChannelSettingsDialog.showChannelSettingsDialog(channel, me,
234
-                        (InputWindow) getWindowFactory().getSwingWindow(
235
-                        channel));
217
+                ChannelSettingsDialog.showChannelSettingsDialog(channel,
218
+                        getMainFrame(), (InputWindow) getWindowFactory()
219
+                        .getSwingWindow(channel));
236 220
             }
237 221
         });
238 222
     }
@@ -245,7 +229,8 @@ public class SwingController extends BasePlugin implements UIController {
245 229
             /** {@inheritDoc} */
246 230
             @Override
247 231
             public void run() {
248
-                ServerSettingsDialog.showServerSettingsDialog(server, me);
232
+                ServerSettingsDialog.showServerSettingsDialog(
233
+                        server, getMainFrame());
249 234
             }
250 235
         });
251 236
     }
@@ -255,7 +240,7 @@ public class SwingController extends BasePlugin implements UIController {
255 240
      */
256 241
     public void updateLookAndFeel() {
257 242
         try {
258
-            UIManager.setLookAndFeel(UIUtilities.getLookAndFeel(IdentityManager.
243
+            UIManager.setLookAndFeel(UIUtilities.getLookAndFeel(
259 244
                     getGlobalConfig().getOption("ui", "lookandfeel")));
260 245
             final int state = UIUtilities.invokeAndWait(
261 246
                     new ReturnableThread<Integer>() {
@@ -263,7 +248,7 @@ public class SwingController extends BasePlugin implements UIController {
263 248
                 /** {@inheritDoc} */
264 249
                 @Override
265 250
                 public void run() {
266
-                    setObject(me.getExtendedState());
251
+                    setObject(getMainFrame().getExtendedState());
267 252
                 }
268 253
             });
269 254
             UIUtilities.invokeLater(new Runnable() {
@@ -281,7 +266,7 @@ public class SwingController extends BasePlugin implements UIController {
281 266
                     @Override
282 267
                     public void run() {
283 268
                         SwingUtilities.updateComponentTreeUI(window);
284
-                        if (window != me) {
269
+                        if (window != getMainFrame()) {
285 270
                             window.pack();
286 271
                         }
287 272
                     }
@@ -292,7 +277,7 @@ public class SwingController extends BasePlugin implements UIController {
292 277
                 /** {@inheritDoc} */
293 278
                 @Override
294 279
                 public void run() {
295
-                    me.setExtendedState(state);
280
+                    getMainFrame().setExtendedState(state);
296 281
                 }
297 282
             });
298 283
         } catch (ClassNotFoundException ex) {
@@ -332,7 +317,7 @@ public class SwingController extends BasePlugin implements UIController {
332 317
 
333 318
         try {
334 319
             UIUtilities.initUISettings();
335
-            UIManager.setLookAndFeel(UIUtilities.getLookAndFeel(IdentityManager.
320
+            UIManager.setLookAndFeel(UIUtilities.getLookAndFeel(
336 321
                     getGlobalConfig().getOption("ui", "lookandfeel")));
337 322
         } catch (UnsupportedOperationException ex) {
338 323
             Logger.userError(ErrorLevel.LOW, "Unable to set UI Settings");
@@ -360,7 +345,7 @@ public class SwingController extends BasePlugin implements UIController {
360 345
             /** {@inheritDoc} */
361 346
             @Override
362 347
             public void run() {
363
-                URLDialog.showURLDialog(url, me, urlHandler);
348
+                URLDialog.showURLDialog(url, getMainFrame(), getURLHandler());
364 349
 
365 350
             }
366 351
         });
@@ -387,8 +372,8 @@ public class SwingController extends BasePlugin implements UIController {
387 372
             /** {@inheritDoc} */
388 373
             @Override
389 374
             public void run() {
390
-                new StandardMessageDialog(me, ModalityType.MODELESS, title,
391
-                        message).display();
375
+                new StandardMessageDialog(getMainFrame(), ModalityType.MODELESS,
376
+                        title, message).display();
392 377
             }
393 378
         });
394 379
     }
@@ -443,13 +428,13 @@ public class SwingController extends BasePlugin implements UIController {
443 428
             @Override
444 429
             public void run() {
445 430
                 initUISettings();
446
-                me = new MainFrame(SwingController.this);
447
-                me.setVisible(true);
431
+                mainFrame = new MainFrame(SwingController.this);
432
+                getMainFrame().setVisible(true);
448 433
                 mainFrameCreated.set(true);
449
-                statusBar = me.getStatusBar();
450
-                errorDialog = new ErrorListDialog(me);
434
+                swingStatusBar = getMainFrame().getStatusBar();
435
+                errorDialog = new ErrorListDialog(getMainFrame());
451 436
                 StatusBarManager.getStatusBarManager().registerStatusBar(
452
-                        statusBar);
437
+                        getSwingStatusBar());
453 438
             }
454 439
         });
455 440
 
@@ -467,9 +452,10 @@ public class SwingController extends BasePlugin implements UIController {
467 452
         errorDialog.dispose();
468 453
         WindowManager.getWindowManager().removeListener(windowFactory);
469 454
         mainFrameCreated.set(false);
470
-        me.dispose();
455
+        getMainFrame().dispose();
471 456
         windowFactory.dispose();
472
-        StatusBarManager.getStatusBarManager().registerStatusBar(statusBar);
457
+        StatusBarManager.getStatusBarManager()
458
+                .registerStatusBar(getSwingStatusBar());
473 459
         eventQueue.pop();
474 460
         KeyboardFocusManager.getCurrentKeyboardFocusManager().
475 461
                 removeKeyEventDispatcher(keyListener);
@@ -482,10 +468,9 @@ public class SwingController extends BasePlugin implements UIController {
482 468
     /** {@inheritDoc} */
483 469
     @Override
484 470
     public void domainUpdated() {
485
-        final Identity defaults = IdentityManager.getAddonIdentity();
486
-        defaults.setOption("ui", "textPaneFontName",
471
+        getAddonIdentity().setOption("ui", "textPaneFontName",
487 472
                 UIManager.getFont("TextPane.font").getFamily());
488
-        defaults.setOption("ui", "textPaneFontSize",
473
+        getAddonIdentity().setOption("ui", "textPaneFontSize",
489 474
                 UIManager.getFont("TextPane.font").getSize());
490 475
     }
491 476
 
@@ -741,7 +726,7 @@ public class SwingController extends BasePlugin implements UIController {
741 726
      * @param menuItem Menu item to add
742 727
      */
743 728
     public void addMenuItem(final String parentMenu, final JMenuItem menuItem) {
744
-        me.getJMenuBar().addMenuItem(parentMenu, menuItem);
729
+        getMainFrame().getJMenuBar().addMenuItem(parentMenu, menuItem);
745 730
     }
746 731
 
747 732
     /** {@inheritDoc} */

+ 10
- 7
src/com/dmdirc/addons/ui_swing/components/SplitPane.java Целия файл

@@ -24,7 +24,6 @@ package com.dmdirc.addons.ui_swing.components;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
26 26
 import com.dmdirc.config.ConfigManager;
27
-import com.dmdirc.config.IdentityManager;
28 27
 import com.dmdirc.interfaces.ConfigChangeListener;
29 28
 
30 29
 import java.awt.Component;
@@ -59,38 +58,42 @@ public class SplitPane extends JSplitPane implements ConfigChangeListener {
59 58
     /**
60 59
      * Instantiates a new snapping split pane. Defaults to using a horizontal
61 60
      * split, two null components and snapping to the left component.
61
+     *
62
+     * @param manager Config manager to read values from
62 63
      */
63
-    public SplitPane() {
64
-        this(Orientation.HORIZONTAL, null, null);
64
+    public SplitPane(final ConfigManager manager) {
65
+        this(manager, Orientation.HORIZONTAL, null, null);
65 66
     }
66 67
 
67 68
     /**
68 69
      * Instantiates a new snapping split pane. Defaults to using a horizontal
69 70
      * split, two null components and snapping to the left component.
70 71
      *
72
+     * @param manager Config manager to read values from
71 73
      * @param orientation Split pane orientation
72 74
      */
73
-    public SplitPane(final Orientation orientation) {
74
-        this(orientation, null, null);
75
+    public SplitPane(final ConfigManager manager, final Orientation orientation) {
76
+        this(manager, orientation, null, null);
75 77
     }
76 78
 
77 79
     /**
78 80
      * Instantiates a new snapping split pane. Defaults to using two null
79 81
      * components.
80 82
      *
83
+     * @param manager Config manager to read values from
81 84
      * @param orientation Split pane orientation
82 85
      * <code>JSplitPane.HORIZONTAL_SPLIT</code> or
83 86
      * <code>JSplitPane.VERTICAL_SPLIT</code>
84 87
      * @param leftComponent left component
85 88
      * @param rightComponent right component
86 89
      */
87
-    public SplitPane(final Orientation orientation,
90
+    public SplitPane(final ConfigManager manager, final Orientation orientation,
88 91
             final Component leftComponent, final Component rightComponent) {
89 92
         super((orientation.equals(Orientation.HORIZONTAL))
90 93
                 ? HORIZONTAL_SPLIT : VERTICAL_SPLIT,
91 94
                 true, leftComponent, rightComponent);
92 95
 
93
-        config = IdentityManager.getGlobalConfig();
96
+        config = manager;
94 97
         useOneTouchExpandable = config.getOptionBool(
95 98
                 "ui", "useOneTouchExpandable");
96 99
 

+ 7
- 8
src/com/dmdirc/addons/ui_swing/components/SwingSearchBar.java Целия файл

@@ -28,7 +28,6 @@ import com.dmdirc.addons.ui_swing.components.frames.InputTextFrame;
28 28
 import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
29 29
 import com.dmdirc.addons.ui_swing.components.validating.ValidatingJTextField;
30 30
 import com.dmdirc.addons.ui_swing.textpane.TextPane;
31
-import com.dmdirc.config.IdentityManager;
32 31
 import com.dmdirc.interfaces.ConfigChangeListener;
33 32
 import com.dmdirc.interfaces.ui.SearchBar;
34 33
 import com.dmdirc.interfaces.ui.SearchBar.Direction;
@@ -70,7 +69,7 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
70 69
     /** Frame parent. */
71 70
     private final TextFrame parent;
72 71
     /** Close button. */
73
-    private ImageButton closeButton;
72
+    private ImageButton<Object> closeButton;
74 73
     /** Next match button. */
75 74
     private JButton nextButton;
76 75
     /** Previous match button. */
@@ -112,7 +111,7 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
112 111
 
113 112
     /** Initialises components. */
114 113
     private void initComponents() {
115
-        closeButton = new ImageButton("close",
114
+        closeButton = new ImageButton<Object>("close",
116 115
                 parent.getIconManager().getIcon("close-inactive"),
117 116
                 parent.getIconManager().getIcon("close-active"));
118 117
         nextButton = new JButton();
@@ -157,9 +156,9 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
157 156
         caseCheck.addActionListener(this);
158 157
         searchBox.getDocument().addDocumentListener(this);
159 158
 
160
-        IdentityManager.getGlobalConfig().addChangeListener(
159
+        parent.getController().getGlobalConfig().addChangeListener(
161 160
                 "ui", "backgroundcolour", this);
162
-        IdentityManager.getGlobalConfig().addChangeListener(
161
+        parent.getController().getGlobalConfig().addChangeListener(
163 162
                 "ui", "foregroundcolour", this);
164 163
     }
165 164
 
@@ -409,13 +408,13 @@ public final class SwingSearchBar extends JPanel implements ActionListener,
409 408
     /** Sets the colours used in this document. */
410 409
     private void setColours() {
411 410
         searchBox.setForeground(UIUtilities.convertColour(
412
-                IdentityManager.getGlobalConfig().
411
+                parent.getController().getGlobalConfig().
413 412
                 getOptionColour("ui", "foregroundcolour")));
414 413
         searchBox.setBackground(UIUtilities.convertColour(
415
-                IdentityManager.getGlobalConfig().
414
+                parent.getController().getGlobalConfig().
416 415
                 getOptionColour("ui", "backgroundcolour")));
417 416
         searchBox.setCaretColor(UIUtilities.convertColour(
418
-                IdentityManager.getGlobalConfig().
417
+                parent.getController().getGlobalConfig().
419 418
                 getOptionColour("ui", "foregroundcolour")));
420 419
     }
421 420
 }

+ 2
- 1
src/com/dmdirc/addons/ui_swing/components/frames/ChannelFrame.java Целия файл

@@ -130,7 +130,8 @@ public final class ChannelFrame extends InputTextFrame implements ActionListener
130 130
         topicBar.setVisible(getContainer().getConfigManager().getOptionBool(
131 131
                 getController().getDomain(), "showtopicbar"));
132 132
 
133
-        splitPane = new SplitPane(SplitPane.Orientation.HORIZONTAL);
133
+        splitPane = new SplitPane(controller.getGlobalConfig(),
134
+                SplitPane.Orientation.HORIZONTAL);
134 135
 
135 136
         setLayout(new MigLayout("fill, ins 0, hidemode 3, wrap 1"));
136 137
 

+ 5
- 3
src/com/dmdirc/addons/ui_swing/dialogs/prefs/SwingPreferencesDialog.java Целия файл

@@ -31,7 +31,6 @@ import com.dmdirc.addons.ui_swing.components.addonpanel.PluginPanel;
31 31
 import com.dmdirc.addons.ui_swing.components.addonpanel.ThemePanel;
32 32
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
33 33
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingRestartDialog;
34
-import com.dmdirc.config.IdentityManager;
35 34
 import com.dmdirc.config.prefs.PreferencesCategory;
36 35
 import com.dmdirc.config.prefs.PreferencesDialogModel;
37 36
 import com.dmdirc.logger.ErrorLevel;
@@ -69,6 +68,8 @@ public final class SwingPreferencesDialog extends StandardDialog implements
69 68
     private static final long serialVersionUID = 9;
70 69
     /** Previously instantiated instance of SwingPreferencesDialog. */
71 70
     private static volatile SwingPreferencesDialog me;
71
+    /** Parent UI Controller. */
72
+    private final SwingController controller;
72 73
     /** Preferences tab list, used to switch option types. */
73 74
     private JList tabList;
74 75
     /** Main panel. */
@@ -92,6 +93,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
92 93
     private SwingPreferencesDialog(final SwingController controller) {
93 94
         super(controller.getMainFrame(), ModalityType.MODELESS);
94 95
 
96
+        this.controller = controller;
95 97
         this.parentWindow = controller.getMainFrame();
96 98
 
97 99
         initComponents();
@@ -272,7 +274,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
272 274
             if (tabList.getSelectedIndex() > -1) {
273 275
                 final PreferencesCategory node = (PreferencesCategory) tabList.
274 276
                         getSelectedValue();
275
-                IdentityManager.getConfigIdentity().setOption("dialogstate",
277
+                controller.getGlobalIdentity().setOption("dialogstate",
276 278
                         "preferences", node.getPath());
277 279
             }
278 280
             saveOptions();
@@ -346,7 +348,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
346 348
     }
347 349
 
348 350
     private void restoreActiveCategory() {
349
-        final String oldCategoryPath = IdentityManager.getGlobalConfig().
351
+        final String oldCategoryPath = controller.getGlobalConfig().
350 352
                 getOption("dialogstate", "preferences");
351 353
         final DefaultListModel model = (DefaultListModel) tabList.getModel();
352 354
         int indexToSelect = 0;

Loading…
Отказ
Запис