Browse Source

Inject all the commands.

Instead of manually tracking dependencies and creating them in
CommandLoader, just have a module to provide a set of commands
that we can load.

This makes it stupidly easy to add dependencies in commands.

Also rename the /set command from Set because that's just
confusing.

Change-Id: I7967609e356de3c17d0942ebc913be438debe49c
Reviewed-on: http://gerrit.dmdirc.com/2722
Automatic-Compile: DMDirc Build Manager
Reviewed-by: Greg Holmes <greg@dmdirc.com>
tags/0.8rc1
Chris Smith 10 years ago
parent
commit
1d439133aa
48 changed files with 866 additions and 212 deletions
  1. 29
    1
      src/com/dmdirc/ClientModule.java
  2. 10
    6
      src/com/dmdirc/Main.java
  3. 0
    201
      src/com/dmdirc/commandparser/CommandLoader.java
  4. 578
    0
      src/com/dmdirc/commandparser/commands/CommandModule.java
  5. 2
    0
      src/com/dmdirc/commandparser/commands/channel/Ban.java
  6. 7
    0
      src/com/dmdirc/commandparser/commands/channel/Cycle.java
  7. 7
    0
      src/com/dmdirc/commandparser/commands/channel/Invite.java
  8. 2
    0
      src/com/dmdirc/commandparser/commands/channel/KickReason.java
  9. 7
    0
      src/com/dmdirc/commandparser/commands/channel/Mode.java
  10. 7
    0
      src/com/dmdirc/commandparser/commands/channel/Names.java
  11. 7
    0
      src/com/dmdirc/commandparser/commands/channel/Part.java
  12. 3
    0
      src/com/dmdirc/commandparser/commands/channel/SetNickColour.java
  13. 7
    0
      src/com/dmdirc/commandparser/commands/channel/ShowTopic.java
  14. 7
    0
      src/com/dmdirc/commandparser/commands/chat/Me.java
  15. 3
    0
      src/com/dmdirc/commandparser/commands/global/AliasCommand.java
  16. 3
    0
      src/com/dmdirc/commandparser/commands/global/AllServers.java
  17. 7
    0
      src/com/dmdirc/commandparser/commands/global/Clear.java
  18. 3
    0
      src/com/dmdirc/commandparser/commands/global/Echo.java
  19. 3
    0
      src/com/dmdirc/commandparser/commands/global/Exit.java
  20. 7
    0
      src/com/dmdirc/commandparser/commands/global/Help.java
  21. 3
    0
      src/com/dmdirc/commandparser/commands/global/Ifplugin.java
  22. 3
    0
      src/com/dmdirc/commandparser/commands/global/LoadPlugin.java
  23. 3
    0
      src/com/dmdirc/commandparser/commands/global/NewServer.java
  24. 3
    0
      src/com/dmdirc/commandparser/commands/global/Notify.java
  25. 7
    0
      src/com/dmdirc/commandparser/commands/global/OpenWindow.java
  26. 7
    0
      src/com/dmdirc/commandparser/commands/global/ReloadActions.java
  27. 3
    0
      src/com/dmdirc/commandparser/commands/global/ReloadIdentities.java
  28. 3
    0
      src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java
  29. 3
    0
      src/com/dmdirc/commandparser/commands/global/SaveConfig.java
  30. 5
    2
      src/com/dmdirc/commandparser/commands/global/SetCommand.java
  31. 3
    0
      src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java
  32. 7
    0
      src/com/dmdirc/commandparser/commands/server/AllChannels.java
  33. 7
    0
      src/com/dmdirc/commandparser/commands/server/Away.java
  34. 7
    0
      src/com/dmdirc/commandparser/commands/server/Back.java
  35. 7
    0
      src/com/dmdirc/commandparser/commands/server/ChangeServer.java
  36. 7
    0
      src/com/dmdirc/commandparser/commands/server/Ctcp.java
  37. 7
    0
      src/com/dmdirc/commandparser/commands/server/Disconnect.java
  38. 7
    0
      src/com/dmdirc/commandparser/commands/server/Ignore.java
  39. 3
    0
      src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java
  40. 7
    0
      src/com/dmdirc/commandparser/commands/server/Message.java
  41. 7
    0
      src/com/dmdirc/commandparser/commands/server/Nick.java
  42. 7
    0
      src/com/dmdirc/commandparser/commands/server/Notice.java
  43. 7
    0
      src/com/dmdirc/commandparser/commands/server/OpenQuery.java
  44. 7
    0
      src/com/dmdirc/commandparser/commands/server/Raw.java
  45. 7
    0
      src/com/dmdirc/commandparser/commands/server/Reconnect.java
  46. 7
    0
      src/com/dmdirc/commandparser/commands/server/Umode.java
  47. 21
    0
      src/com/dmdirc/interfaces/CommandController.java
  48. 2
    2
      test/com/dmdirc/TestMain.java

+ 29
- 1
src/com/dmdirc/ClientModule.java View File

@@ -31,6 +31,7 @@ import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
31 31
 import com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
32 32
 import com.dmdirc.commandline.CommandLineParser;
33 33
 import com.dmdirc.commandparser.CommandManager;
34
+import com.dmdirc.commandparser.commands.CommandModule;
34 35
 import com.dmdirc.config.ConfigManager;
35 36
 import com.dmdirc.config.IdentityManager;
36 37
 import com.dmdirc.config.InvalidIdentityFileException;
@@ -38,7 +39,9 @@ import com.dmdirc.config.prefs.PreferencesManager;
38 39
 import com.dmdirc.interfaces.ActionController;
39 40
 import com.dmdirc.interfaces.CommandController;
40 41
 import com.dmdirc.interfaces.IdentityController;
42
+import com.dmdirc.interfaces.IdentityFactory;
41 43
 import com.dmdirc.interfaces.LifecycleController;
44
+import com.dmdirc.interfaces.ServerFactory;
42 45
 import com.dmdirc.logger.ErrorLevel;
43 46
 import com.dmdirc.logger.Logger;
44 47
 import com.dmdirc.messages.MessageSinkManager;
@@ -70,7 +73,10 @@ import dagger.Provides;
70 73
 /**
71 74
  * Provides dependencies for the client.
72 75
  */
