Просмотр исходного кода

Pass in CommandControllers to some plugin commands

I got bored about half way through, so more to go at some point.

Change-Id: Id1d18950a69090439ee66ae9e5c8ae874bd30fc4
Reviewed-on: http://gerrit.dmdirc.com/2807
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8
Chris Smith 10 лет назад
Родитель
Сommit
c6ed9e1029
38 измененных файлов: 194 добавлений и 51 удалений
  1. 5
    2
      src/com/dmdirc/addons/activewindow/ActiveCommand.java
  2. 1
    1
      src/com/dmdirc/addons/activewindow/ActiveWindowPlugin.java
  3. 10
    0
      src/com/dmdirc/addons/audio/AudioCommand.java
  4. 2
    2
      src/com/dmdirc/addons/audio/AudioPlugin.java
  5. 10
    0
      src/com/dmdirc/addons/audio/BeepCommand.java
  6. 10
    0
      src/com/dmdirc/addons/calc/CalcCommand.java
  7. 1
    1
      src/com/dmdirc/addons/calc/CalcPlugin.java
  8. 15
    3
      src/com/dmdirc/addons/conditional_execute/ConditionalExecuteCommand.java
  9. 1
    1
      src/com/dmdirc/addons/conditional_execute/ConditionalExecutePlugin.java
  10. 10
    0
      src/com/dmdirc/addons/contactlist/ContactListCommand.java
  11. 1
    1
      src/com/dmdirc/addons/contactlist/ContactListPlugin.java
  12. 4
    1
      src/com/dmdirc/addons/dcc/DCCCommand.java
  13. 1
    1
      src/com/dmdirc/addons/dcc/DCCPlugin.java
  14. 11
    1
      src/com/dmdirc/addons/dcop/DcopCommand.java
  15. 1
    1
      src/com/dmdirc/addons/dcop/DcopPlugin.java
  16. 10
    0
      src/com/dmdirc/addons/dns/DNSCommand.java
  17. 1
    1
      src/com/dmdirc/addons/dns/DNSPlugin.java
  18. 10
    0
      src/com/dmdirc/addons/exec/ExecCommand.java
  19. 1
    1
      src/com/dmdirc/addons/exec/ExecPlugin.java
  20. 4
    2
      src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java
  21. 1
    1
      src/com/dmdirc/addons/freedesktop_notifications/FreeDesktopNotificationsPlugin.java
  22. 13
    5
      src/com/dmdirc/addons/logging/LoggingCommand.java
  23. 1
    1
      src/com/dmdirc/addons/logging/LoggingPlugin.java
  24. 11
    1
      src/com/dmdirc/addons/nma/NotifyMyAndroidCommand.java
  25. 3
    1
      src/com/dmdirc/addons/nma/NotifyMyAndroidPlugin.java
  26. 4
    2
      src/com/dmdirc/addons/notifications/NotificationCommand.java
  27. 1
    1
      src/com/dmdirc/addons/notifications/NotificationsPlugin.java
  28. 18
    5
      src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java
  29. 1
    1
      src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java
  30. 5
    3
      src/com/dmdirc/addons/osd/OsdCommand.java
  31. 1
    1
      src/com/dmdirc/addons/osd/OsdPlugin.java
  32. 8
    4
      src/com/dmdirc/addons/osx_integration/DockBounceCommand.java
  33. 1
    1
      src/com/dmdirc/addons/osx_integration/OsxIntegrationPlugin.java
  34. 1
    1
      src/com/dmdirc/addons/parserdebug/DebugPlugin.java
  35. 4
    2
      src/com/dmdirc/addons/parserdebug/ParserDebugCommand.java
  36. 10
    0
      src/com/dmdirc/addons/redirect/RedirectCommand.java
  37. 1
    1
      src/com/dmdirc/addons/redirect/RedirectPlugin.java
  38. 1
    1
      test/com/dmdirc/addons/redirect/RedirectCommandTest.java

+ 5
- 2
src/com/dmdirc/addons/activewindow/ActiveCommand.java Просмотреть файл

@@ -32,6 +32,7 @@ import com.dmdirc.commandparser.CommandType;
32 32
 import com.dmdirc.commandparser.commands.Command;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
+import com.dmdirc.interfaces.CommandController;
35 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 37
 import com.dmdirc.ui.input.TabCompleter;
37 38
 
