Browse Source

Remove static call to MessageSinkManager.

Change-Id: I12ac463bda27bb754e7705f3d145fe3b1eb0c872
Reviewed-on: http://gerrit.dmdirc.com/2820
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Chris Smith 10 years ago
parent
commit
44636f9345
1 changed files with 13 additions and 5 deletions
  1. 13
    5
      src/com/dmdirc/addons/activewindow/ActiveWindowPlugin.java

+ 13
- 5
src/com/dmdirc/addons/activewindow/ActiveWindowPlugin.java View File

@@ -28,21 +28,29 @@ import com.dmdirc.messages.MessageSinkManager;
28 28
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
29 29
 
30 30
 /** Plugin to provide an active window command to the Swing UI. */
31
-public final class ActiveWindowPlugin extends BaseCommandPlugin {
31
+public class ActiveWindowPlugin extends BaseCommandPlugin {
32 32
 
33 33
     /** The message sink to register and unregister. */
34 34
     private final ActiveWindowMessageSink sink;
35 35
 
36
+    /** The manager to add and remove the sink from. */
37
+    private final MessageSinkManager sinkManager;
38
+
36 39
     /**
37 40
      * Creates a new instance of this plugin.
38 41
      *
39 42
      * @param controller The controller to use to find active windows
40 43
      * @param commandController Command controller to register commands
44
+     * @param sinkManager The manager to add sinks to
41 45
      */
42
-    public ActiveWindowPlugin(final SwingController controller,
43
-            final CommandController commandController) {
46
+    public ActiveWindowPlugin(
47
+            final SwingController controller,
48
+            final CommandController commandController,
49
+            final MessageSinkManager sinkManager) {
44 50
         super(commandController);
45 51
 
52
+        this.sinkManager = sinkManager;
53
+
46 54
         sink = new ActiveWindowMessageSink(controller.getMainFrame());
47 55
 
48 56
         registerCommand(new ActiveCommand(commandController, controller.getMainFrame()),
@@ -54,7 +62,7 @@ public final class ActiveWindowPlugin extends BaseCommandPlugin {
54 62
     public void onLoad() {
55 63
         super.onLoad();
56 64
 
57
-        MessageSinkManager.getManager().addSink(sink);
65
+        sinkManager.addSink(sink);
58 66
     }
59 67
 
60 68
     /** {@inheritDoc} */
@@ -62,6 +70,6 @@ public final class ActiveWindowPlugin extends BaseCommandPlugin {
62 70
     public void onUnload() {
63 71
         super.onUnload();
64 72
 
65
-        MessageSinkManager.getManager().removeSink(sink);
73
+        sinkManager.removeSink(sink);
66 74
     }
67 75
 }

Loading…
Cancel
Save