|
@@ -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
|
}
|