@@ -51,10 +52,12 @@ public class ActiveCommand extends Command implements IntelligentCommand {
51 52
     /**
52 53
      * Creates a new active command.
53 54
      *
55
+     * @param controller The controller to use for command information.
54 56
      * @param mainFrame Parent MainFrame
55 57
      */
56
-    public ActiveCommand(final MainFrame mainFrame) {
57
-        super();
58
+    public ActiveCommand(final CommandController controller, final MainFrame mainFrame) {
59
+        super(controller);
60
+
58 61
         this.mainFrame = mainFrame;
59 62
     }
60 63
 

+ 1
- 1
src/com/dmdirc/addons/activewindow/ActiveWindowPlugin.java Просмотреть файл

@@ -45,7 +45,7 @@ public final class ActiveWindowPlugin extends BaseCommandPlugin {
45 45
 
46 46
         sink = new ActiveWindowMessageSink(controller.getMainFrame());
47 47
 
48
-        registerCommand(new ActiveCommand(controller.getMainFrame()),
48
+        registerCommand(new ActiveCommand(commandController, controller.getMainFrame()),
49 49
                 ActiveCommand.INFO);
50 50
     }
51 51
 

+ 10
- 0
src/com/dmdirc/addons/audio/AudioCommand.java Просмотреть файл

@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandInfo;
29 29
 import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 
33 34
 import java.io.File;
34 35
 
@@ -41,6 +42,15 @@ public class AudioCommand extends Command {
41 42
     public static final CommandInfo INFO = new BaseCommandInfo("audio",
42 43
             "audio <file> - plays the specified file", CommandType.TYPE_GLOBAL);
43 44
 
45
+    /**
46
+     * Creates a new instance of this command.
47
+     *
48
+     * @param controller The controller to use for command information.
49
+     */
50
+    public AudioCommand(final CommandController controller) {
51
+        super(controller);
52
+    }
53
+
44 54
     /** {@inheritDoc} */
45 55
     @Override
46 56
     public void execute(final FrameContainer origin,

+ 2
- 2
src/com/dmdirc/addons/audio/AudioPlugin.java Просмотреть файл

@@ -37,7 +37,7 @@ public final class AudioPlugin extends BaseCommandPlugin {
37 37
      */
38 38
     public AudioPlugin(final CommandController commandController) {
39 39
         super(commandController);
40
-        registerCommand(new AudioCommand(), AudioCommand.INFO);
41
-        registerCommand(new BeepCommand(), BeepCommand.INFO);
40
+        registerCommand(new AudioCommand(commandController), AudioCommand.INFO);
41
+        registerCommand(new BeepCommand(commandController), BeepCommand.INFO);
42 42
     }
43 43
 }

+ 10
- 0
src/com/dmdirc/addons/audio/BeepCommand.java Просмотреть файл

@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandInfo;
29 29
 import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 
33 34
 import java.awt.Toolkit;
34 35
 
@@ -41,6 +42,15 @@ public class BeepCommand extends Command {
41 42
     public static final CommandInfo INFO = new BaseCommandInfo("beep",
42 43
             "beep - emits a beep", CommandType.TYPE_GLOBAL);
43 44
 
45
+    /**
46
+     * Creates a new instance of this command.
47
+     *
48
+     * @param controller The controller to use for command information.
49
+     */
50
+    public BeepCommand(final CommandController controller) {
51
+        super(controller);
52
+    }
53
+
44 54
     /** {@inheritDoc} */
45 55
     @Override
46 56
     public void execute(final FrameContainer origin,

+ 10
- 0
src/com/dmdirc/addons/calc/CalcCommand.java Просмотреть файл

@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandInfo;
29 29
 import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 
33 34
 import java.text.ParseException;
34 35
 
@@ -43,6 +44,15 @@ public class CalcCommand extends Command {
43 44
             "calc [--showexpr] <expr> - evaluate mathematical expression",
44 45
             CommandType.TYPE_GLOBAL) ;
45 46
 
47
+    /**
48
+     * Creates a new instance of this command.
49
+     *
50
+     * @param controller The controller to use for command information.
51
+     */
52
+    public CalcCommand(final CommandController controller) {
53
+        super(controller);
54
+    }
55
+
46 56
     /** {@inheritDoc} */
47 57
     @Override
48 58
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/calc/CalcPlugin.java Просмотреть файл

@@ -37,6 +37,6 @@ public class CalcPlugin extends BaseCommandPlugin {
37 37
      */
38 38
     public CalcPlugin(final CommandController commandController) {
39 39
         super(commandController);
40
-        registerCommand(new CalcCommand(), CalcCommand.INFO);
40
+        registerCommand(new CalcCommand(commandController), CalcCommand.INFO);
41 41
     }
42 42
 }

+ 15
- 3
src/com/dmdirc/addons/conditional_execute/ConditionalExecuteCommand.java Просмотреть файл

@@ -29,6 +29,8 @@ import com.dmdirc.commandparser.CommandArguments;
29 29
 import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
33
+
32 34
 import java.util.HashMap;
33 35
 import java.util.Map;
34 36
 
@@ -38,11 +40,21 @@ import java.util.Map;
38 40
  */
39 41
 public class ConditionalExecuteCommand extends Command {
40 42
 
43
+    /** A command info object for this command. */
44
+    public static final BaseCommandInfo INFO = new BaseCommandInfo("conditionalexecute",
45
+            "conditionalexecute <args> - Conditionally execute a command", CommandType.TYPE_GLOBAL);
46
+
41 47
     /** Store details about current namespaces. */
42
-    private final Map<String, ConditionalExecuteNamespace> namespaces = new HashMap<String, ConditionalExecuteNamespace>();
48
+    private final Map<String, ConditionalExecuteNamespace> namespaces = new HashMap<>();
43 49
 
44
-    /** A command info object for this command. */
45
-    public static final BaseCommandInfo INFO = new BaseCommandInfo("conditionalexecute", "conditionalexecute <args> - Conditionally execute a command", CommandType.TYPE_GLOBAL);
50
+    /**
51
+     * Creates a new instance of this command.
52
+     *
53
+     * @param controller The controller to use for command information.
54
+     */
55
+    public ConditionalExecuteCommand(final CommandController controller) {
56
+        super(controller);
57
+    }
46 58
 
47 59
     /** {@inheritDoc} */
48 60
     @Override

+ 1
- 1
src/com/dmdirc/addons/conditional_execute/ConditionalExecutePlugin.java Просмотреть файл

@@ -38,6 +38,6 @@ public final class ConditionalExecutePlugin extends BaseCommandPlugin {
38 38
      */
39 39
     public ConditionalExecutePlugin(final CommandController commandController) {
40 40
         super(commandController);
41
-        registerCommand(new ConditionalExecuteCommand(), ConditionalExecuteCommand.INFO);
41
+        registerCommand(new ConditionalExecuteCommand(commandController), ConditionalExecuteCommand.INFO);
42 42
     }
43 43
 }

+ 10
- 0
src/com/dmdirc/addons/contactlist/ContactListCommand.java Просмотреть файл

@@ -31,6 +31,7 @@ import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
+import com.dmdirc.interfaces.CommandController;
34 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
35 36
 
36 37
 /**
@@ -43,6 +44,15 @@ public class ContactListCommand extends Command implements IntelligentCommand {
43 44
             "contactlist - show a contact list for the current channel",
44 45
             CommandType.TYPE_CHANNEL) ;
45 46
 
47
+    /**
48
+     * Creates a new instance of this command.
49
+     *
50
+     * @param controller The controller to use for command information.
51
+     */
52
+    public ContactListCommand(final CommandController controller) {
53
+        super(controller);
54
+    }
55
+
46 56
     /** {@inheritDoc} */
47 57
     @Override
48 58
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/contactlist/ContactListPlugin.java Просмотреть файл

@@ -37,6 +37,6 @@ public final class ContactListPlugin extends BaseCommandPlugin {
37 37
      */
38 38
     public ContactListPlugin(final CommandController commandController) {
39 39
         super(commandController);
40
-        registerCommand(new ContactListCommand(), ContactListCommand.INFO);
40
+        registerCommand(new ContactListCommand(commandController), ContactListCommand.INFO);
41 41
     }
42 42
 }

+ 4
- 1
src/com/dmdirc/addons/dcc/DCCCommand.java Просмотреть файл

@@ -40,6 +40,7 @@ import com.dmdirc.commandparser.commands.Command;
40 40
 import com.dmdirc.commandparser.commands.IntelligentCommand;
41 41
 import com.dmdirc.commandparser.commands.context.CommandContext;
42 42
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
43
+import com.dmdirc.interfaces.CommandController;
43 44
 import com.dmdirc.parser.interfaces.Parser;
44 45
 import com.dmdirc.ui.input.AdditionalTabTargets;
45 46
 import com.dmdirc.ui.input.TabCompletionType;
@@ -68,10 +69,12 @@ public class DCCCommand extends Command implements IntelligentCommand {
68 69
     /**
69 70
      * Creates a new instance of DCCCommand.
70 71
      *
72
+     * @param controller The controller to use for command information.
71 73
      * @param mainFrame mainFrame instance to use
72 74
      * @param plugin The DCC Plugin that this command belongs to
73 75
      */
74
-    public DCCCommand(final MainFrame mainFrame, final DCCPlugin plugin) {
76
+    public DCCCommand(final CommandController controller, final MainFrame mainFrame, final DCCPlugin plugin) {
77
+        super(controller);
75 78
         this.mainFrame = mainFrame;
76 79
         myPlugin = plugin;
77 80
     }

+ 1
- 1
src/com/dmdirc/addons/dcc/DCCPlugin.java Просмотреть файл

@@ -95,7 +95,7 @@ public class DCCPlugin extends BaseCommandPlugin implements ActionListener {
95 95
         this.controller = controller;
96 96
         config = controller.getGlobalConfig();
97 97
         this.pluginInfo = pluginInfo;
98
-        registerCommand(new DCCCommand(controller.getMainFrame(), this),
98
+        registerCommand(new DCCCommand(commandController, controller.getMainFrame(), this),
99 99
                 DCCCommand.INFO);
100 100
         final SwingWindowFactory factory = controller.getWindowFactory();
101 101
         factory.registerImplementation(new HashSet<>(Arrays.asList(

+ 11
- 1
src/com/dmdirc/addons/dcop/DcopCommand.java Просмотреть файл

@@ -29,19 +29,29 @@ import com.dmdirc.commandparser.CommandInfo;
29 29
 import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 
33 34
 import java.util.List;
34 35
 
35 36
 /**
36 37
  * The dcop command retrieves information from a dcop application.
37 38
  */
38
-public final class DcopCommand extends Command {
39
+public class DcopCommand extends Command {
39 40
 
40 41
     /** A command info object for this command. */
41 42
     public static final CommandInfo INFO = new BaseCommandInfo("dcop",
42 43
             "dcop <app> <object> <function> - retrieves information from a DCOP aplication",
43 44
             CommandType.TYPE_SERVER);
44 45
 
46
+    /**
47
+     * Creates a new instance of this command.
48
+     *
49
+     * @param controller The controller to use for command information.
50
+     */
51
+    public DcopCommand(final CommandController controller) {
52
+        super(controller);
53
+    }
54
+
45 55
     /** {@inheritDoc} */
46 56
     @Override
47 57
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/dcop/DcopPlugin.java Просмотреть файл

@@ -43,7 +43,7 @@ public final class DcopPlugin extends BaseCommandPlugin {
43 43
      */
44 44
     public DcopPlugin(final CommandController commandController) {
45 45
         super(commandController);
46
-        registerCommand(new DcopCommand(), DcopCommand.INFO);
46
+        registerCommand(new DcopCommand(commandController), DcopCommand.INFO);
47 47
     }
48 48
 
49 49
     /**

+ 10
- 0
src/com/dmdirc/addons/dns/DNSCommand.java Просмотреть файл

@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandInfo;
29 29
 import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 
33 34
 import java.util.Timer;
34 35
 import java.util.TimerTask;
@@ -43,6 +44,15 @@ public class DNSCommand extends Command {
43 44
             "dns <IP|hostname> - Performs DNS lookup of the specified ip/hostname/nickname",
44 45
             CommandType.TYPE_GLOBAL);
45 46
 
47
+    /**
48
+     * Creates a new instance of this command.
49
+     *
50
+     * @param controller The controller to use for command information.
51
+     */
52
+    public DNSCommand(final CommandController controller) {
53
+        super(controller);
54
+    }
55
+
46 56
     /** {@inheritDoc} */
47 57
     @Override
48 58
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/dns/DNSPlugin.java Просмотреть файл

@@ -43,7 +43,7 @@ public final class DNSPlugin extends BaseCommandPlugin {
43 43
      */
44 44
     public DNSPlugin(final CommandController commandController) {
45 45
         super(commandController);
46
-        registerCommand(new DNSCommand(), DNSCommand.INFO);
46
+        registerCommand(new DNSCommand(commandController), DNSCommand.INFO);
47 47
     }
48 48
 
49 49
     /**

+ 10
- 0
src/com/dmdirc/addons/exec/ExecCommand.java Просмотреть файл

@@ -28,6 +28,7 @@ import com.dmdirc.commandparser.CommandArguments;
28 28
 import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.commandparser.commands.context.CommandContext;
31
+import com.dmdirc.interfaces.CommandController;
31 32
 import com.dmdirc.logger.ErrorLevel;
32 33
 import com.dmdirc.logger.Logger;
33 34
 import com.dmdirc.util.CommandUtils;
@@ -48,6 +49,15 @@ public class ExecCommand extends Command {
48 49
             "exec <command> [<parameters>] - executes an external program "
49 50
             + "and displays the output", CommandType.TYPE_GLOBAL);
50 51
 
52
+    /**
53
+     * Creates a new instance of this command.
54
+     *
55
+     * @param controller The controller to use for command information.
56
+     */
57
+    public ExecCommand(final CommandController controller) {
58
+        super(controller);
59
+    }
60
+
51 61
     /** {@inheritDoc} */
52 62
     @Override
53 63
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/exec/ExecPlugin.java Просмотреть файл

@@ -37,6 +37,6 @@ public class ExecPlugin extends BaseCommandPlugin {
37 37
      */
38 38
     public ExecPlugin(final CommandController commandController) {
39 39
         super(commandController);
40
-        registerCommand(new ExecCommand(), ExecCommand.INFO);
40
+        registerCommand(new ExecCommand(commandController), ExecCommand.INFO);
41 41
     }
42 42
 }

+ 4
- 2
src/com/dmdirc/addons/freedesktop_notifications/FDNotifyCommand.java Просмотреть файл

@@ -28,6 +28,7 @@ import com.dmdirc.commandparser.CommandArguments;
28 28
 import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.commandparser.commands.context.CommandContext;
31
+import com.dmdirc.interfaces.CommandController;
31 32
 
32 33
 /**
33 34
  * The FDNotify Command shows a nice popup on using the FreeDesktop
@@ -45,10 +46,11 @@ public final class FDNotifyCommand extends Command {
45 46
     /**
46 47
      * Creates a new instance of FDNotifyCommand.
47 48
      *
49
+     * @param controller The controller to use for command information.
48 50
      * @param myPlugin the plugin creating this command.
49 51
      */
50
-    public FDNotifyCommand(final FreeDesktopNotificationsPlugin myPlugin) {
51
-        super();
52
+    public FDNotifyCommand(final CommandController controller, final FreeDesktopNotificationsPlugin myPlugin) {
53
+        super(controller);
52 54
         this.myPlugin = myPlugin;
53 55
     }
54 56
 

+ 1
- 1
src/com/dmdirc/addons/freedesktop_notifications/FreeDesktopNotificationsPlugin.java Просмотреть файл

@@ -84,7 +84,7 @@ public class FreeDesktopNotificationsPlugin extends BaseCommandPlugin implements
84 84
         this.filesHelper = new PluginFilesHelper(pluginInfo);
85 85
         config = identityController.getGlobalConfiguration();
86 86
         identity = identityController.getAddonSettings();
87
-        registerCommand(new FDNotifyCommand(this), FDNotifyCommand.INFO);
87
+        registerCommand(new FDNotifyCommand(commandController, this), FDNotifyCommand.INFO);
88 88
     }
89 89
 
90 90
     /**

+ 13
- 5
src/com/dmdirc/addons/logging/LoggingCommand.java Просмотреть файл

@@ -29,16 +29,13 @@ import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.commandparser.commands.IntelligentCommand;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 import com.dmdirc.ui.input.AdditionalTabTargets;
33 34
 
34
-import lombok.AllArgsConstructor;
35
-
36 35
 /**
37 36
  * The dcop command retrieves information from a dcop application.
38 37
  */
39
-@AllArgsConstructor
40
-public final class LoggingCommand extends Command implements
41
-        IntelligentCommand {
38
+public class LoggingCommand extends Command implements IntelligentCommand {
42 39
 
43 40
     /** Command name. */
44 41
     private static final String LOGGING = "logging";
@@ -49,6 +46,17 @@ public final class LoggingCommand extends Command implements
49 46
     /** Logging plugin. */
50 47
     private final LoggingPlugin plugin;
51 48
 
49
+    /**
50
+     * Creates a new instance of this command.
51
+     *
52
+     * @param controller The controller to use for command information.
53
+     * @param plugin The plugin providing logging services.
54
+     */
55
+    public LoggingCommand(final CommandController controller, final LoggingPlugin plugin) {
56
+        super(controller);
57
+        this.plugin = plugin;
58
+    }
59
+
52 60
     /** {@inheritDoc} */
53 61
     @Override
54 62
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/logging/LoggingPlugin.java Просмотреть файл

@@ -126,7 +126,7 @@ public class LoggingPlugin extends BaseCommandPlugin implements ActionListener,
126 126
         config = identityController.getGlobalConfiguration();
127 127
         identity = identityController.getAddonSettings();
128 128
 
129
-        registerCommand(new LoggingCommand(this), LoggingCommand.INFO);
129
+        registerCommand(new LoggingCommand(commandController, this), LoggingCommand.INFO);
130 130
     }
131 131
 
132 132
     /** {@inheritDoc} */

+ 11
- 1
src/com/dmdirc/addons/nma/NotifyMyAndroidCommand.java Просмотреть файл

@@ -28,6 +28,7 @@ import com.dmdirc.commandparser.CommandArguments;
28 28
 import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.commandparser.commands.context.CommandContext;
31
+import com.dmdirc.interfaces.CommandController;
31 32
 
32 33
 import java.io.IOException;
33 34
 
@@ -51,12 +52,21 @@ public class NotifyMyAndroidCommand extends Command {
51 52
     @Setter
52 53
     private String configDomain;
53 54
 
55
+    /**
56
+     * Creates a new instance of this command.
57
+     *
58
+     * @param controller The controller to use for command information.
59
+     */
60
+    public NotifyMyAndroidCommand(final CommandController controller) {
61
+        super(controller);
62
+    }
63
+
54 64
     /** {@inheritDoc} */
55 65
     @Override
56 66
     public void execute(final FrameContainer origin,
57 67
             final CommandArguments args, final CommandContext context) {
58 68
         final String[] parts = args.getArgumentsAsString().split("\\s+--\\s+", 2);
59
-        log.trace("Split input: {}", parts);
69
+        log.trace("Split input: {}", (Object[]) parts);
60 70
 
61 71
         if (parts.length != 2) {
62 72
             showUsage(origin, args.isSilent(), INFO.getName(), INFO.getHelp());

+ 3
- 1
src/com/dmdirc/addons/nma/NotifyMyAndroidPlugin.java Просмотреть файл

@@ -37,7 +37,7 @@ import com.dmdirc.plugins.implementations.BaseCommandPlugin;
37 37
 public class NotifyMyAndroidPlugin extends BaseCommandPlugin {
38 38
 
39 39
     /** The command to register. */
40
-    private final NotifyMyAndroidCommand command = new NotifyMyAndroidCommand();
40
+    private final NotifyMyAndroidCommand command;
41 41
 
42 42
     /** Our info object. */
43 43
     private final PluginInfo pluginInfo;
@@ -51,6 +51,8 @@ public class NotifyMyAndroidPlugin extends BaseCommandPlugin {
51 51
     public NotifyMyAndroidPlugin(final PluginInfo pluginInfo,
52 52
             final CommandController commandController) {
53 53
         super(commandController);
54
+
55
+        command = new NotifyMyAndroidCommand(commandController);
54 56
         registerCommand(command, NotifyMyAndroidCommand.INFO);
55 57
 
56 58
         this.pluginInfo = pluginInfo;

+ 4
- 2
src/com/dmdirc/addons/notifications/NotificationCommand.java Просмотреть файл

@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.commandparser.commands.IntelligentCommand;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 import com.dmdirc.plugins.ExportedService;
33 34
 import com.dmdirc.plugins.PluginInfo;
34 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
@@ -54,10 +55,11 @@ public class NotificationCommand extends Command implements
54 55
     /**
55 56
      * Creates a new instance of this notification command.
56 57
      *
58
+     * @param controller The controller to use for command information.
57 59
      * @param parent The plugin that's instantiating this command
58 60
      */
59
-    public NotificationCommand(final NotificationsPlugin parent) {
60
-        super();
61
+    public NotificationCommand(final CommandController controller, final NotificationsPlugin parent) {
62
+        super(controller);
61 63
 
62 64
         this.parent = parent;
63 65
     }

+ 1
- 1
src/com/dmdirc/addons/notifications/NotificationsPlugin.java Просмотреть файл

@@ -67,7 +67,7 @@ public class NotificationsPlugin extends BaseCommandPlugin implements ActionList
67 67
         super(commandController);
68 68
         this.pluginInfo = pluginInfo;
69 69
         this.identityController = identityController;
70
-        registerCommand(new NotificationCommand(this),
70
+        registerCommand(new NotificationCommand(commandController, this),
71 71
                 NotificationCommand.INFO);
72 72
     }
73 73
 

+ 18
- 5
src/com/dmdirc/addons/nowplaying/NowPlayingCommand.java Просмотреть файл

@@ -31,6 +31,7 @@ import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.ChatCommandContext;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
+import com.dmdirc.interfaces.CommandController;
34 35
 import com.dmdirc.interfaces.config.IdentityController;
35 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 37
 import com.dmdirc.ui.input.TabCompleter;
@@ -38,15 +39,11 @@ import com.dmdirc.ui.input.TabCompleter;
38 39
 import java.util.Arrays;
39 40
 import java.util.List;
40 41
 
41
-import lombok.RequiredArgsConstructor;
42
-
43 42
 /**
44 43
  * The now playing command retrieves the currently playing song from a
45 44
  * variety of media players.
46 45
  */
47
-@RequiredArgsConstructor
48
-public final class NowPlayingCommand extends Command implements
49
-        IntelligentCommand {
46
+public class NowPlayingCommand extends Command implements IntelligentCommand {
50 47
 
51 48
     /** A command info object for this command. */
52 49
     public static final BaseCommandInfo INFO = new BaseCommandInfo("nowplaying",
@@ -58,6 +55,22 @@ public final class NowPlayingCommand extends Command implements
58 55
     /** The controller to read/write settings with. */
59 56
     private final IdentityController identityController;
60 57
 
58
+    /**
59
+     * Creates a new instance of this command.
60
+     *
61
+     * @param controller The controller to use for command information.
62
+     * @param parent The plugin that owns this command.
63
+     * @param identityController The controller to use to read/write settings.
64
+     */
65
+    public NowPlayingCommand(
66
+            final CommandController controller,
67
+            final NowPlayingPlugin parent,
68
+            final IdentityController identityController) {
69
+        super(controller);
70
+        this.parent = parent;
71
+        this.identityController = identityController;
72
+    }
73
+
61 74
     /** {@inheritDoc} */
62 75
     @Override
63 76
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java Просмотреть файл

@@ -78,7 +78,7 @@ public class NowPlayingPlugin extends BaseCommandPlugin implements ActionListene
78 78
         this.actionController = actionController;
79 79
         this.identityController = identityController;
80 80
 
81
-        registerCommand(new NowPlayingCommand(this, identityController), NowPlayingCommand.INFO);
81
+        registerCommand(new NowPlayingCommand(commandController, this, identityController), NowPlayingCommand.INFO);
82 82
     }
83 83
 
84 84
     /** {@inheritDoc} */

+ 5
- 3
src/com/dmdirc/addons/osd/OsdCommand.java Просмотреть файл

@@ -29,13 +29,14 @@ import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.commandparser.commands.IntelligentCommand;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 import com.dmdirc.ui.input.AdditionalTabTargets;
33 34
 import com.dmdirc.ui.messages.Styliser;
34 35
 
35 36
 /**
36 37
  * The osd command shows an on screen message.
37 38
  */
38
-public final class OsdCommand extends Command implements IntelligentCommand {
39
+public class OsdCommand extends Command implements IntelligentCommand {
39 40
 
40 41
     /** A command info object for this command. */
41 42
     public static final BaseCommandInfo INFO = new BaseCommandInfo("osd",
@@ -49,10 +50,11 @@ public final class OsdCommand extends Command implements IntelligentCommand {
49 50
     /**
50 51
      * Creates a new instance of OsdCommand.
51 52
      *
53
+     * @param controller The controller to use for command information.
52 54
      * @param osdManager OSD Manager used to control OSD windows
53 55
      */
54
-    public OsdCommand(final OsdManager osdManager) {
55
-        super();
56
+    public OsdCommand(final CommandController controller, final OsdManager osdManager) {
57
+        super(controller);
56 58
 
57 59
         this.osdManager = osdManager;
58 60
     }

+ 1
- 1
src/com/dmdirc/addons/osd/OsdPlugin.java Просмотреть файл

@@ -76,7 +76,7 @@ public final class OsdPlugin extends BaseCommandPlugin implements
76 76
         this.pluginInfo = pluginInfo;
77 77
         this.identityController = identityController;
78 78
         osdManager = new OsdManager(identityController, this);
79
-        registerCommand(new OsdCommand(osdManager), OsdCommand.INFO);
79
+        registerCommand(new OsdCommand(commandController, osdManager), OsdCommand.INFO);
80 80
     }
81 81
 
82 82
     /**

+ 8
- 4
src/com/dmdirc/addons/osx_integration/DockBounceCommand.java Просмотреть файл

@@ -29,6 +29,7 @@ import com.dmdirc.commandparser.CommandArguments;
29 29
 import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 
33 34
 /**
34 35
  * A command to bounce the icon in the OSX dock.
@@ -52,17 +53,20 @@ public class DockBounceCommand extends Command {
52 53
     /**
53 54
      * Creates an instance of {@link DockBounceCommand}.
54 55
      *
56
+     * @param controller The controller to use for command information.
55 57
      * @param apple The UI wrapper for Apple-specific things
56 58
      */
57
-    public DockBounceCommand(final Apple apple) {
59
+    public DockBounceCommand(final CommandController controller, final Apple apple) {
60
+        super(controller);
58 61
         this.apple = apple;
59 62
     }
60 63
 
61 64
     /** {@inheritDoc} */
62 65
     @Override
63
-    public void execute(final FrameContainer origin,
64
-                        final CommandArguments args,
65
-                        final CommandContext context) {
66
+    public void execute(
67
+            final FrameContainer origin,
68
+            final CommandArguments args,
69
+            final CommandContext context) {
66 70
         apple.requestUserAttention(false);
67 71
     }
68 72
 }

+ 1
- 1
src/com/dmdirc/addons/osx_integration/OsxIntegrationPlugin.java Просмотреть файл

@@ -41,7 +41,7 @@ public class OsxIntegrationPlugin extends BaseCommandPlugin {
41 41
     public OsxIntegrationPlugin(final SwingController controller,
42 42
             final CommandController commandController) {
43 43
         super(commandController);
44
-        registerCommand(new DockBounceCommand(controller.getApple()),
44
+        registerCommand(new DockBounceCommand(commandController, controller.getApple()),
45 45
                 DockBounceCommand.INFO);
46 46
     }
47 47
 }

+ 1
- 1
src/com/dmdirc/addons/parserdebug/DebugPlugin.java Просмотреть файл

@@ -61,7 +61,7 @@ public final class DebugPlugin extends BaseCommandPlugin implements
61 61
 
62 62
         this.actionController = actionController;
63 63
 
64
-        registerCommand(new ParserDebugCommand(this), ParserDebugCommand.INFO);
64
+        registerCommand(new ParserDebugCommand(commandController, this), ParserDebugCommand.INFO);
65 65
     }
66 66
 
67 67
     /** {@inheritDoc} */

+ 4
- 2
src/com/dmdirc/addons/parserdebug/ParserDebugCommand.java Просмотреть файл

@@ -30,6 +30,7 @@ import com.dmdirc.commandparser.commands.Command;
30 30
 import com.dmdirc.commandparser.commands.CommandOptions;
31 31
 import com.dmdirc.commandparser.commands.context.CommandContext;
32 32
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
33
+import com.dmdirc.interfaces.CommandController;
33 34
 import com.dmdirc.parser.interfaces.Parser;
34 35
 import com.dmdirc.parser.interfaces.callbacks.DebugInfoListener;
35 36
 
@@ -50,10 +51,11 @@ public final class ParserDebugCommand extends Command {
50 51
     /**
51 52
      * Creates a new instance of ParserDebugCommand.
52 53
      *
54
+     * @param controller The controller to use for command information.
53 55
      * @param plugin Plugin that owns this command
54 56
      */
55
-    public ParserDebugCommand(final DebugPlugin plugin) {
56
-        super();
57
+    public ParserDebugCommand(final CommandController controller, final DebugPlugin plugin) {
58
+        super(controller);
57 59
         myPlugin = plugin;
58 60
     }
59 61
 

+ 10
- 0
src/com/dmdirc/addons/redirect/RedirectCommand.java Просмотреть файл

@@ -31,6 +31,7 @@ import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.ChatCommandContext;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
+import com.dmdirc.interfaces.CommandController;
34 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
35 36
 import com.dmdirc.ui.input.TabCompleter;
36 37
 
@@ -47,6 +48,15 @@ public class RedirectCommand extends Command implements IntelligentCommand {
47 48
                 + "channel or query window",
48 49
             CommandType.TYPE_CHAT);
49 50
 
51
+    /**
52
+     * Creates a new instance of this command.
53
+     *
54
+     * @param controller The controller to use for command information.
55
+     */
56
+    public RedirectCommand(final CommandController controller) {
57
+        super(controller);
58
+    }
59
+
50 60
     /** {@inheritDoc} */
51 61
     @Override
52 62
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/addons/redirect/RedirectPlugin.java Просмотреть файл

@@ -38,6 +38,6 @@ public final class RedirectPlugin extends BaseCommandPlugin {
38 38
      */
39 39
     public RedirectPlugin(final CommandController commandController) {
40 40
         super(commandController);
41
-        registerCommand(new RedirectCommand(), RedirectCommand.INFO);
41
+        registerCommand(new RedirectCommand(commandController), RedirectCommand.INFO);
42 42
     }
43 43
 }

+ 1
- 1
test/com/dmdirc/addons/redirect/RedirectCommandTest.java Просмотреть файл

@@ -76,7 +76,7 @@ public class RedirectCommandTest {
76 76
 
77 77
     @Test
78 78
     public void testExecute() {
79
-        final RedirectCommand command = new RedirectCommand();
79
+        final RedirectCommand command = new RedirectCommand(commandController);
80 80
 
81 81
         command.execute(target, new CommandArguments(commandController, "/redirect /echo test"),
82 82
                 new ChatCommandContext(frameContainer, RedirectCommand.INFO, target));

Загрузка…
Отмена
Сохранить