73
-@Module(injects = {Main.class, CommandLineParser.class}, includes = CommandLineOptionsModule.class)
76
+@Module(
77
+    injects = {Main.class, CommandLineParser.class},
78
+    includes = {CommandLineOptionsModule.class, CommandModule.class}
79
+)
74 80
 public class ClientModule {
75 81
 
76 82
     /**
@@ -394,6 +400,28 @@ public class ClientModule {
394 400
         return PreferencesManager.getPreferencesManager();
395 401
     }
396 402
 
403
+    /**
404
+     * Gets a server factory.
405
+     *
406
+     * @param serverManager The manager to use as a factory.
407
+     * @return A server factory.
408
+     */
409
+    @Provides
410
+    public ServerFactory getServerFactory(final ServerManager serverManager) {
411
+        return serverManager;
412
+    }
413
+
414
+    /**
415
+     * Gets an identity factory.
416
+     *
417
+     * @param identityManager  The manager to use as a factory.
418
+     * @return An identity factory.
419
+     */
420
+    @Provides
421
+    public IdentityFactory getIdentityFactory(final IdentityManager identityManager) {
422
+        return identityManager;
423
+    }
424
+
397 425
     /**
398 426
      * Called when the global config cannot be loaded due to an error. This
399 427
      * method informs the user of the problem and installs a new default config

+ 10
- 6
src/com/dmdirc/Main.java View File

@@ -25,9 +25,9 @@ package com.dmdirc;
25 25
 import com.dmdirc.actions.ActionManager;
26 26
 import com.dmdirc.actions.CoreActionType;
27 27
 import com.dmdirc.commandline.CommandLineParser;
28
-import com.dmdirc.commandparser.CommandLoader;
29 28
 import com.dmdirc.commandparser.CommandManager;
30 29
 import com.dmdirc.config.IdentityManager;
30
+import com.dmdirc.interfaces.CommandController.CommandDetails;
31 31
 import com.dmdirc.interfaces.ui.UIController;
32 32
 import com.dmdirc.logger.DMDircExceptionHandler;
33 33
 import com.dmdirc.logger.ErrorLevel;
@@ -44,6 +44,7 @@ import java.awt.GraphicsEnvironment;
44 44
 import java.util.Collection;
45 45
 import java.util.HashSet;
46 46
 import java.util.List;
47
+import java.util.Set;
47 48
 import java.util.Timer;
48 49
 import java.util.TimerTask;
49 50
 
@@ -83,8 +84,8 @@ public class Main {
83 84
     /** The command manager to use. */
84 85
     private final CommandManager commandManager;
85 86
 
86
-    /** The command loader to use. */
87
-    private final CommandLoader commandLoader;
87
+    /** The commands to load into the command manager. */
88
+    private final Set<CommandDetails> commands;
88 89
 
89 90
     /**
90 91
      * Creates a new instance of {@link Main}.
@@ -100,6 +101,7 @@ public class Main {
100 101
      * @param aliasWrapper Alias wrapper to provide to the actions manager.
101 102
      * @param corePluginExtractor Extractor to use for core plugins.
102 103
      * @param urlBuilder URL builder to use as a singleton.
104
+     * @param commands The commands to be loaded into the command manager.
103 105
      */
104 106
     @Inject
105 107
     public Main(
@@ -113,7 +115,7 @@ public class Main {
113 115
             final ThemeManager themeManager,
114 116
             final CorePluginExtractor corePluginExtractor,
115 117
             final URLBuilder urlBuilder,
116
-            final CommandLoader commandLoader) {
118
+            final Set<CommandDetails> commands) {
117 119
         this.identityManager = identityManager;
118 120
         this.serverManager = serverManager;
119 121
         this.actionManager = actionManager;
@@ -121,7 +123,7 @@ public class Main {
121 123
         this.pluginManager = pluginManager;
122 124
         this.corePluginExtractor = corePluginExtractor;
123 125
         this.commandManager = commandManager;
124
-        this.commandLoader = commandLoader;
126
+        this.commands = commands;
125 127
         URLBuilder.setInstance(urlBuilder);
126 128
     }
127 129
 
@@ -151,7 +153,9 @@ public class Main {
151 153
      * @param args The command line arguments
152 154
      */
153 155
     public void init() {
154
-        commandLoader.loadCommands(commandManager);
156
+        for (CommandDetails command : commands) {
157
+            commandManager.registerCommand(command.getCommand(), command.getInfo());
158
+        }
155 159
 
156 160
         loadUIs(pluginManager);
157 161
 

+ 0
- 201
src/com/dmdirc/commandparser/CommandLoader.java View File

@@ -1,201 +0,0 @@
1
-/*
2
- * Copyright (c) 2006-2013 DMDirc Developers
3
- *
4
- * Permission is hereby granted, free of charge, to any person obtaining a copy
5
- * of this software and associated documentation files (the "Software"), to deal
6
- * in the Software without restriction, including without limitation the rights
7
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- * copies of the Software, and to permit persons to whom the Software is
9
- * furnished to do so, subject to the following conditions:
10
- *
11
- * The above copyright notice and this permission notice shall be included in
12
- * all copies or substantial portions of the Software.
13
- *
14
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
- * SOFTWARE.
21
- */
22
-
23
-package com.dmdirc.commandparser;
24
-
25
-import com.dmdirc.interfaces.LifecycleController;
26
-import com.dmdirc.ServerManager;
27
-import com.dmdirc.actions.wrappers.AliasWrapper;
28
-import com.dmdirc.commandparser.commands.channel.Ban;
29
-import com.dmdirc.commandparser.commands.channel.Cycle;
30
-import com.dmdirc.commandparser.commands.channel.Invite;
31
-import com.dmdirc.commandparser.commands.channel.KickReason;
32
-import com.dmdirc.commandparser.commands.channel.Mode;
33
-import com.dmdirc.commandparser.commands.channel.Names;
34
-import com.dmdirc.commandparser.commands.channel.Part;
35
-import com.dmdirc.commandparser.commands.channel.SetNickColour;
36
-import com.dmdirc.commandparser.commands.channel.ShowTopic;
37
-import com.dmdirc.commandparser.commands.chat.Me;
38
-import com.dmdirc.commandparser.commands.global.AliasCommand;
39
-import com.dmdirc.commandparser.commands.global.AllServers;
40
-import com.dmdirc.commandparser.commands.global.Clear;
41
-import com.dmdirc.commandparser.commands.global.Echo;
42
-import com.dmdirc.commandparser.commands.global.Exit;
43
-import com.dmdirc.commandparser.commands.global.Help;
44
-import com.dmdirc.commandparser.commands.global.Ifplugin;
45
-import com.dmdirc.commandparser.commands.global.LoadPlugin;
46
-import com.dmdirc.commandparser.commands.global.NewServer;
47
-import com.dmdirc.commandparser.commands.global.Notify;
48
-import com.dmdirc.commandparser.commands.global.OpenWindow;
49
-import com.dmdirc.commandparser.commands.global.ReloadActions;
50
-import com.dmdirc.commandparser.commands.global.ReloadIdentities;
51
-import com.dmdirc.commandparser.commands.global.ReloadPlugin;
52
-import com.dmdirc.commandparser.commands.global.SaveConfig;
53
-import com.dmdirc.commandparser.commands.global.Set;
54
-import com.dmdirc.commandparser.commands.global.UnloadPlugin;
55
-import com.dmdirc.commandparser.commands.server.AllChannels;
56
-import com.dmdirc.commandparser.commands.server.Away;
57
-import com.dmdirc.commandparser.commands.server.Back;
58
-import com.dmdirc.commandparser.commands.server.ChangeServer;
59
-import com.dmdirc.commandparser.commands.server.Ctcp;
60
-import com.dmdirc.commandparser.commands.server.Disconnect;
61
-import com.dmdirc.commandparser.commands.server.Ignore;
62
-import com.dmdirc.commandparser.commands.server.JoinChannelCommand;
63
-import com.dmdirc.commandparser.commands.server.Message;
64
-import com.dmdirc.commandparser.commands.server.Nick;
65
-import com.dmdirc.commandparser.commands.server.Notice;
66
-import com.dmdirc.commandparser.commands.server.OpenQuery;
67
-import com.dmdirc.commandparser.commands.server.Raw;
68
-import com.dmdirc.commandparser.commands.server.RawServerCommand;
69
-import com.dmdirc.commandparser.commands.server.Reconnect;
70
-import com.dmdirc.commandparser.commands.server.Umode;
71
-import com.dmdirc.config.IdentityManager;
72
-import com.dmdirc.interfaces.ActionController;
73
-import com.dmdirc.interfaces.CommandController;
74
-import com.dmdirc.plugins.PluginManager;
75
-import com.dmdirc.ui.messages.ColourManager;
76
-
77
-import javax.inject.Inject;
78
-
79
-import dagger.Lazy;
80
-
81
-/**
82
- * Facilitates loading of core commands into a {@link CommandManager}.
83
- */
84
-public class CommandLoader {
85
-
86
-    /** Controller to give to commands that want to start/stop the app. */
87
-    private final Lazy<LifecycleController> lifecycleController;
88
-
89
-    /** Server manager to give to server-related commands. */
90
-    private final Lazy<ServerManager> serverManager;
91
-
92
-    /** Plugin manager to give to plugin-dependent commands. */
93
-    private final Lazy<PluginManager> pluginManager;
94
-
95
-    /** The identity manager to pass to config-related commands. */
96
-    private final Lazy<IdentityManager> identityManager;
97
-
98
-    /** The action controller to pass to action-aware commands. */
99
-    private final Lazy<ActionController> actionController;
100
-
101
-    /** The colour manager to pass to colourful commands. */
102
-    private final Lazy<ColourManager> colourManager;
103
-
104
-    /** The alias wrapper to pass to alias commands. */
105
-    private final Lazy<AliasWrapper> aliasWrapper;
106
-
107
-    /**
108
-     * Creates a new instance of {@link CommandLoader}.
109
-     *
110
-     * @param lifecycleController Controller to give to commands that want to start/stop the app.
111
-     * @param serverManager The server manager to pass to server-related commands.
112
-     * @param pluginManager The plugin manager to pass to plugin-dependent commands.
113
-     * @param identityManager The identity manager to pass to config-related commands.
114
-     * @param colourManager The colour manager to give to colourful commands.
115
-     * @param aliasWrapper The alias wrapper to pass to alias commands.
116
-     */
117
-    @Inject
118
-    public CommandLoader(
119
-            final Lazy<LifecycleController> lifecycleController,
120
-            final Lazy<ServerManager> serverManager,
121
-            final Lazy<PluginManager> pluginManager,
122
-            final Lazy<IdentityManager> identityManager,
123
-            final Lazy<ActionController> actionController,
124
-            final Lazy<ColourManager> colourManager,
125
-            final Lazy<AliasWrapper> aliasWrapper) {
126
-        this.lifecycleController = lifecycleController;
127
-        this.serverManager = serverManager;
128
-        this.pluginManager = pluginManager;
129
-        this.identityManager = identityManager;
130
-        this.actionController = actionController;
131
-        this.colourManager = colourManager;
132
-        this.aliasWrapper = aliasWrapper;
133
-    }
134
-
135
-    /**
136
-     * Loads all known core commands into the given manager.
137
-     *
138
-     * @param manager The manager to add commands to
139
-     */
140
-    public void loadCommands(final CommandController manager) {
141
-        // Chat commands
142
-        manager.registerCommand(new Me(), Me.INFO);
143
-
144
-        // Channel commands
145
-        manager.registerCommand(new Ban(), Ban.INFO);
146
-        manager.registerCommand(new Cycle(), Cycle.INFO);
147
-        manager.registerCommand(new Invite(), Invite.INFO);
148
-        manager.registerCommand(new KickReason(), KickReason.INFO);
149
-        manager.registerCommand(new Mode(), Mode.INFO);
150
-        manager.registerCommand(new Names(), Names.INFO);
151
-        manager.registerCommand(new Part(), Part.INFO);
152
-        manager.registerCommand(new SetNickColour(colourManager.get()), SetNickColour.INFO);
153
-        manager.registerCommand(new ShowTopic(), ShowTopic.INFO);
154
-
155
-        // Server commands
156
-        manager.registerCommand(new AllChannels(), AllChannels.INFO);
157
-        manager.registerCommand(new Away(), Away.INFO);
158
-        manager.registerCommand(new Back(), Back.INFO);
159
-        manager.registerCommand(new ChangeServer(), ChangeServer.INFO);
160
-        manager.registerCommand(new Ctcp(), Ctcp.INFO);
161
-        manager.registerCommand(new Disconnect(), Disconnect.INFO);
162
-        manager.registerCommand(new Ignore(), Ignore.INFO);
163
-        manager.registerCommand(new JoinChannelCommand(actionController.get()), JoinChannelCommand.INFO);
164
-        manager.registerCommand(new Message(), Message.INFO);
165
-        manager.registerCommand(new Nick(), Nick.INFO);
166
-        manager.registerCommand(new Notice(), Notice.INFO);
167
-        manager.registerCommand(new OpenQuery(), OpenQuery.INFO);
168
-        manager.registerCommand(new Raw(), Raw.INFO);
169
-        manager.registerCommand(new Reconnect(), Reconnect.INFO);
170
-        manager.registerCommand(new Umode(), Umode.INFO);
171
-
172
-        manager.registerCommand(new RawServerCommand("lusers"));
173
-        manager.registerCommand(new RawServerCommand("map"));
174
-        manager.registerCommand(new RawServerCommand("motd"));
175
-        manager.registerCommand(new RawServerCommand("oper"));
176
-        manager.registerCommand(new RawServerCommand("whois"));
177
-        manager.registerCommand(new RawServerCommand("who"));
178
-
179
-        // Query commands
180
-
181
-        // Global commands
182
-        manager.registerCommand(new AliasCommand(aliasWrapper.get()), AliasCommand.INFO);
183
-        manager.registerCommand(new AllServers(serverManager.get()), AllServers.INFO);
184
-        manager.registerCommand(new Clear(), Clear.INFO);
185
-        manager.registerCommand(new Echo(), Echo.INFO);
186
-        manager.registerCommand(new Exit(lifecycleController.get()), Exit.INFO);
187
-        manager.registerCommand(new Help(), Help.INFO);
188
-        manager.registerCommand(new Ifplugin(pluginManager.get()), Ifplugin.INFO);
189
-        manager.registerCommand(new NewServer(serverManager.get(), pluginManager.get(), identityManager.get()), NewServer.INFO);
190
-        manager.registerCommand(new Notify(colourManager.get()), Notify.INFO);
191
-        manager.registerCommand(new LoadPlugin(pluginManager.get()), LoadPlugin.INFO);
192
-        manager.registerCommand(new UnloadPlugin(pluginManager.get()), UnloadPlugin.INFO);
193
-        manager.registerCommand(new OpenWindow(), OpenWindow.INFO);
194
-        manager.registerCommand(new ReloadActions(), ReloadActions.INFO);
195
-        manager.registerCommand(new ReloadIdentities(identityManager.get()), ReloadIdentities.INFO);
196
-        manager.registerCommand(new ReloadPlugin(pluginManager.get()), ReloadPlugin.INFO);
197
-        manager.registerCommand(new SaveConfig(identityManager.get()), SaveConfig.INFO);
198
-        manager.registerCommand(new Set(identityManager.get(), identityManager.get()), Set.INFO);
199
-    }
200
-
201
-}

+ 578
- 0
src/com/dmdirc/commandparser/commands/CommandModule.java View File

@@ -0,0 +1,578 @@
1
+/*
2
+ * Copyright (c) 2006-2013 DMDirc Developers
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package com.dmdirc.commandparser.commands;
24
+
25
+import com.dmdirc.commandparser.CommandInfo;
26
+import com.dmdirc.commandparser.commands.channel.Ban;
27
+import com.dmdirc.commandparser.commands.channel.Cycle;
28
+import com.dmdirc.commandparser.commands.channel.Invite;
29
+import com.dmdirc.commandparser.commands.channel.KickReason;
30
+import com.dmdirc.commandparser.commands.channel.Mode;
31
+import com.dmdirc.commandparser.commands.channel.Names;
32
+import com.dmdirc.commandparser.commands.channel.Part;
33
+import com.dmdirc.commandparser.commands.channel.SetNickColour;
34
+import com.dmdirc.commandparser.commands.channel.ShowTopic;
35
+import com.dmdirc.commandparser.commands.chat.Me;
36
+import com.dmdirc.commandparser.commands.global.AliasCommand;
37
+import com.dmdirc.commandparser.commands.global.AllServers;
38
+import com.dmdirc.commandparser.commands.global.Clear;
39
+import com.dmdirc.commandparser.commands.global.Echo;
40
+import com.dmdirc.commandparser.commands.global.Exit;
41
+import com.dmdirc.commandparser.commands.global.Help;
42
+import com.dmdirc.commandparser.commands.global.Ifplugin;
43
+import com.dmdirc.commandparser.commands.global.LoadPlugin;
44
+import com.dmdirc.commandparser.commands.global.NewServer;
45
+import com.dmdirc.commandparser.commands.global.Notify;
46
+import com.dmdirc.commandparser.commands.global.OpenWindow;
47
+import com.dmdirc.commandparser.commands.global.ReloadActions;
48
+import com.dmdirc.commandparser.commands.global.ReloadIdentities;
49
+import com.dmdirc.commandparser.commands.global.ReloadPlugin;
50
+import com.dmdirc.commandparser.commands.global.SaveConfig;
51
+import com.dmdirc.commandparser.commands.global.SetCommand;
52
+import com.dmdirc.commandparser.commands.global.UnloadPlugin;
53
+import com.dmdirc.commandparser.commands.server.AllChannels;
54
+import com.dmdirc.commandparser.commands.server.Away;
55
+import com.dmdirc.commandparser.commands.server.Back;
56
+import com.dmdirc.commandparser.commands.server.ChangeServer;
57
+import com.dmdirc.commandparser.commands.server.Ctcp;
58
+import com.dmdirc.commandparser.commands.server.Disconnect;
59
+import com.dmdirc.commandparser.commands.server.Ignore;
60
+import com.dmdirc.commandparser.commands.server.JoinChannelCommand;
61
+import com.dmdirc.commandparser.commands.server.Message;
62
+import com.dmdirc.commandparser.commands.server.Nick;
63
+import com.dmdirc.commandparser.commands.server.Notice;
64
+import com.dmdirc.commandparser.commands.server.OpenQuery;
65
+import com.dmdirc.commandparser.commands.server.Raw;
66
+import com.dmdirc.commandparser.commands.server.RawServerCommand;
67
+import com.dmdirc.commandparser.commands.server.Reconnect;
68
+import com.dmdirc.commandparser.commands.server.Umode;
69
+import com.dmdirc.interfaces.CommandController.CommandDetails;
70
+
71
+import java.util.HashSet;
72
+import java.util.Set;
73
+
74
+import lombok.Getter;
75
+import lombok.RequiredArgsConstructor;
76
+
77
+import dagger.Module;
78
+import dagger.Provides;
79
+
80
+/**
81
+ * Provides commands for injection into the command manager.
82
+ */
83
+@Module(library = true, complete = false)
84
+public class CommandModule {
85
+
86
+    /**
87
+     * Provides the /me command.
88
+     *
89
+     * @param command The instantiated command.
90
+     * @return The command's details.
91
+     */
92
+    @Provides(type = Provides.Type.SET)
93
+    public CommandDetails getCommand(final Me command) {
94
+        return new SimpleCommandDetails(command, Me.INFO);
95
+    }
96
+
97
+    /**
98
+     * Provides the /ban command.
99
+     *
100
+     * @param command The instantiated command.
101
+     * @return The command's details.
102
+     */
103
+    @Provides(type = Provides.Type.SET)
104
+    public CommandDetails getCommand(final Ban command) {
105
+        return new SimpleCommandDetails(command, Ban.INFO);
106
+    }
107
+
108
+    /**
109
+     * Provides the /cycle command.
110
+     *
111
+     * @param command The instantiated command.
112
+     * @return The command's details.
113
+     */
114
+    @Provides(type = Provides.Type.SET)
115
+    public CommandDetails getCommand(final Cycle command) {
116
+        return new SimpleCommandDetails(command, Cycle.INFO);
117
+    }
118
+
119
+    /**
120
+     * Provides the /invite command.
121
+     *
122
+     * @param command The instantiated command.
123
+     * @return The command's details.
124
+     */
125
+    @Provides(type = Provides.Type.SET)
126
+    public CommandDetails getCommand(final Invite command) {
127
+        return new SimpleCommandDetails(command, Invite.INFO);
128
+    }
129
+
130
+    /**
131
+     * Provides the /kick command.
132
+     *
133
+     * @param command The instantiated command.
134
+     * @return The command's details.
135
+     */
136
+    @Provides(type = Provides.Type.SET)
137
+    public CommandDetails getCommand(final KickReason command) {
138
+        return new SimpleCommandDetails(command, KickReason.INFO);
139
+    }
140
+
141
+    /**
142
+     * Provides the /mode command.
143
+     *
144
+     * @param command The instantiated command.
145
+     * @return The command's details.
146
+     */
147
+    @Provides(type = Provides.Type.SET)
148
+    public CommandDetails getCommand(final Mode command) {
149
+        return new SimpleCommandDetails(command, Mode.INFO);
150
+    }
151
+
152
+    /**
153
+     * Provides the /names command.
154
+     *
155
+     * @param command The instantiated command.
156
+     * @return The command's details.
157
+     */
158
+    @Provides(type = Provides.Type.SET)
159
+    public CommandDetails getCommand(final Names command) {
160
+        return new SimpleCommandDetails(command, Names.INFO);
161
+    }
162
+
163
+    /**
164
+     * Provides the /part command.
165
+     *
166
+     * @param command The instantiated command.
167
+     * @return The command's details.
168
+     */
169
+    @Provides(type = Provides.Type.SET)
170
+    public CommandDetails getCommand(final Part command) {
171
+        return new SimpleCommandDetails(command, Part.INFO);
172
+    }
173
+
174
+    /**
175
+     * Provides the /setnickcolour command.
176
+     *
177
+     * @param command The instantiated command.
178
+     * @return The command's details.
179
+     */
180
+    @Provides(type = Provides.Type.SET)
181
+    public CommandDetails getCommand(final SetNickColour command) {
182
+        return new SimpleCommandDetails(command, SetNickColour.INFO);
183
+    }
184
+
185
+    /**
186
+     * Provides the /topic command.
187
+     *
188
+     * @param command The instantiated command.
189
+     * @return The command's details.
190
+     */
191
+    @Provides(type = Provides.Type.SET)
192
+    public CommandDetails getCommand(final ShowTopic command) {
193
+        return new SimpleCommandDetails(command, ShowTopic.INFO);
194
+    }
195
+
196
+    /**
197
+     * Provides the /allchannels command.
198
+     *
199
+     * @param command The instantiated command.
200
+     * @return The command's details.
201
+     */
202
+    @Provides(type = Provides.Type.SET)
203
+    public CommandDetails getCommand(final AllChannels command) {
204
+        return new SimpleCommandDetails(command, AllChannels.INFO);
205
+    }
206
+
207
+    /**
208
+     * Provides the /away command.
209
+     *
210
+     * @param command The instantiated command.
211
+     * @return The command's details.
212
+     */
213
+    @Provides(type = Provides.Type.SET)
214
+    public CommandDetails getCommand(final Away command) {
215
+        return new SimpleCommandDetails(command, Away.INFO);
216
+    }
217
+
218
+    /**
219
+     * Provides the /back command.
220
+     *
221
+     * @param command The instantiated command.
222
+     * @return The command's details.
223
+     */
224
+    @Provides(type = Provides.Type.SET)
225
+    public CommandDetails getCommand(final Back command) {
226
+        return new SimpleCommandDetails(command, Back.INFO);
227
+    }
228
+
229
+    /**
230
+     * Provides the /server command.
231
+     *
232
+     * @param command The instantiated command.
233
+     * @return The command's details.
234
+     */
235
+    @Provides(type = Provides.Type.SET)
236
+    public CommandDetails getCommand(final ChangeServer command) {
237
+        return new SimpleCommandDetails(command, ChangeServer.INFO);
238
+    }
239
+
240
+    /**
241
+     * Provides the /ctcp command.
242
+     *
243
+     * @param command The instantiated command.
244
+     * @return The command's details.
245
+     */
246
+    @Provides(type = Provides.Type.SET)
247
+    public CommandDetails getCommand(final Ctcp command) {
248
+        return new SimpleCommandDetails(command, Ctcp.INFO);
249
+    }
250
+
251
+    /**
252
+     * Provides the /disconnect command.
253
+     *
254
+     * @param command The instantiated command.
255
+     * @return The command's details.
256
+     */
257
+    @Provides(type = Provides.Type.SET)
258
+    public CommandDetails getCommand(final Disconnect command) {
259
+        return new SimpleCommandDetails(command, Disconnect.INFO);
260
+    }
261
+
262
+    /**
263
+     * Provides the /ignore command.
264
+     *
265
+     * @param command The instantiated command.
266
+     * @return The command's details.
267
+     */
268
+    @Provides(type = Provides.Type.SET)
269
+    public CommandDetails getCommand(final Ignore command) {
270
+        return new SimpleCommandDetails(command, Ignore.INFO);
271
+    }
272
+
273
+    /**
274
+     * Provides the /join command.
275
+     *
276
+     * @param command The instantiated command.
277
+     * @return The command's details.
278
+     */
279
+    @Provides(type = Provides.Type.SET)
280
+    public CommandDetails getCommand(final JoinChannelCommand command) {
281
+        return new SimpleCommandDetails(command, JoinChannelCommand.INFO);
282
+    }
283
+
284
+    /**
285
+     * Provides the /msg command.
286
+     *
287
+     * @param command The instantiated command.
288
+     * @return The command's details.
289
+     */
290
+    @Provides(type = Provides.Type.SET)
291
+    public CommandDetails getCommand(final Message command) {
292
+        return new SimpleCommandDetails(command, Message.INFO);
293
+    }
294
+
295
+    /**
296
+     * Provides the /nick command.
297
+     *
298
+     * @param command The instantiated command.
299
+     * @return The command's details.
300
+     */
301
+    @Provides(type = Provides.Type.SET)
302
+    public CommandDetails getCommand(final Nick command) {
303
+        return new SimpleCommandDetails(command, Nick.INFO);
304
+    }
305
+
306
+    /**
307
+     * Provides the /notice command.
308
+     *
309
+     * @param command The instantiated command.
310
+     * @return The command's details.
311
+     */
312
+    @Provides(type = Provides.Type.SET)
313
+    public CommandDetails getCommand(final Notice command) {
314
+        return new SimpleCommandDetails(command, Notice.INFO);
315
+    }
316
+
317
+    /**
318
+     * Provides the /query command.
319
+     *
320
+     * @param command The instantiated command.
321
+     * @return The command's details.
322
+     */
323
+    @Provides(type = Provides.Type.SET)
324
+    public CommandDetails getCommand(final OpenQuery command) {
325
+        return new SimpleCommandDetails(command, OpenQuery.INFO);
326
+    }
327
+
328
+    /**
329
+     * Provides the /raw command.
330
+     *
331
+     * @param command The instantiated command.
332
+     * @return The command's details.
333
+     */
334
+    @Provides(type = Provides.Type.SET)
335
+    public CommandDetails getCommand(final Raw command) {
336
+        return new SimpleCommandDetails(command, Raw.INFO);
337
+    }
338
+
339
+    /**
340
+     * Provides the /reconnect command.
341
+     *
342
+     * @param command The instantiated command.
343
+     * @return The command's details.
344
+     */
345
+    @Provides(type = Provides.Type.SET)
346
+    public CommandDetails getCommand(final Reconnect command) {
347
+        return new SimpleCommandDetails(command, Reconnect.INFO);
348
+    }
349
+
350
+    /**
351
+     * Provides the /umode command.
352
+     *
353
+     * @param command The instantiated command.
354
+     * @return The command's details.
355
+     */
356
+    @Provides(type = Provides.Type.SET)
357
+    public CommandDetails getCommand(final Umode command) {
358
+        return new SimpleCommandDetails(command, Umode.INFO);
359
+    }
360
+
361
+    /**
362
+     * Provides a set of raw commands.
363
+     *
364
+     * @return A set of the commands' details.
365
+     */
366
+    @Provides(type = Provides.Type.SET_VALUES)
367
+    public Set<CommandDetails> getRawCommands() {
368
+        final Set<CommandDetails> results = new HashSet<>();
369
+        for (String name : new String[] { "lusers", "map", "motd", "oper", "whois", "who" }) {
370
+            final RawServerCommand rawCommand = new RawServerCommand(name);
371
+            results.add(new SimpleCommandDetails(rawCommand, rawCommand));
372
+        }
373
+        return results;
374
+    }
375
+
376
+    /**
377
+     * Provides the /alias command.
378
+     *
379
+     * @param command The instantiated command.
380
+     * @return The command's details.
381
+     */
382
+    @Provides(type = Provides.Type.SET)
383
+    public CommandDetails getCommand(final AliasCommand command) {
384
+        return new SimpleCommandDetails(command, AliasCommand.INFO);
385
+    }
386
+
387
+    /**
388
+     * Provides the /allservers command.
389
+     *
390
+     * @param command The instantiated command.
391
+     * @return The command's details.
392
+     */
393
+    @Provides(type = Provides.Type.SET)
394
+    public CommandDetails getCommand(final AllServers command) {
395
+        return new SimpleCommandDetails(command, AllServers.INFO);
396
+    }
397
+
398
+    /**
399
+     * Provides the /clear command.
400
+     *
401
+     * @param command The instantiated command.
402
+     * @return The command's details.
403
+     */
404
+    @Provides(type = Provides.Type.SET)
405
+    public CommandDetails getCommand(final Clear command) {
406
+        return new SimpleCommandDetails(command, Clear.INFO);
407
+    }
408
+
409
+    /**
410
+     * Provides the /echo command.
411
+     *
412
+     * @param command The instantiated command.
413
+     * @return The command's details.
414
+     */
415
+    @Provides(type = Provides.Type.SET)
416
+    public CommandDetails getCommand(final Echo command) {
417
+        return new SimpleCommandDetails(command, Echo.INFO);
418
+    }
419
+
420
+    /**
421
+     * Provides the /exit command.
422
+     *
423
+     * @param command The instantiated command.
424
+     * @return The command's details.
425
+     */
426
+    @Provides(type = Provides.Type.SET)
427
+    public CommandDetails getCommand(final Exit command) {
428
+        return new SimpleCommandDetails(command, Exit.INFO);
429
+    }
430
+
431
+    /**
432
+     * Provides the /Help command.
433
+     *
434
+     * @param command The instantiated command.
435
+     * @return The command's details.
436
+     */
437
+    @Provides(type = Provides.Type.SET)
438
+    public CommandDetails getCommand(final Help command) {
439
+        return new SimpleCommandDetails(command, Help.INFO);
440
+    }
441
+
442
+    /**
443
+     * Provides the /ifplugin command.
444
+     *
445
+     * @param command The instantiated command.
446
+     * @return The command's details.
447
+     */
448
+    @Provides(type = Provides.Type.SET)
449
+    public CommandDetails getCommand(final Ifplugin command) {
450
+        return new SimpleCommandDetails(command, Ifplugin.INFO);
451
+    }
452
+
453
+    /**
454
+     * Provides the /newserver command.
455
+     *
456
+     * @param command The instantiated command.
457
+     * @return The command's details.
458
+     */
459
+    @Provides(type = Provides.Type.SET)
460
+    public CommandDetails getCommand(final NewServer command) {
461
+        return new SimpleCommandDetails(command, NewServer.INFO);
462
+    }
463
+
464
+    /**
465
+     * Provides the /notify command.
466
+     *
467
+     * @param command The instantiated command.
468
+     * @return The command's details.
469
+     */
470
+    @Provides(type = Provides.Type.SET)
471
+    public CommandDetails getCommand(final Notify command) {
472
+        return new SimpleCommandDetails(command, Notify.INFO);
473
+    }
474
+
475
+    /**
476
+     * Provides the /loadplugin command.
477
+     *
478
+     * @param command The instantiated command.
479
+     * @return The command's details.
480
+     */
481
+    @Provides(type = Provides.Type.SET)
482
+    public CommandDetails getCommand(final LoadPlugin command) {
483
+        return new SimpleCommandDetails(command, LoadPlugin.INFO);
484
+    }
485
+
486
+    /**
487
+     * Provides the /unloadplugin command.
488
+     *
489
+     * @param command The instantiated command.
490
+     * @return The command's details.
491
+     */
492
+    @Provides(type = Provides.Type.SET)
493
+    public CommandDetails getCommand(final UnloadPlugin command) {
494
+        return new SimpleCommandDetails(command, UnloadPlugin.INFO);
495
+    }
496
+
497
+    /**
498
+     * Provides the /openwindow command.
499
+     *
500
+     * @param command The instantiated command.
501
+     * @return The command's details.
502
+     */
503
+    @Provides(type = Provides.Type.SET)
504
+    public CommandDetails getCommand(final OpenWindow command) {
505
+        return new SimpleCommandDetails(command, OpenWindow.INFO);
506
+    }
507
+
508
+    /**
509
+     * Provides the /reloadactions command.
510
+     *
511
+     * @param command The instantiated command.
512
+     * @return The command's details.
513
+     */
514
+    @Provides(type = Provides.Type.SET)
515
+    public CommandDetails getCommand(final ReloadActions command) {
516
+        return new SimpleCommandDetails(command, ReloadActions.INFO);
517
+    }
518
+
519
+    /**
520
+     * Provides the /reloadidentities command.
521
+     *
522
+     * @param command The instantiated command.
523
+     * @return The command's details.
524
+     */
525
+    @Provides(type = Provides.Type.SET)
526
+    public CommandDetails getCommand(final ReloadIdentities command) {
527
+        return new SimpleCommandDetails(command, ReloadIdentities.INFO);
528
+    }
529
+
530
+    /**
531
+     * Provides the /reloadplugin command.
532
+     *
533
+     * @param command The instantiated command.
534
+     * @return The command's details.
535
+     */
536
+    @Provides(type = Provides.Type.SET)
537
+    public CommandDetails getCommand(final ReloadPlugin command) {
538
+        return new SimpleCommandDetails(command, ReloadPlugin.INFO);
539
+    }
540
+
541
+    /**
542
+     * Provides the /saveconfig command.
543
+     *
544
+     * @param command The instantiated command.
545
+     * @return The command's details.
546
+     */
547
+    @Provides(type = Provides.Type.SET)
548
+    public CommandDetails getCommand(final SaveConfig command) {
549
+        return new SimpleCommandDetails(command, SaveConfig.INFO);
550
+    }
551
+
552
+    /**
553
+     * Provides the /set command.
554
+     *
555
+     * @param command The instantiated command.
556
+     * @return The command's details.
557
+     */
558
+    @Provides(type = Provides.Type.SET)
559
+    public CommandDetails getCommand(final SetCommand command) {
560
+        return new SimpleCommandDetails(command, SetCommand.INFO);
561
+    }
562
+
563
+    /**
564
+     * Simple implementation of {@link CommandDetails}.
565
+     */
566
+    @Getter
567
+    @RequiredArgsConstructor
568
+    private static class SimpleCommandDetails implements CommandDetails {
569
+
570
+        /** The command. */
571
+        private final Command command;
572
+
573
+        /** The command's info. */
574
+        private final CommandInfo info;
575
+
576
+    }
577
+
578
+}

+ 2
- 0
src/com/dmdirc/commandparser/commands/channel/Ban.java View File

@@ -37,6 +37,7 @@ import com.dmdirc.parser.interfaces.ChannelClientInfo;
37 37
 import com.dmdirc.ui.input.AdditionalTabTargets;
38 38
 import com.dmdirc.ui.input.TabCompletionType;
39 39
 
40
+import javax.inject.Inject;
40 41
 import lombok.NoArgsConstructor;
41 42
 
42 43
 /**
@@ -55,6 +56,7 @@ public class Ban extends Command implements IntelligentCommand {
55 56
      *
56 57
      * @param controller The controller to use for command information.
57 58
      */
59
+    @Inject
58 60
     public Ban(final CommandController controller) {
59 61
         super(controller);
60 62
     }

+ 7
- 0
src/com/dmdirc/commandparser/commands/channel/Cycle.java View File

@@ -33,6 +33,8 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 
36
+import javax.inject.Inject;
37
+
36 38
 /**
37 39
  * The cycle command allows users to rapidly part and rejoin a channel.
38 40
  */
@@ -44,6 +46,11 @@ public class Cycle extends Command {
44 46
             "cycle [message] - parts and rejoins the channel",
45 47
             CommandType.TYPE_CHANNEL);
46 48
 
49
+    /** Creates a new instance of this command. */
50
+    @Inject
51
+    public Cycle() {
52
+    }
53
+
47 54
     /** {@inheritDoc} */
48 55
     @Override
49 56
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/channel/Invite.java View File

@@ -36,6 +36,8 @@ import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
36 36
 import com.dmdirc.commandparser.commands.context.CommandContext;
37 37
 import com.dmdirc.parser.interfaces.ChannelInfo;
38 38
 
39
+import javax.inject.Inject;
40
+
39 41
 /**
40 42
  * The invite command allows the user to invite others to a channel.
41 43
  *
@@ -49,6 +51,11 @@ public class Invite extends Command implements ExternalCommand {
49 51
             "invite <user> - invites user to a channel",
50 52
             CommandType.TYPE_CHANNEL);
51 53
 
54
+    /** Creates a new instance of this command. */
55
+    @Inject
56
+    public Invite() {
57
+    }
58
+
52 59
     /** {@inheritDoc} */
53 60
     @Override
54 61
     public void execute(final FrameContainer origin,

+ 2
- 0
src/com/dmdirc/commandparser/commands/channel/KickReason.java View File

@@ -38,6 +38,7 @@ import com.dmdirc.parser.interfaces.ChannelClientInfo;
38 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
39 39
 import com.dmdirc.ui.input.TabCompletionType;
40 40
 
41
+import javax.inject.Inject;
41 42
 import lombok.NoArgsConstructor;
42 43
 
43 44
 /**
@@ -58,6 +59,7 @@ public class KickReason extends Command implements IntelligentCommand {
58 59
      *
59 60
      * @param controller The controller to use for command information.
60 61
      */
62
+    @Inject
61 63
     public KickReason(final CommandController controller) {
62 64
         super(controller);
63 65
     }

+ 7
- 0
src/com/dmdirc/commandparser/commands/channel/Mode.java View File

@@ -39,6 +39,8 @@ import com.dmdirc.parser.interfaces.ChannelInfo;
39 39
 import com.dmdirc.ui.input.AdditionalTabTargets;
40 40
 import com.dmdirc.ui.input.TabCompletionType;
41 41
 
42
+import javax.inject.Inject;
43
+
42 44
 /**
43 45
  * The mode command allows the user to inspect and change channel modes.
44 46
  */
@@ -51,6 +53,11 @@ public class Mode extends Command implements IntelligentCommand,
51 53
             "mode [changes] - displays or changes the current channel modes",
52 54
             CommandType.TYPE_CHANNEL);
53 55
 
56
+    /** Creates a new instance of this command. */
57
+    @Inject
58
+    public Mode() {
59
+    }
60
+
54 61
     /** {@inheritDoc} */
55 62
     @Override
56 63
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/channel/Names.java View File

@@ -37,6 +37,8 @@ import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
37 37
 import com.dmdirc.commandparser.commands.context.CommandContext;
38 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
39 39
 
40
+import javax.inject.Inject;
41
+
40 42
 /**
41 43
  * Sends a names request.
42 44
  */
@@ -49,6 +51,11 @@ public class Names extends Command implements IntelligentCommand,
49 51
             "names - Requests a list of users that are in the channel",
50 52
             CommandType.TYPE_CHANNEL);
51 53
 
54
+    /** Creates a new instance of this command. */
55
+    @Inject
56
+    public Names() {
57
+    }
58
+
52 59
     /** {@inheritDoc} */
53 60
     @Override
54 61
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/channel/Part.java View File

@@ -33,6 +33,8 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 
36
+import javax.inject.Inject;
37
+
36 38
 /**
37 39
  * The part command parts the current channel with a specified part message.
38 40
  */
@@ -44,6 +46,11 @@ public class Part extends Command {
44 46
             "part [reason] - parts the channel",
45 47
             CommandType.TYPE_CHANNEL);
46 48
 
49
+    /** Creates a new instance of this command. */
50
+    @Inject
51
+    public Part() {
52
+    }
53
+
47 54
     /** {@inheritDoc} */
48 55
     @Override
49 56
     public void execute(final FrameContainer origin,

+ 3
- 0
src/com/dmdirc/commandparser/commands/channel/SetNickColour.java View File

@@ -40,6 +40,8 @@ import com.dmdirc.ui.input.AdditionalTabTargets;
40 40
 import com.dmdirc.ui.input.TabCompletionType;
41 41
 import com.dmdirc.ui.messages.ColourManager;
42 42
 
43
+import javax.inject.Inject;
44
+
43 45
 /**
44 46
  * Allows the user to set a nickname on the channel to use a custom colour.
45 47
  */
@@ -69,6 +71,7 @@ public class SetNickColour extends Command implements IntelligentCommand {
69 71
      * @param controller The command controller that owns this command.
70 72
      * @param colourManager The colour manager to use to convert colours.
71 73
      */
74
+    @Inject
72 75
     public SetNickColour(final CommandController controller, final ColourManager colourManager) {
73 76
         super(controller);
74 77
         this.colourManager = colourManager;

+ 7
- 0
src/com/dmdirc/commandparser/commands/channel/ShowTopic.java View File

@@ -36,6 +36,8 @@ import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
36 36
 import com.dmdirc.commandparser.commands.context.CommandContext;
37 37
 import com.dmdirc.parser.interfaces.ChannelInfo;
38 38
 
39
+import javax.inject.Inject;
40
+
39 41
 /**
40 42
  * The show topic command shows the user the current topic.
41 43
  */
@@ -47,6 +49,11 @@ public class ShowTopic extends Command implements ExternalCommand {
47 49
             "topic - displays the current topic\ntopic <newtopic> - sets the channel topic",
48 50
             CommandType.TYPE_CHANNEL);
49 51
 
52
+    /** Creates a new instance of this command. */
53
+    @Inject
54
+    public ShowTopic() {
55
+    }
56
+
50 57
     /** {@inheritDoc} */
51 58
     @Override
52 59
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/chat/Me.java View File

@@ -35,6 +35,8 @@ import com.dmdirc.commandparser.commands.context.ChatCommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.CommandContext;
36 36
 import com.dmdirc.util.validators.ValidationResponse;
37 37
 
38
+import javax.inject.Inject;
39
+
38 40
 /**
39 41
  * The me command sends a CTCP action to the current channel.
40 42
  */
@@ -45,6 +47,11 @@ public class Me extends Command implements ValidatingCommand {
45 47
             "me <action> - sends the specified action",
46 48
             CommandType.TYPE_CHAT);
47 49
 
50
+    /** Creates a new instance of this command. */
51
+    @Inject
52
+    public Me() {
53
+    }
54
+
48 55
     /** {@inheritDoc} */
49 56
     @Override
50 57
     public void execute(final FrameContainer origin,

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/AliasCommand.java View File

@@ -38,6 +38,8 @@ import com.dmdirc.interfaces.CommandController;
38 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
39 39
 import com.dmdirc.ui.input.TabCompleter;
40 40
 
41
+import javax.inject.Inject;
42
+
41 43
 /**
42 44
  * The alias command allows users to create aliases on-the-fly.
43 45
  */
@@ -66,6 +68,7 @@ public class AliasCommand extends Command implements IntelligentCommand {
66 68
      * @param controller The controller that owns this command.
67 69
      * @param aliasWrapper The wrapper to use to modify aliases.
68 70
      */
71
+    @Inject
69 72
     public AliasCommand(final CommandController controller, final AliasWrapper aliasWrapper) {
70 73
         super(controller);
71 74
         this.aliasWrapper = aliasWrapper;

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/AllServers.java View File

@@ -35,6 +35,8 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 import com.dmdirc.ui.input.TabCompleter;
37 37
 
38
+import javax.inject.Inject;
39
+
38 40
 /**
39 41
  * The AllServers command allows users to issue commands to all servers.
40 42
  */
@@ -53,6 +55,7 @@ public class AllServers extends Command implements IntelligentCommand {
53 55
      *
54 56
      * @param serverManager The server manager to use to iterate servers.
55 57
      */
58
+    @Inject
56 59
     public AllServers(final ServerManager serverManager) {
57 60
         this.serverManager = serverManager;
58 61
     }

+ 7
- 0
src/com/dmdirc/commandparser/commands/global/Clear.java View File

@@ -32,6 +32,8 @@ import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.ui.input.AdditionalTabTargets;
34 34
 
35
+import javax.inject.Inject;
36
+
35 37
 /**
36 38
  * The clear command clears the main text area of the current window.
37 39
  */
@@ -42,6 +44,11 @@ public class Clear extends Command implements IntelligentCommand {
42 44
             "clear - clears the current window's text area",
43 45
             CommandType.TYPE_GLOBAL);
44 46
 
47
+    /** Creates a new instance of this command. */
48
+    @Inject
49
+    public Clear() {
50
+    }
51
+
45 52
     /** {@inheritDoc} */
46 53
     @Override
47 54
     public void execute(final FrameContainer origin,

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/Echo.java View File

@@ -43,6 +43,8 @@ import java.util.ArrayList;
43 43
 import java.util.Date;
44 44
 import java.util.List;
45 45
 
46
+import javax.inject.Inject;
47
+
46 48
 /**
47 49
  * The echo commands simply echos text to the current window.
48 50
  */
@@ -75,6 +77,7 @@ public class Echo extends Command implements IntelligentCommand {
75 77
      *
76 78
      * @param controller Command controller
77 79
      */
80
+    @Inject
78 81
     public Echo(final CommandController controller) {
79 82
         super(controller);
80 83
 

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/Exit.java View File

@@ -31,6 +31,8 @@ import com.dmdirc.commandparser.CommandType;
31 31
 import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 
34
+import javax.inject.Inject;
35
+
34 36
 /**
35 37
  * The exit command allows the user to quit DMDirc with a custom quit message.
36 38
  * When the client quits, it disconnects all servers (with the quit message
@@ -51,6 +53,7 @@ public class Exit extends Command {
51 53
      *
52 54
      * @param controller The controller to use to quit the app.
53 55
      */
56
+    @Inject
54 57
     public Exit(final LifecycleController controller) {
55 58
         this.controller = controller;
56 59
     }

+ 7
- 0
src/com/dmdirc/commandparser/commands/global/Help.java View File

@@ -40,6 +40,8 @@ import java.util.Collections;
40 40
 import java.util.List;
41 41
 import java.util.Map;
42 42
 
43
+import javax.inject.Inject;
44
+
43 45
 /**
44 46
  * The help command shows the user a list of available commands, along with
45 47
  * their arguments, and a description. It is context-aware, so channel commands
@@ -52,6 +54,11 @@ public class Help extends Command implements IntelligentCommand {
52 54
             "help [command] - shows client command help",
53 55
             CommandType.TYPE_GLOBAL);
54 56
 
57
+    /** Creates a new instance of this command. */
58
+    @Inject
59
+    public Help() {
60
+    }
61
+
55 62
     /** {@inheritDoc} */
56 63
     @Override
57 64
     public void execute(final FrameContainer origin,

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/Ifplugin.java View File

@@ -38,6 +38,8 @@ import com.dmdirc.plugins.PluginManager;
38 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
39 39
 import com.dmdirc.ui.input.TabCompleter;
40 40
 
41
+import javax.inject.Inject;
42
+
41 43
 /**
42 44
  * The if plugin command allows the user to execute commands based on whether
43 45
  * or not a plugin is loaded.
@@ -58,6 +60,7 @@ public class Ifplugin extends Command implements IntelligentCommand {
58 60
      *
59 61
      * @param pluginManager The plugin manager to use to query plugins.
60 62
      */
63
+    @Inject
61 64
     public Ifplugin(final PluginManager pluginManager) {
62 65
         this.pluginManager = pluginManager;
63 66
     }

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/LoadPlugin.java View File

@@ -35,6 +35,8 @@ import com.dmdirc.plugins.PluginManager;
35 35
 import com.dmdirc.plugins.PluginMetaData;
36 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 37
 
38
+import javax.inject.Inject;
39
+
38 40
 /**
39 41
  * Allows the user to load a plugin.
40 42
  */
@@ -53,6 +55,7 @@ public class LoadPlugin extends Command implements IntelligentCommand {
53 55
      *
54 56
      * @param pluginManager The plugin manager to load plugins with.
55 57
      */
58
+    @Inject
56 59
     public LoadPlugin(final PluginManager pluginManager) {
57 60
         this.pluginManager = pluginManager;
58 61
     }

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/NewServer.java View File

@@ -44,6 +44,8 @@ import java.net.URISyntaxException;
44 44
 import java.util.regex.Matcher;
45 45
 import java.util.regex.Pattern;
46 46
 
47
+import javax.inject.Inject;
48
+
47 49
 /**
48 50
  * The new server command allows users to open a new server window.
49 51
  */
@@ -71,6 +73,7 @@ public class NewServer extends Command implements IntelligentCommand {
71 73
      * @param pluginManager The plugin manager to use to query available services.
72 74
      * @param identityController Identity controller to use to find profiles.
73 75
      */
76
+    @Inject
74 77
     public NewServer(
75 78
             final ServerFactory serverFactory,
76 79
             final PluginManager pluginManager,

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/Notify.java View File

@@ -34,6 +34,8 @@ import com.dmdirc.ui.Colour;
34 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
35 35
 import com.dmdirc.ui.messages.ColourManager;
36 36
 
37
+import javax.inject.Inject;
38
+
37 39
 /**
38 40
  * The notify command allows the user to set the notification colour for a
39 41
  * window.
@@ -53,6 +55,7 @@ public class Notify extends Command implements IntelligentCommand {
53 55
      *
54 56
      * @param colourManager The colour manager to use to convert colours.
55 57
      */
58
+    @Inject
56 59
     public Notify(final ColourManager colourManager) {
57 60
         this.colourManager = colourManager;
58 61
     }

+ 7
- 0
src/com/dmdirc/commandparser/commands/global/OpenWindow.java View File

@@ -34,6 +34,8 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.ui.WindowManager;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 
37
+import javax.inject.Inject;
38
+
37 39
 /**
38 40
  * Opens a new window.
39 41
  */
@@ -45,6 +47,11 @@ public class OpenWindow extends Command implements IntelligentCommand {
45 47
             + "- opens a window with the specified name and title",
46 48
             CommandType.TYPE_GLOBAL);
47 49
 
50
+    /** Creates a new instance of this command. */
51
+    @Inject
52
+    public OpenWindow() {
53
+    }
54
+
48 55
     /** {@inheritDoc} */
49 56
     @Override
50 57
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/global/ReloadActions.java View File

@@ -33,6 +33,8 @@ import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
35 35
 
36
+import javax.inject.Inject;
37
+
36 38
 /**
37 39
  * Allows the user to reload actions.
38 40
  */
@@ -43,6 +45,11 @@ public final class ReloadActions extends Command implements IntelligentCommand {
43 45
             "reloadactions - reloads actions from disk",
44 46
             CommandType.TYPE_GLOBAL);
45 47
 
48
+    /** Creates a new instance of this command. */
49
+    @Inject
50
+    public ReloadActions() {
51
+    }
52
+
46 53
     /** {@inheritDoc} */
47 54
     @Override
48 55
     public void execute(final FrameContainer origin,

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/ReloadIdentities.java View File

@@ -33,6 +33,8 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.interfaces.IdentityController;
34 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
35 35
 
36
+import javax.inject.Inject;
37
+
36 38
 /**
37 39
  * Allows the user to reload identities.
38 40
  */
@@ -51,6 +53,7 @@ public class ReloadIdentities extends Command implements IntelligentCommand {
51 53
      *
52 54
      * @param identityController The controller to reload identities on.
53 55
      */
56
+    @Inject
54 57
     public ReloadIdentities(final IdentityController identityController) {
55 58
         this.identityController = identityController;
56 59
     }

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java View File

@@ -34,6 +34,8 @@ import com.dmdirc.plugins.PluginInfo;
34 34
 import com.dmdirc.plugins.PluginManager;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 
37
+import javax.inject.Inject;
38
+
37 39
 /**
38 40
  * Allows the user to reload a plugin.
39 41
  */
@@ -52,6 +54,7 @@ public class ReloadPlugin extends Command implements IntelligentCommand {
52 54
      *
53 55
      * @param pluginManager The plugin manager to reload plugins with.
54 56
      */
57
+    @Inject
55 58
     public ReloadPlugin(final PluginManager pluginManager) {
56 59
         this.pluginManager = pluginManager;
57 60
     }

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/SaveConfig.java View File

@@ -33,6 +33,8 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.interfaces.IdentityController;
34 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
35 35
 
36
+import javax.inject.Inject;
37
+
36 38
 /**
37 39
  * Allows the user to save the config file.
38 40
  */
@@ -51,6 +53,7 @@ public final class SaveConfig extends Command implements IntelligentCommand {
51 53
      *
52 54
      * @param identityController The controller to save identities on.
53 55
      */
56
+    @Inject
54 57
     public SaveConfig(final IdentityController identityController) {
55 58
         this.identityController = identityController;
56 59
     }

src/com/dmdirc/commandparser/commands/global/Set.java → src/com/dmdirc/commandparser/commands/global/SetCommand.java View File

@@ -43,10 +43,12 @@ import com.dmdirc.ui.input.AdditionalTabTargets;
43 43
 
44 44
 import java.util.List;
45 45
 
46
+import javax.inject.Inject;
47
+
46 48
 /**
47 49
  * The set command allows the user to inspect and change global config settings.
48 50
  */
49
-public class Set extends Command implements IntelligentCommand {
51
+public class SetCommand extends Command implements IntelligentCommand {
50 52
 
51 53
     /** A command info object for this command. */
52 54
     public static final CommandInfo INFO = new BaseCommandInfo("set",
@@ -77,7 +79,8 @@ public class Set extends Command implements IntelligentCommand {
77 79
      * @param identityController The controller to use to set settings.
78 80
      * @param identityFactory The factory to use to create new identities.
79 81
      */
80
-    public Set(
82
+    @Inject
83
+    public SetCommand(
81 84
             final IdentityController identityController,
82 85
             final IdentityFactory identityFactory) {
83 86
         super();

+ 3
- 0
src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java View File

@@ -34,6 +34,8 @@ import com.dmdirc.plugins.PluginInfo;
34 34
 import com.dmdirc.plugins.PluginManager;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 
37
+import javax.inject.Inject;
38
+
37 39
 /**
38 40
  * Allows the user to unload a plugin.
39 41
  */
@@ -52,6 +54,7 @@ public class UnloadPlugin extends Command implements IntelligentCommand {
52 54
      *
53 55
      * @param pluginManager The plugin manager to unload plugins with.
54 56
      */
57
+    @Inject
55 58
     public UnloadPlugin(final PluginManager pluginManager) {
56 59
         this.pluginManager = pluginManager;
57 60
     }

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/AllChannels.java View File

@@ -35,6 +35,8 @@ import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 36
 import com.dmdirc.ui.input.TabCompleter;
37 37
 
38
+import javax.inject.Inject;
39
+
38 40
 /**
39 41
  * The AllChannels command allows the user to issue a command to all channels
40 42
  * on a server.
@@ -46,6 +48,11 @@ public class AllChannels extends Command implements IntelligentCommand {
46 48
            "allchannels <command> - executes the command as though it had"
47 49
             + " been entered on all channels", CommandType.TYPE_SERVER);
48 50
 
51
+    /** Creates a new instance of this command. */
52
+    @Inject
53
+    public AllChannels() {
54
+    }
55
+
49 56
     /** {@inheritDoc} */
50 57
     @Override
51 58
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Away.java View File

@@ -33,6 +33,8 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35 35
 
36
+import javax.inject.Inject;
37
+
36 38
 /**
37 39
  * The away command allows the user to set their away message.
38 40
  */
@@ -43,6 +45,11 @@ public class Away extends Command {
43 45
     public static final CommandInfo INFO = new BaseCommandInfo("away",
44 46
            "away <reason> - marks you as away", CommandType.TYPE_SERVER);
45 47
 
48
+    /** Creates a new instance of this command. */
49
+    @Inject
50
+    public Away() {
51
+    }
52
+
46 53
     /** {@inheritDoc} */
47 54
     @Override
48 55
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Back.java View File

@@ -35,6 +35,8 @@ import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 37
 
38
+import javax.inject.Inject;
39
+
38 40
 /**
39 41
  * The back command allows the user to unset their away status.
40 42
  */
@@ -45,6 +47,11 @@ public class Back extends Command implements IntelligentCommand {
45 47
     public static final CommandInfo INFO = new BaseCommandInfo("back",
46 48
            "back - unsets your away status", CommandType.TYPE_SERVER);
47 49
 
50
+    /** Creates a new instance of this command. */
51
+    @Inject
52
+    public Back() {
53
+    }
54
+
48 55
     /** {@inheritDoc} */
49 56
     @Override
50 57
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/ChangeServer.java View File

@@ -36,6 +36,8 @@ import com.dmdirc.commandparser.commands.global.NewServer;
36 36
 import java.net.URI;
37 37
 import java.net.URISyntaxException;
38 38
 
39
+import javax.inject.Inject;
40
+
39 41
 /**
40 42
  * The /server command allows the user to connect to a new server.
41 43
  */
@@ -46,6 +48,11 @@ public class ChangeServer extends Command {
46 48
             "server <host[:[+]port]> [password] - connect to a different server",
47 49
             CommandType.TYPE_SERVER);
48 50
 
51
+    /** Creates a new instance of this command. */
52
+    @Inject
53
+    public ChangeServer() {
54
+    }
55
+
49 56
     /** {@inheritDoc} */
50 57
     @Override
51 58
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Ctcp.java View File

@@ -36,6 +36,8 @@ import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 37
 import com.dmdirc.ui.input.TabCompletionType;
38 38
 
39
+import javax.inject.Inject;
40
+
39 41
 /**
40 42
  * Allows the user to send CTCP messages.
41 43
  */
@@ -47,6 +49,11 @@ public class Ctcp extends Command implements IntelligentCommand {
47 49
             "ctcp <target> <type> [arguments] - sends a CTCP message",
48 50
             CommandType.TYPE_SERVER);
49 51
 
52
+    /** Creates a new instance of this command. */
53
+    @Inject
54
+    public Ctcp() {
55
+    }
56
+
50 57
     /** {@inheritDoc} */
51 58
     @Override
52 59
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Disconnect.java View File

@@ -32,6 +32,8 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34 34
 
35
+import javax.inject.Inject;
36
+
35 37
 /**
36 38
  * The disconnect command disconnects from the current server.
37 39
  */
@@ -42,6 +44,11 @@ public class Disconnect extends Command {
42 44
             "disconnect [reason] - disconnect from this server",
43 45
             CommandType.TYPE_SERVER);
44 46
 
47
+    /** Creates a new instance of this command. */
48
+    @Inject
49
+    public Disconnect() {
50
+    }
51
+
45 52
     /** {@inheritDoc} */
46 53
     @Override
47 54
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Ignore.java View File

@@ -40,6 +40,8 @@ import java.util.List;
40 40
 import java.util.regex.Pattern;
41 41
 import java.util.regex.PatternSyntaxException;
42 42
 
43
+import javax.inject.Inject;
44
+
43 45
 /**
44 46
  * Allows the user to add/view/delete ignores.
45 47
  */
@@ -50,6 +52,11 @@ public class Ignore extends Command implements IntelligentCommand {
50 52
             "ignore [--remove|--regex] [host] - manages the network's ignore list",
51 53
             CommandType.TYPE_SERVER);
52 54
 
55
+    /** Creates a new instance of this command. */
56
+    @Inject
57
+    public Ignore() {
58
+    }
59
+
53 60
     /** {@inheritDoc} */
54 61
     @Override
55 62
     public void execute(final FrameContainer origin,

+ 3
- 0
src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java View File

@@ -44,6 +44,8 @@ import com.dmdirc.util.collections.MapList;
44 44
 import java.util.ArrayList;
45 45
 import java.util.List;
46 46
 
47
+import javax.inject.Inject;
48
+
47 49
 /**
48 50
  * Allows the user to join channels.
49 51
  *
@@ -65,6 +67,7 @@ public class JoinChannelCommand extends Command implements
65 67
      *
66 68
      * @param controller The action controller to register listeners with.
67 69
      */
70
+    @Inject
68 71
     public JoinChannelCommand(final ActionController controller) {
69 72
         super();
70 73
 

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Message.java View File

@@ -39,6 +39,8 @@ import com.dmdirc.parser.interfaces.Parser;
39 39
 import com.dmdirc.ui.input.AdditionalTabTargets;
40 40
 import com.dmdirc.ui.input.TabCompletionType;
41 41
 
42
+import javax.inject.Inject;
43
+
42 44
 /**
43 45
  * Allows the user to send privmsgs.
44 46
  */
@@ -51,6 +53,11 @@ public class Message extends Command implements IntelligentCommand,
51 53
             "msg <target> <message> - sends a private message",
52 54
             CommandType.TYPE_SERVER);
53 55
 
56
+    /** Creates a new instance of this command. */
57
+    @Inject
58
+    public Message() {
59
+    }
60
+
54 61
     /** {@inheritDoc} */
55 62
     @Override
56 63
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Nick.java View File

@@ -36,6 +36,8 @@ import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 37
 import com.dmdirc.ui.input.TabCompletionType;
38 38
 
39
+import javax.inject.Inject;
40
+
39 41
 /**
40 42
  * Allows the user to change nickname.
41 43
  */
@@ -47,6 +49,11 @@ public class Nick extends Command implements IntelligentCommand {
47 49
             "nick <new nickname> - attempts to change your nickname to the one specified",
48 50
             CommandType.TYPE_SERVER);
49 51
 
52
+    /** Creates a new instance of this command. */
53
+    @Inject
54
+    public Nick() {
55
+    }
56
+
50 57
     /** {@inheritDoc} */
51 58
     @Override
52 59
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Notice.java View File

@@ -36,6 +36,8 @@ import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 37
 import com.dmdirc.ui.input.TabCompletionType;
38 38
 
39
+import javax.inject.Inject;
40
+
39 41
 /**
40 42
  * Allows the user to send notices.
41 43
  */
@@ -47,6 +49,11 @@ public class Notice extends Command implements IntelligentCommand {
47 49
             "notice <target> <message> - sends a notice",
48 50
             CommandType.TYPE_SERVER);
49 51
 
52
+    /** Creates a new instance of this command. */
53
+    @Inject
54
+    public Notice() {
55
+    }
56
+
50 57
     /** {@inheritDoc} */
51 58
     @Override
52 59
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/OpenQuery.java View File

@@ -39,6 +39,8 @@ import com.dmdirc.ui.input.AdditionalTabTargets;
39 39
 import com.dmdirc.ui.input.TabCompletionType;
40 40
 import com.dmdirc.ui.messages.Styliser;
41 41
 
42
+import javax.inject.Inject;
43
+
42 44
 /**
43 45
  * Allows the user to open a query dialog with another user.
44 46
  */
@@ -50,6 +52,11 @@ public class OpenQuery extends Command implements IntelligentCommand,
50 52
             "query <user> [message] - opens a query with the specified user",
51 53
             CommandType.TYPE_SERVER);
52 54
 
55
+    /** Creates a new instance of this command. */
56
+    @Inject
57
+    public OpenQuery() {
58
+    }
59
+
53 60
     /** {@inheritDoc} */
54 61
     @Override
55 62
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Raw.java View File

@@ -33,6 +33,8 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35 35
 
36
+import javax.inject.Inject;
37
+
36 38
 /**
37 39
  * The raw command allows the user to send a raw line of text directly to the
38 40
  * irc server.
@@ -45,6 +47,11 @@ public class Raw extends Command {
45 47
             "raw <text> - sends the specified text directly to the server",
46 48
             CommandType.TYPE_SERVER);
47 49
 
50
+    /** Creates a new instance of this command. */
51
+    @Inject
52
+    public Raw() {
53
+    }
54
+
48 55
     /** {@inheritDoc} */
49 56
     @Override
50 57
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Reconnect.java View File

@@ -32,6 +32,8 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34 34
 
35
+import javax.inject.Inject;
36
+
35 37
 /**
36 38
  * The reconnect command reconnects to the current server.
37 39
  */
@@ -42,6 +44,11 @@ public class Reconnect extends Command {
42 44
             "reconnect [reason] - reconnect to this server",
43 45
             CommandType.TYPE_SERVER);
44 46
 
47
+    /** Creates a new instance of this command. */
48
+    @Inject
49
+    public Reconnect() {
50
+    }
51
+
45 52
     /** {@inheritDoc} */
46 53
     @Override
47 54
     public void execute(final FrameContainer origin,

+ 7
- 0
src/com/dmdirc/commandparser/commands/server/Umode.java View File

@@ -34,6 +34,8 @@ import com.dmdirc.commandparser.commands.CommandOptions;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36 36
 
37
+import javax.inject.Inject;
38
+
37 39
 /**
38 40
  * Allows the user to change user modes.
39 41
  */
@@ -45,6 +47,11 @@ public class Umode extends Command {
45 47
             "umode [modes] - sets or displays your user modes",
46 48
             CommandType.TYPE_SERVER);
47 49
 
50
+    /** Creates a new instance of this command. */
51
+    @Inject
52
+    public Umode() {
53
+    }
54
+
48 55
     /** {@inheritDoc} */
49 56
     @Override
50 57
     public void execute(final FrameContainer origin,

+ 21
- 0
src/com/dmdirc/interfaces/CommandController.java View File

@@ -35,6 +35,27 @@ import java.util.Map;
35 35
  */
36 36
 public interface CommandController {
37 37
 
38
+    /**
39
+     * Describes a command and its associated {@link CommandInfo} object.
40
+     */
41
+    interface CommandDetails {
42
+
43
+        /**
44
+         * Gets the command.
45
+         *
46
+         * @return The command.
47
+         */
48
+        Command getCommand();
49
+
50
+        /**
51
+         * Gets the command's information.
52
+         *
53
+         * @return The command information.
54
+         */
55
+        CommandInfo getInfo();
56
+
57
+    }
58
+
38 59
     /**
39 60
      * Retrieves the command identified by the specified name, regardless of
40 61
      * type.

+ 2
- 2
test/com/dmdirc/TestMain.java View File

@@ -3,10 +3,10 @@ package com.dmdirc;
3 3
 import com.dmdirc.actions.ActionGroup;
4 4
 import com.dmdirc.actions.ActionManager;
5 5
 import com.dmdirc.commandline.CommandLineParser;
6
-import com.dmdirc.commandparser.CommandLoader;
7 6
 import com.dmdirc.commandparser.CommandManager;
8 7
 import com.dmdirc.config.IdentityManager;
9 8
 import com.dmdirc.config.InvalidIdentityFileException;
9
+import com.dmdirc.interfaces.CommandController.CommandDetails;
10 10
 import com.dmdirc.plugins.PluginManager;
11 11
 import com.dmdirc.updater.manager.UpdateManager;
12 12
 import com.dmdirc.util.URLBuilder;
@@ -41,7 +41,7 @@ public class TestMain extends Main {
41 41
             final CorePluginExtractor corePluginExtractor) {
42 42
         super(identityManager, serverManager, actionManager, commandLineParser,
43 43
                 pluginManager, commandManager, null, null, corePluginExtractor,
44
-                mock(URLBuilder.class), mock(CommandLoader.class));
44
+                mock(URLBuilder.class), Collections.<CommandDetails>emptySet());
45 45
         this.identityManager = identityManager;
46 46
         this.pluginManager = pluginManager;
47 47
         this.commandManager = commandManager;

Loading…
Cancel
Save