Parcourir la source

Revert "Continue main removal"

Revert "Begin work on removing CommandManager singleton"

This reverts commit e93538e9dc.

Change-Id: I8eb4f70f80292d66e3bdbe9f32766b5f427413c2
Depends-On: Iba86c7f2bf870684e0d41f88d82f16b43d43fe80
Reviewed-on: http://gerrit.dmdirc.com/2601
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.7
Shane Mc Cormack il y a 11 ans
Parent
révision
7b67f19db2
66 fichiers modifiés avec 221 ajouts et 635 suppressions
  1. 2
    2
      src/com/dmdirc/Main.java
  2. 2
    5
      src/com/dmdirc/Server.java
  3. 23
    8
      src/com/dmdirc/ServerManager.java
  4. 48
    63
      src/com/dmdirc/commandparser/CommandLoader.java
  5. 0
    3
      src/com/dmdirc/commandparser/commands/Command.java
  6. 0
    10
      src/com/dmdirc/commandparser/commands/channel/Ban.java
  7. 0
    10
      src/com/dmdirc/commandparser/commands/channel/Cycle.java
  8. 0
    10
      src/com/dmdirc/commandparser/commands/channel/Invite.java
  9. 0
    10
      src/com/dmdirc/commandparser/commands/channel/KickReason.java
  10. 0
    10
      src/com/dmdirc/commandparser/commands/channel/Mode.java
  11. 0
    10
      src/com/dmdirc/commandparser/commands/channel/Names.java
  12. 0
    10
      src/com/dmdirc/commandparser/commands/channel/Part.java
  13. 0
    10
      src/com/dmdirc/commandparser/commands/channel/SetNickColour.java
  14. 0
    10
      src/com/dmdirc/commandparser/commands/channel/ShowTopic.java
  15. 0
    10
      src/com/dmdirc/commandparser/commands/chat/Me.java
  16. 0
    10
      src/com/dmdirc/commandparser/commands/global/AliasCommand.java
  17. 0
    10
      src/com/dmdirc/commandparser/commands/global/AllServers.java
  18. 0
    10
      src/com/dmdirc/commandparser/commands/global/Clear.java
  19. 9
    0
      src/com/dmdirc/commandparser/commands/global/Echo.java
  20. 0
    10
      src/com/dmdirc/commandparser/commands/global/Exit.java
  21. 0
    10
      src/com/dmdirc/commandparser/commands/global/Help.java
  22. 0
    10
      src/com/dmdirc/commandparser/commands/global/Ifplugin.java
  23. 0
    10
      src/com/dmdirc/commandparser/commands/global/LoadPlugin.java
  24. 1
    4
      src/com/dmdirc/commandparser/commands/global/NewServer.java
  25. 0
    10
      src/com/dmdirc/commandparser/commands/global/Notify.java
  26. 0
    10
      src/com/dmdirc/commandparser/commands/global/OpenWindow.java
  27. 0
    10
      src/com/dmdirc/commandparser/commands/global/ReloadActions.java
  28. 0
    10
      src/com/dmdirc/commandparser/commands/global/ReloadIdentities.java
  29. 0
    10
      src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java
  30. 0
    10
      src/com/dmdirc/commandparser/commands/global/SaveConfig.java
  31. 2
    5
      src/com/dmdirc/commandparser/commands/global/Set.java
  32. 0
    10
      src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java
  33. 0
    10
      src/com/dmdirc/commandparser/commands/server/AllChannels.java
  34. 0
    10
      src/com/dmdirc/commandparser/commands/server/Away.java
  35. 0
    10
      src/com/dmdirc/commandparser/commands/server/Back.java
  36. 0
    10
      src/com/dmdirc/commandparser/commands/server/ChangeServer.java
  37. 0
    10
      src/com/dmdirc/commandparser/commands/server/Ctcp.java
  38. 0
    10
      src/com/dmdirc/commandparser/commands/server/Disconnect.java
  39. 0
    10
      src/com/dmdirc/commandparser/commands/server/Ignore.java
  40. 2
    5
      src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java
  41. 0
    10
      src/com/dmdirc/commandparser/commands/server/Message.java
  42. 0
    10
      src/com/dmdirc/commandparser/commands/server/Nick.java
  43. 0
    10
      src/com/dmdirc/commandparser/commands/server/Notice.java
  44. 0
    10
      src/com/dmdirc/commandparser/commands/server/OpenQuery.java
  45. 0
    10
      src/com/dmdirc/commandparser/commands/server/Raw.java
  46. 2
    4
      src/com/dmdirc/commandparser/commands/server/RawServerCommand.java
  47. 0
    10
      src/com/dmdirc/commandparser/commands/server/Reconnect.java
  48. 0
    10
      src/com/dmdirc/commandparser/commands/server/Umode.java
  49. 1
    1
      src/com/dmdirc/commandparser/parsers/CommandParser.java
  50. 2
    7
      src/com/dmdirc/ui/core/util/URLHandler.java
  51. 7
    9
      src/com/dmdirc/ui/input/InputHandler.java
  52. 3
    4
      test/com/dmdirc/ServerTest.java
  53. 1
    1
      test/com/dmdirc/TestMain.java
  54. 1
    3
      test/com/dmdirc/commandparser/commands/HelpTest.java
  55. 13
    20
      test/com/dmdirc/commandparser/commands/channel/BanTest.java
  56. 11
    14
      test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java
  57. 8
    9
      test/com/dmdirc/commandparser/commands/channel/ModeTest.java
  58. 6
    7
      test/com/dmdirc/commandparser/commands/channel/NamesTest.java
  59. 6
    7
      test/com/dmdirc/commandparser/commands/channel/PartTest.java
  60. 12
    9
      test/com/dmdirc/commandparser/commands/channel/SetNickColourTest.java
  61. 10
    8
      test/com/dmdirc/commandparser/commands/chat/MeTest.java
  62. 8
    11
      test/com/dmdirc/commandparser/commands/global/AliasCommandTest.java
  63. 8
    11
      test/com/dmdirc/commandparser/commands/global/IfpluginTest.java
  64. 9
    13
      test/com/dmdirc/commandparser/commands/global/NewServerTest.java
  65. 16
    14
      test/com/dmdirc/commandparser/commands/server/ChangeServerTest.java
  66. 8
    8
      test/com/dmdirc/ui/WindowManagerTest.java

+ 2
- 2
src/com/dmdirc/Main.java Voir le fichier

@@ -104,6 +104,7 @@ public class Main {
104 104
         Thread.setDefaultUncaughtExceptionHandler(new DMDircExceptionHandler());
105 105
 
106 106
         IdentityManager.getIdentityManager().loadVersionIdentity();
107
+        serverManager = new ServerManager(this);
107 108
         ActionManager.initActionManager(this, serverManager, IdentityManager.getIdentityManager());
108 109
 
109 110
         final CommandLineParser clp = new CommandLineParser(this, args);
@@ -120,13 +121,12 @@ public class Main {
120 121
 
121 122
         pluginManager = new PluginManager(IdentityManager.getIdentityManager(), this);
122 123
         checkBundledPlugins(pluginManager, IdentityManager.getIdentityManager().getGlobalConfiguration());
123
-        serverManager = new ServerManager(new ParserFactory(pluginManager));
124 124
 
125 125
         ThemeManager.loadThemes();
126 126
 
127 127
         clp.applySettings();
128 128
 
129
-        new CommandLoader(serverManager).loadCommands(CommandManager.initCommandManager(IdentityManager.getIdentityManager(), this));
129
+        new CommandLoader().loadCommands(CommandManager.initCommandManager(IdentityManager.getIdentityManager(), this));
130 130
 
131 131
         for (String service : new String[]{"ui", "tabcompletion", "parser"}) {
132 132
             ensureExists(pluginManager, service);

+ 2
- 5
src/com/dmdirc/Server.java Voir le fichier

@@ -194,14 +194,11 @@ public class Server extends WritableFrameContainer
194 194
      * the specified profile.
195 195
      *
196 196
      * @since 0.6.3
197
-     *
198
-     * @param parserFactory Parser factory used to create parsers.
199 197
      * @param manager The servermanager that owns this server.
200 198
      * @param uri The address of the server to connect to
201 199
      * @param profile The profile to use
202 200
      */
203
-    public Server(final ParserFactory parserFactory,
204
-            final ServerManager manager, final URI uri, final Identity profile) {
201
+    public Server(final ServerManager manager, final URI uri, final Identity profile) {
205 202
         super("server-disconnected", getHost(uri), getHost(uri),
206 203
                 new ConfigManager(uri.getScheme(), "", "", uri.getHost()),
207 204
                 new ServerCommandParser(
@@ -211,7 +208,7 @@ public class Server extends WritableFrameContainer
211 208
                 WindowComponent.CERTIFICATE_VIEWER.getIdentifier()));
212 209
 
213 210
         this.manager = manager;
214
-        this.parserFactory = parserFactory;
211
+        parserFactory = new ParserFactory(manager.getMain().getPluginManager());
215 212
         setConnectionDetails(uri, profile);
216 213
 
217 214
         manager.registerServer(this);

+ 23
- 8
src/com/dmdirc/ServerManager.java Voir le fichier

@@ -36,25 +36,40 @@ import java.util.List;
36 36
 import java.util.Set;
37 37
 import java.util.concurrent.CopyOnWriteArraySet;
38 38
 
39
-import lombok.RequiredArgsConstructor;
40
-
41 39
 /**
42 40
  * The ServerManager maintains a list of all servers, and provides methods to
43 41
  * search or iterate over them.
44 42
  */
45
-@RequiredArgsConstructor
46 43
 public class ServerManager implements ServerFactory {
47 44
 
48
-    /** Parser factory. */
49
-    private final ParserFactory parserFactory;
45
+    /** Main that owns this ServerManager. */
46
+    private final Main main;
50 47
 
51 48
     /** All servers that currently exist. */
52 49
     private final Set<Server> servers = new CopyOnWriteArraySet<Server>();
53 50
 
51
+    /**
52
+     * Creates a new instance of ServerManager.
53
+     */
54
+    public ServerManager(final Main main) {
55
+        this.main = main;
56
+    }
57
+
58
+    /**
59
+     * Get the Main that owns this ServerManager.
60
+     *
61
+     * @return The Main that owns this ServerManager.
62
+     * @Deprecated Global state is bad.
63
+     */
64
+    @Deprecated
65
+    public Main getMain() {
66
+        return main;
67
+    }
68
+
54 69
     /** {@inheritDoc} */
55 70
     @Override
56 71
     public Server createServer(final URI uri, final Identity profile) {
57
-        return new Server(parserFactory, this, uri, profile);
72
+        return new Server(this, uri, profile);
58 73
     }
59 74
 
60 75
     /**
@@ -197,7 +212,7 @@ public class ServerManager implements ServerFactory {
197 212
         }
198 213
 
199 214
         if (server == null) {
200
-            server = new Server(parserFactory, this, uri, profile);
215
+            server = new Server(this, uri, profile);
201 216
             server.connect();
202 217
             return server;
203 218
         }
@@ -233,7 +248,7 @@ public class ServerManager implements ServerFactory {
233 248
 
234 249
         if (connectedServer == null) {
235 250
             try {
236
-                final Server server = new Server(parserFactory, this, new URI("irc://irc.quakenet.org/DMDirc"),
251
+                final Server server = new Server(this, new URI("irc://irc.quakenet.org/DMDirc"),
237 252
                         IdentityManager.getIdentityManager()
238 253
                         .getIdentitiesByType("profile").get(0));
239 254
                 server.connect();

+ 48
- 63
src/com/dmdirc/commandparser/CommandLoader.java Voir le fichier

@@ -66,27 +66,12 @@ import com.dmdirc.commandparser.commands.server.RawServerCommand;
66 66
 import com.dmdirc.commandparser.commands.server.Reconnect;
67 67
 import com.dmdirc.commandparser.commands.server.Umode;
68 68
 import com.dmdirc.interfaces.CommandController;
69
-import com.dmdirc.interfaces.ServerFactory;
70 69
 
71 70
 /**
72 71
  * Facilitates loading of core commands into a {@link CommandManager}.
73 72
  */
74 73
 public class CommandLoader {
75 74
 
76
-    /**
77
-     * Server factory to pass to commands.
78
-     */
79
-    private ServerFactory serverFactory;
80
-
81
-    /**
82
-     * Creates a new command loader.
83
-     *
84
-     * @param serverFactory Server factory to pass to commands
85
-     */
86
-    public CommandLoader(final ServerFactory serverFactory) {
87
-        this.serverFactory = serverFactory;
88
-    }
89
-
90 75
     /**
91 76
      * Loads all known core commands into the given manager.
92 77
      *
@@ -94,63 +79,63 @@ public class CommandLoader {
94 79
      */
95 80
     public void loadCommands(final CommandController manager) {
96 81
         // Chat commands
97
-        manager.registerCommand(new Me(manager), Me.INFO);
82
+        manager.registerCommand(new Me(), Me.INFO);
98 83
 
99 84
         // Channel commands
100
-        manager.registerCommand(new Ban(manager), Ban.INFO);
101
-        manager.registerCommand(new Cycle(manager), Cycle.INFO);
102
-        manager.registerCommand(new Invite(manager), Invite.INFO);
103
-        manager.registerCommand(new KickReason(manager), KickReason.INFO);
104
-        manager.registerCommand(new Mode(manager), Mode.INFO);
105
-        manager.registerCommand(new Names(manager), Names.INFO);
106
-        manager.registerCommand(new Part(manager), Part.INFO);
107
-        manager.registerCommand(new SetNickColour(manager), SetNickColour.INFO);
108
-        manager.registerCommand(new ShowTopic(manager), ShowTopic.INFO);
85
+        manager.registerCommand(new Ban(), Ban.INFO);
86
+        manager.registerCommand(new Cycle(), Cycle.INFO);
87
+        manager.registerCommand(new Invite(), Invite.INFO);
88
+        manager.registerCommand(new KickReason(), KickReason.INFO);
89
+        manager.registerCommand(new Mode(), Mode.INFO);
90
+        manager.registerCommand(new Names(), Names.INFO);
91
+        manager.registerCommand(new Part(), Part.INFO);
92
+        manager.registerCommand(new SetNickColour(), SetNickColour.INFO);
93
+        manager.registerCommand(new ShowTopic(), ShowTopic.INFO);
109 94
 
110 95
         // Server commands
111
-        manager.registerCommand(new AllChannels(manager), AllChannels.INFO);
112
-        manager.registerCommand(new Away(manager), Away.INFO);
113
-        manager.registerCommand(new Back(manager), Back.INFO);
114
-        manager.registerCommand(new ChangeServer(manager), ChangeServer.INFO);
115
-        manager.registerCommand(new Ctcp(manager), Ctcp.INFO);
116
-        manager.registerCommand(new Disconnect(manager), Disconnect.INFO);
117
-        manager.registerCommand(new Ignore(manager), Ignore.INFO);
118
-        manager.registerCommand(new JoinChannelCommand(manager), JoinChannelCommand.INFO);
119
-        manager.registerCommand(new Message(manager), Message.INFO);
120
-        manager.registerCommand(new Nick(manager), Nick.INFO);
121
-        manager.registerCommand(new Notice(manager), Notice.INFO);
122
-        manager.registerCommand(new OpenQuery(manager), OpenQuery.INFO);
123
-        manager.registerCommand(new Raw(manager), Raw.INFO);
124
-        manager.registerCommand(new Reconnect(manager), Reconnect.INFO);
125
-        manager.registerCommand(new Umode(manager), Umode.INFO);
96
+        manager.registerCommand(new AllChannels(), AllChannels.INFO);
97
+        manager.registerCommand(new Away(), Away.INFO);
98
+        manager.registerCommand(new Back(), Back.INFO);
99
+        manager.registerCommand(new ChangeServer(), ChangeServer.INFO);
100
+        manager.registerCommand(new Ctcp(), Ctcp.INFO);
101
+        manager.registerCommand(new Disconnect(), Disconnect.INFO);
102
+        manager.registerCommand(new Ignore(), Ignore.INFO);
103
+        manager.registerCommand(new JoinChannelCommand(), JoinChannelCommand.INFO);
104
+        manager.registerCommand(new Message(), Message.INFO);
105
+        manager.registerCommand(new Nick(), Nick.INFO);
106
+        manager.registerCommand(new Notice(), Notice.INFO);
107
+        manager.registerCommand(new OpenQuery(), OpenQuery.INFO);
108
+        manager.registerCommand(new Raw(), Raw.INFO);
109
+        manager.registerCommand(new Reconnect(), Reconnect.INFO);
110
+        manager.registerCommand(new Umode(), Umode.INFO);
126 111
 
127
-        manager.registerCommand(new RawServerCommand(manager, "lusers"));
128
-        manager.registerCommand(new RawServerCommand(manager, "map"));
129
-        manager.registerCommand(new RawServerCommand(manager, "motd"));
130
-        manager.registerCommand(new RawServerCommand(manager, "oper"));
131
-        manager.registerCommand(new RawServerCommand(manager, "whois"));
132
-        manager.registerCommand(new RawServerCommand(manager, "who"));
112
+        manager.registerCommand(new RawServerCommand("lusers"));
113
+        manager.registerCommand(new RawServerCommand("map"));
114
+        manager.registerCommand(new RawServerCommand("motd"));
115
+        manager.registerCommand(new RawServerCommand("oper"));
116
+        manager.registerCommand(new RawServerCommand("whois"));
117
+        manager.registerCommand(new RawServerCommand("who"));
133 118
 
134 119
         // Query commands
135 120
 
136 121
         // Global commands
137
-        manager.registerCommand(new AliasCommand(manager), AliasCommand.INFO);
138
-        manager.registerCommand(new AllServers(manager), AllServers.INFO);
139
-        manager.registerCommand(new Clear(manager), Clear.INFO);
140
-        manager.registerCommand(new Echo(manager), Echo.INFO);
141
-        manager.registerCommand(new Exit(manager), Exit.INFO);
142
-        manager.registerCommand(new Help(manager), Help.INFO);
143
-        manager.registerCommand(new Ifplugin(manager), Ifplugin.INFO);
144
-        manager.registerCommand(new NewServer(manager, serverFactory), NewServer.INFO);
145
-        manager.registerCommand(new Notify(manager), Notify.INFO);
146
-        manager.registerCommand(new LoadPlugin(manager), LoadPlugin.INFO);
147
-        manager.registerCommand(new UnloadPlugin(manager), UnloadPlugin.INFO);
148
-        manager.registerCommand(new OpenWindow(manager), OpenWindow.INFO);
149
-        manager.registerCommand(new ReloadActions(manager), ReloadActions.INFO);
150
-        manager.registerCommand(new ReloadIdentities(manager), ReloadIdentities.INFO);
151
-        manager.registerCommand(new ReloadPlugin(manager), ReloadPlugin.INFO);
152
-        manager.registerCommand(new SaveConfig(manager), SaveConfig.INFO);
153
-        manager.registerCommand(new Set(manager), Set.INFO);
122
+        manager.registerCommand(new AliasCommand(), AliasCommand.INFO);
123
+        manager.registerCommand(new AllServers(), AllServers.INFO);
124
+        manager.registerCommand(new Clear(), Clear.INFO);
125
+        manager.registerCommand(new Echo(), Echo.INFO);
126
+        manager.registerCommand(new Exit(), Exit.INFO);
127
+        manager.registerCommand(new Help(), Help.INFO);
128
+        manager.registerCommand(new Ifplugin(), Ifplugin.INFO);
129
+        manager.registerCommand(new NewServer(manager.getMain().getServerManager()), NewServer.INFO);
130
+        manager.registerCommand(new Notify(), Notify.INFO);
131
+        manager.registerCommand(new LoadPlugin(), LoadPlugin.INFO);
132
+        manager.registerCommand(new UnloadPlugin(), UnloadPlugin.INFO);
133
+        manager.registerCommand(new OpenWindow(), OpenWindow.INFO);
134
+        manager.registerCommand(new ReloadActions(), ReloadActions.INFO);
135
+        manager.registerCommand(new ReloadIdentities(), ReloadIdentities.INFO);
136
+        manager.registerCommand(new ReloadPlugin(), ReloadPlugin.INFO);
137
+        manager.registerCommand(new SaveConfig(), SaveConfig.INFO);
138
+        manager.registerCommand(new Set(), Set.INFO);
154 139
     }
155 140
 
156 141
 }

+ 0
- 3
src/com/dmdirc/commandparser/commands/Command.java Voir le fichier

@@ -52,10 +52,7 @@ public abstract class Command {
52 52
     /**
53 53
      * Creates a new instance of Command using the default CommandManager
54 54
      * provided by {@link CommandManager#getCommandManager()}.
55
-     *
56
-     * @deprecated use {@link Command#Command(com.dmdirc.interfaces.CommandController)}
57 55
      */
58
-    @Deprecated
59 56
     public Command() {
60 57
         this(CommandManager.getCommandManager());
61 58
     }

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/Ban.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35
-import com.dmdirc.interfaces.CommandController;
36 35
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
37 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
38 37
 import com.dmdirc.ui.input.TabCompletionType;
@@ -47,15 +46,6 @@ public class Ban extends Command implements IntelligentCommand {
47 46
             "ban <user|host> - bans the specified user or host from the channel",
48 47
             CommandType.TYPE_CHANNEL);
49 48
 
50
-    /**
51
-     * Creates a new instance of the Ban command
52
-     *
53
-     * @param controller Command controller for the command
54
-     */
55
-    public Ban(final CommandController controller) {
56
-        super(controller);
57
-    }
58
-
59 49
     /** {@inheritDoc} */
60 50
     @Override
61 51
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/Cycle.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 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
-import com.dmdirc.interfaces.CommandController;
36 35
 
37 36
 /**
38 37
  * The cycle command allows users to rapidly part and rejoin a channel.
@@ -45,15 +44,6 @@ public class Cycle extends Command {
45 44
             "cycle [message] - parts and rejoins the channel",
46 45
             CommandType.TYPE_CHANNEL);
47 46
 
48
-    /**
49
-     * Creates a new instance of the Cycle command
50
-     *
51
-     * @param controller Command controller for the command
52
-     */
53
-    public Cycle(final CommandController controller) {
54
-        super(controller);
55
-    }
56
-
57 47
     /** {@inheritDoc} */
58 48
     @Override
59 49
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/Invite.java Voir le fichier

@@ -34,7 +34,6 @@ import com.dmdirc.commandparser.commands.CommandOptions;
34 34
 import com.dmdirc.commandparser.commands.ExternalCommand;
35 35
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
36 36
 import com.dmdirc.commandparser.commands.context.CommandContext;
37
-import com.dmdirc.interfaces.CommandController;
38 37
 import com.dmdirc.parser.interfaces.ChannelInfo;
39 38
 
40 39
 /**
@@ -50,15 +49,6 @@ public class Invite extends Command implements ExternalCommand {
50 49
             "invite <user> - invites user to a channel",
51 50
             CommandType.TYPE_CHANNEL);
52 51
 
53
-    /**
54
-     * Creates a new instance of the Invite command
55
-     *
56
-     * @param controller Command controller for the command
57
-     */
58
-    public Invite(final CommandController controller) {
59
-        super(controller);
60
-    }
61
-
62 52
     /** {@inheritDoc} */
63 53
     @Override
64 54
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/KickReason.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.CommandContext;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
38 37
 import com.dmdirc.ui.input.AdditionalTabTargets;
39 38
 import com.dmdirc.ui.input.TabCompletionType;
@@ -50,15 +49,6 @@ public class KickReason extends Command implements IntelligentCommand {
50 49
             "kick <user> [reason] - kicks the specified user from the channel",
51 50
             CommandType.TYPE_CHANNEL);
52 51
 
53
-    /**
54
-     * Creates a new instance of the KickReason command
55
-     *
56
-     * @param controller Command controller for the command
57
-     */
58
-    public KickReason(final CommandController controller) {
59
-        super(controller);
60
-    }
61
-
62 52
     /** {@inheritDoc} */
63 53
     @Override
64 54
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/Mode.java Voir le fichier

@@ -35,7 +35,6 @@ import com.dmdirc.commandparser.commands.ExternalCommand;
35 35
 import com.dmdirc.commandparser.commands.IntelligentCommand;
36 36
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
37 37
 import com.dmdirc.commandparser.commands.context.CommandContext;
38
-import com.dmdirc.interfaces.CommandController;
39 38
 import com.dmdirc.parser.interfaces.ChannelInfo;
40 39
 import com.dmdirc.ui.input.AdditionalTabTargets;
41 40
 import com.dmdirc.ui.input.TabCompletionType;
@@ -52,15 +51,6 @@ public class Mode extends Command implements IntelligentCommand,
52 51
             "mode [changes] - displays or changes the current channel modes",
53 52
             CommandType.TYPE_CHANNEL);
54 53
 
55
-    /**
56
-     * Creates a new instance of the Mode command
57
-     *
58
-     * @param controller Command controller for the command
59
-     */
60
-    public Mode(final CommandController controller) {
61
-        super(controller);
62
-    }
63
-
64 54
     /** {@inheritDoc} */
65 55
     @Override
66 56
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/Names.java Voir le fichier

@@ -35,7 +35,6 @@ import com.dmdirc.commandparser.commands.ExternalCommand;
35 35
 import com.dmdirc.commandparser.commands.IntelligentCommand;
36 36
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
37 37
 import com.dmdirc.commandparser.commands.context.CommandContext;
38
-import com.dmdirc.interfaces.CommandController;
39 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
40 39
 
41 40
 /**
@@ -50,15 +49,6 @@ public class Names extends Command implements IntelligentCommand,
50 49
             "names - Requests a list of users that are in the channel",
51 50
             CommandType.TYPE_CHANNEL);
52 51
 
53
-    /**
54
-     * Creates a new instance of the Names command
55
-     *
56
-     * @param controller Command controller for the command
57
-     */
58
-    public Names(final CommandController controller) {
59
-        super(controller);
60
-    }
61
-
62 52
     /** {@inheritDoc} */
63 53
     @Override
64 54
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/Part.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 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
-import com.dmdirc.interfaces.CommandController;
36 35
 
37 36
 /**
38 37
  * The part command parts the current channel with a specified part message.
@@ -45,15 +44,6 @@ public class Part extends Command {
45 44
             "part [reason] - parts the channel",
46 45
             CommandType.TYPE_CHANNEL);
47 46
 
48
-    /**
49
-     * Creates a new instance of the Part command
50
-     *
51
-     * @param controller Command controller for the command
52
-     */
53
-    public Part(final CommandController controller) {
54
-        super(controller);
55
-    }
56
-
57 47
     /** {@inheritDoc} */
58 48
     @Override
59 49
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/SetNickColour.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.Command;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.CommandContext;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
38 37
 import com.dmdirc.ui.Colour;
39 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
@@ -51,15 +50,6 @@ public class SetNickColour extends Command implements IntelligentCommand {
51 50
             + "set the specified person's display colour",
52 51
             CommandType.TYPE_CHANNEL);
53 52
 
54
-    /**
55
-     * Creates a new instance of the SetNickColour command
56
-     *
57
-     * @param controller Command controller for the command
58
-     */
59
-    public SetNickColour(final CommandController controller) {
60
-        super(controller);
61
-    }
62
-
63 53
     /** {@inheritDoc} */
64 54
     @Override
65 55
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/channel/ShowTopic.java Voir le fichier

@@ -34,7 +34,6 @@ import com.dmdirc.commandparser.commands.CommandOptions;
34 34
 import com.dmdirc.commandparser.commands.ExternalCommand;
35 35
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
36 36
 import com.dmdirc.commandparser.commands.context.CommandContext;
37
-import com.dmdirc.interfaces.CommandController;
38 37
 import com.dmdirc.parser.interfaces.ChannelInfo;
39 38
 
40 39
 /**
@@ -48,15 +47,6 @@ public class ShowTopic extends Command implements ExternalCommand {
48 47
             "topic - displays the current topic\ntopic <newtopic> - sets the channel topic",
49 48
             CommandType.TYPE_CHANNEL);
50 49
 
51
-    /**
52
-     * Creates a new instance of the ShowTopic command
53
-     *
54
-     * @param controller Command controller for the command
55
-     */
56
-    public ShowTopic(final CommandController controller) {
57
-        super(controller);
58
-    }
59
-
60 50
     /** {@inheritDoc} */
61 51
     @Override
62 52
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/chat/Me.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.Command;
33 33
 import com.dmdirc.commandparser.commands.ValidatingCommand;
34 34
 import com.dmdirc.commandparser.commands.context.ChatCommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.CommandContext;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.util.validators.ValidationResponse;
38 37
 
39 38
 /**
@@ -46,15 +45,6 @@ public class Me extends Command implements ValidatingCommand {
46 45
             "me <action> - sends the specified action",
47 46
             CommandType.TYPE_CHAT);
48 47
 
49
-    /**
50
-     * Creates a new instance of the Me command
51
-     *
52
-     * @param controller Command controller for the command
53
-     */
54
-    public Me(final CommandController controller) {
55
-        super(controller);
56
-    }
57
-
58 48
     /** {@inheritDoc} */
59 49
     @Override
60 50
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/AliasCommand.java Voir le fichier

@@ -34,7 +34,6 @@ import com.dmdirc.commandparser.CommandType;
34 34
 import com.dmdirc.commandparser.commands.Command;
35 35
 import com.dmdirc.commandparser.commands.IntelligentCommand;
36 36
 import com.dmdirc.commandparser.commands.context.CommandContext;
37
-import com.dmdirc.interfaces.CommandController;
38 37
 import com.dmdirc.ui.input.AdditionalTabTargets;
39 38
 import com.dmdirc.ui.input.TabCompleter;
40 39
 
@@ -48,15 +47,6 @@ public class AliasCommand extends Command implements IntelligentCommand {
48 47
             "alias [--remove] <name> [command] - creates or removes the specified alias",
49 48
             CommandType.TYPE_GLOBAL);
50 49
 
51
-    /**
52
-     * Creates a new instance of the AliasCommand command
53
-     *
54
-     * @param controller Command controller for the command
55
-     */
56
-    public AliasCommand(final CommandController controller) {
57
-        super(controller);
58
-    }
59
-
60 50
     /** {@inheritDoc} */
61 51
     @Override
62 52
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/AllServers.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.CommandType;
31 31
 import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
-import com.dmdirc.interfaces.CommandController;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 import com.dmdirc.ui.input.TabCompleter;
37 36
 
@@ -45,15 +44,6 @@ public class AllServers extends Command implements IntelligentCommand {
45 44
             "allservers <command> - executes the command as though it had"
46 45
             + " been entered on all servers", CommandType.TYPE_GLOBAL);
47 46
 
48
-    /**
49
-     * Creates a new instance of the AllServers command
50
-     *
51
-     * @param controller Command controller for the command
52
-     */
53
-    public AllServers(final CommandController controller) {
54
-        super(controller);
55
-    }
56
-
57 47
     /** {@inheritDoc} */
58 48
     @Override
59 49
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/Clear.java Voir le fichier

@@ -30,7 +30,6 @@ import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
-import com.dmdirc.interfaces.CommandController;
34 33
 import com.dmdirc.ui.input.AdditionalTabTargets;
35 34
 
36 35
 /**
@@ -43,15 +42,6 @@ public class Clear extends Command implements IntelligentCommand {
43 42
             "clear - clears the current window's text area",
44 43
             CommandType.TYPE_GLOBAL);
45 44
 
46
-    /**
47
-     * Creates a new instance of the Clear command
48
-     *
49
-     * @param controller Command controller for the command
50
-     */
51
-    public Clear(final CommandController controller) {
52
-        super(controller);
53
-    }
54
-
55 45
     /** {@inheritDoc} */
56 46
     @Override
57 47
     public void execute(final FrameContainer origin,

+ 9
- 0
src/com/dmdirc/commandparser/commands/global/Echo.java Voir le fichier

@@ -61,6 +61,15 @@ public class Echo extends Command implements IntelligentCommand {
61 61
     /** The command flag handler for this command. */
62 62
     private final CommandFlagHandler handler;
63 63
 
64
+    /**
65
+     * Creates a new instance of Echo.
66
+     */
67
+    public Echo() {
68
+        super();
69
+
70
+        handler = new CommandFlagHandler(timeStampFlag, targetFlag);
71
+    }
72
+
64 73
     /**
65 74
      * Creates a new instance of Echo.
66 75
      *

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/Exit.java Voir le fichier

@@ -29,7 +29,6 @@ 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;
33 32
 
34 33
 /**
35 34
  * The exit command allows the user to quit DMDirc with a custom quit message.
@@ -43,15 +42,6 @@ public class Exit extends Command {
43 42
             "exit [reason] - exits the client",
44 43
             CommandType.TYPE_GLOBAL);
45 44
 
46
-    /**
47
-     * Creates a new instance of the Exit command
48
-     *
49
-     * @param controller Command controller for the command
50
-     */
51
-    public Exit(final CommandController controller) {
52
-        super(controller);
53
-    }
54
-
55 45
     /** {@inheritDoc} */
56 46
     @Override
57 47
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/Help.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.CommandType;
31 31
 import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
-import com.dmdirc.interfaces.CommandController;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 import com.dmdirc.ui.input.TabCompletionType;
37 36
 import com.dmdirc.ui.messages.Styliser;
@@ -53,15 +52,6 @@ public class Help extends Command implements IntelligentCommand {
53 52
             "help [command] - shows client command help",
54 53
             CommandType.TYPE_GLOBAL);
55 54
 
56
-    /**
57
-     * Creates a new instance of the Help command
58
-     *
59
-     * @param controller Command controller for the command
60
-     */
61
-    public Help(final CommandController controller) {
62
-        super(controller);
63
-    }
64
-
65 55
     /** {@inheritDoc} */
66 56
     @Override
67 57
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/Ifplugin.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.Command;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.commandparser.parsers.GlobalCommandParser;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.plugins.PluginInfo;
38 37
 import com.dmdirc.ui.input.AdditionalTabTargets;
39 38
 import com.dmdirc.ui.input.TabCompleter;
@@ -50,15 +49,6 @@ public class Ifplugin extends Command implements IntelligentCommand {
50 49
             + "specified plugin is/isn't loaded",
51 50
             CommandType.TYPE_GLOBAL);
52 51
 
53
-    /**
54
-     * Creates a new instance of the Ifplugin command
55
-     *
56
-     * @param controller Command controller for the command
57
-     */
58
-    public Ifplugin(final CommandController controller) {
59
-        super(controller);
60
-    }
61
-
62 52
     /** {@inheritDoc} */
63 53
     @Override
64 54
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/LoadPlugin.java Voir le fichier

@@ -30,7 +30,6 @@ import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
-import com.dmdirc.interfaces.CommandController;
34 33
 import com.dmdirc.plugins.PluginInfo;
35 34
 import com.dmdirc.plugins.PluginMetaData;
36 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
@@ -45,15 +44,6 @@ public class LoadPlugin extends Command implements IntelligentCommand {
45 44
             "loadplugin <plugin> - loads the specified class as a plugin",
46 45
             CommandType.TYPE_GLOBAL);
47 46
 
48
-    /**
49
-     * Creates a new instance of the LoadPlugin command
50
-     *
51
-     * @param controller Command controller for the command
52
-     */
53
-    public LoadPlugin(final CommandController controller) {
54
-        super(controller);
55
-    }
56
-
57 47
     /** {@inheritDoc} */
58 48
     @Override
59 49
     public void execute(final FrameContainer origin,

+ 1
- 4
src/com/dmdirc/commandparser/commands/global/NewServer.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.config.IdentityManager;
35
-import com.dmdirc.interfaces.CommandController;
36 35
 import com.dmdirc.interfaces.ServerFactory;
37 36
 import com.dmdirc.logger.ErrorLevel;
38 37
 import com.dmdirc.logger.Logger;
@@ -61,11 +60,9 @@ public class NewServer extends Command implements IntelligentCommand {
61 60
      * Creates a new newserver command which will use the specified factory
62 61
      * to construct servers.
63 62
      *
64
-     * @param controller Command controller for this command
65 63
      * @param serverFactory The factory to use to construct servers
66 64
      */
67
-    public NewServer(final CommandController controller, final ServerFactory serverFactory) {
68
-        super(controller);
65
+    public NewServer(final ServerFactory serverFactory) {
69 66
         this.serverFactory = serverFactory;
70 67
     }
71 68
 

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/Notify.java Voir le fichier

@@ -30,7 +30,6 @@ import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
-import com.dmdirc.interfaces.CommandController;
34 33
 import com.dmdirc.ui.Colour;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 import com.dmdirc.ui.messages.ColourManager;
@@ -46,15 +45,6 @@ public class Notify extends Command implements IntelligentCommand {
46 45
             "notify <colour> - sets the notification colour for this window",
47 46
             CommandType.TYPE_GLOBAL);
48 47
 
49
-    /**
50
-     * Creates a new instance of the Notify command
51
-     *
52
-     * @param controller Command controller for the command
53
-     */
54
-    public Notify(final CommandController controller) {
55
-        super(controller);
56
-    }
57
-
58 48
     /** {@inheritDoc} */
59 49
     @Override
60 50
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/OpenWindow.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.CommandType;
31 31
 import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
-import com.dmdirc.interfaces.CommandController;
35 34
 import com.dmdirc.ui.WindowManager;
36 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 36
 
@@ -46,15 +45,6 @@ public class OpenWindow extends Command implements IntelligentCommand {
46 45
             + "- opens a window with the specified name and title",
47 46
             CommandType.TYPE_GLOBAL);
48 47
 
49
-    /**
50
-     * Creates a new instance of the OpenWindow command
51
-     *
52
-     * @param controller Command controller for the command
53
-     */
54
-    public OpenWindow(final CommandController controller) {
55
-        super(controller);
56
-    }
57
-
58 48
     /** {@inheritDoc} */
59 49
     @Override
60 50
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/ReloadActions.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.CommandType;
31 31
 import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34
-import com.dmdirc.interfaces.CommandController;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 
37 36
 /**
@@ -44,15 +43,6 @@ public final class ReloadActions extends Command implements IntelligentCommand {
44 43
             "reloadactions - reloads actions from disk",
45 44
             CommandType.TYPE_GLOBAL);
46 45
 
47
-    /**
48
-     * Creates a new instance of the ReloadActions command
49
-     *
50
-     * @param controller Command controller for the command
51
-     */
52
-    public ReloadActions(final CommandController controller) {
53
-        super(controller);
54
-    }
55
-
56 46
     /** {@inheritDoc} */
57 47
     @Override
58 48
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/ReloadIdentities.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.config.IdentityManager;
34
-import com.dmdirc.interfaces.CommandController;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 
37 36
 /**
@@ -44,15 +43,6 @@ public class ReloadIdentities extends Command implements IntelligentCommand {
44 43
             "reloadidentities - reloads user identities (configuration files)",
45 44
             CommandType.TYPE_GLOBAL);
46 45
 
47
-    /**
48
-     * Creates a new instance of the ReloadIdentities command
49
-     *
50
-     * @param controller Command controller for the command
51
-     */
52
-    public ReloadIdentities(final CommandController controller) {
53
-        super(controller);
54
-    }
55
-
56 46
     /** {@inheritDoc} */
57 47
     @Override
58 48
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/ReloadPlugin.java Voir le fichier

@@ -30,7 +30,6 @@ import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
-import com.dmdirc.interfaces.CommandController;
34 33
 import com.dmdirc.plugins.PluginInfo;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 
@@ -44,15 +43,6 @@ public class ReloadPlugin extends Command implements IntelligentCommand {
44 43
             "reloadplugin <plugin> - Reloads the specified plugin",
45 44
             CommandType.TYPE_GLOBAL);
46 45
 
47
-    /**
48
-     * Creates a new instance of the ReloadPlugin command
49
-     *
50
-     * @param controller Command controller for the command
51
-     */
52
-    public ReloadPlugin(final CommandController controller) {
53
-        super(controller);
54
-    }
55
-
56 46
     /** {@inheritDoc} */
57 47
     @Override
58 48
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/SaveConfig.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.config.IdentityManager;
34
-import com.dmdirc.interfaces.CommandController;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 
37 36
 /**
@@ -44,15 +43,6 @@ public final class SaveConfig extends Command implements IntelligentCommand {
44 43
             "saveconfig - force the client to save its configuration to disk",
45 44
             CommandType.TYPE_GLOBAL);
46 45
 
47
-    /**
48
-     * Creates a new instance of the SaveConfig command
49
-     *
50
-     * @param controller Command controller for the command
51
-     */
52
-    public SaveConfig(final CommandController controller) {
53
-        super(controller);
54
-    }
55
-
56 46
     /** {@inheritDoc} */
57 47
     @Override
58 48
     public void execute(final FrameContainer origin,

+ 2
- 5
src/com/dmdirc/commandparser/commands/global/Set.java Voir le fichier

@@ -38,7 +38,6 @@ import com.dmdirc.commandparser.commands.flags.CommandFlagResult;
38 38
 import com.dmdirc.config.ConfigManager;
39 39
 import com.dmdirc.config.Identity;
40 40
 import com.dmdirc.config.IdentityManager;
41
-import com.dmdirc.interfaces.CommandController;
42 41
 import com.dmdirc.ui.input.AdditionalTabTargets;
43 42
 
44 43
 import java.util.List;
@@ -68,11 +67,9 @@ public class Set extends Command implements IntelligentCommand {
68 67
 
69 68
     /**
70 69
      * Creates a new instance of Set.
71
-     *
72
-     * @param controller Command controller for this command
73 70
      */
74
-    public Set(final CommandController controller) {
75
-        super(controller);
71
+    public Set() {
72
+        super();
76 73
 
77 74
         unsetFlag.addDisabled(appendFlag);
78 75
         appendFlag.addDisabled(unsetFlag);

+ 0
- 10
src/com/dmdirc/commandparser/commands/global/UnloadPlugin.java Voir le fichier

@@ -30,7 +30,6 @@ import com.dmdirc.commandparser.CommandType;
30 30
 import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.IntelligentCommand;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33
-import com.dmdirc.interfaces.CommandController;
34 33
 import com.dmdirc.plugins.PluginInfo;
35 34
 import com.dmdirc.ui.input.AdditionalTabTargets;
36 35
 
@@ -44,15 +43,6 @@ public class UnloadPlugin extends Command implements IntelligentCommand {
44 43
             "unloadplugin <plugin> - Unloads the specified plugin",
45 44
             CommandType.TYPE_GLOBAL);
46 45
 
47
-    /**
48
-     * Creates a new instance of the UnloadPlugin command
49
-     *
50
-     * @param controller Command controller for the command
51
-     */
52
-    public UnloadPlugin(final CommandController controller) {
53
-        super(controller);
54
-    }
55
-
56 46
     /** {@inheritDoc} */
57 47
     @Override
58 48
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/AllChannels.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
-import com.dmdirc.interfaces.CommandController;
36 35
 import com.dmdirc.ui.input.AdditionalTabTargets;
37 36
 import com.dmdirc.ui.input.TabCompleter;
38 37
 
@@ -47,15 +46,6 @@ public class AllChannels extends Command implements IntelligentCommand {
47 46
            "allchannels <command> - executes the command as though it had"
48 47
             + " been entered on all channels", CommandType.TYPE_SERVER);
49 48
 
50
-    /**
51
-     * Creates a new instance of the AllChannels command
52
-     *
53
-     * @param controller Command controller for the command
54
-     */
55
-    public AllChannels(final CommandController controller) {
56
-        super(controller);
57
-    }
58
-
59 49
     /** {@inheritDoc} */
60 50
     @Override
61 51
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Away.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 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
-import com.dmdirc.interfaces.CommandController;
36 35
 
37 36
 /**
38 37
  * The away command allows the user to set their away message.
@@ -44,15 +43,6 @@ public class Away extends Command {
44 43
     public static final CommandInfo INFO = new BaseCommandInfo("away",
45 44
            "away <reason> - marks you as away", CommandType.TYPE_SERVER);
46 45
 
47
-    /**
48
-     * Creates a new instance of the Away command
49
-     *
50
-     * @param controller Command controller for the command
51
-     */
52
-    public Away(final CommandController controller) {
53
-        super(controller);
54
-    }
55
-
56 46
     /** {@inheritDoc} */
57 47
     @Override
58 48
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Back.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
38 37
 
39 38
 /**
@@ -46,15 +45,6 @@ public class Back extends Command implements IntelligentCommand {
46 45
     public static final CommandInfo INFO = new BaseCommandInfo("back",
47 46
            "back - unsets your away status", CommandType.TYPE_SERVER);
48 47
 
49
-    /**
50
-     * Creates a new instance of the Back command
51
-     *
52
-     * @param controller Command controller for the command
53
-     */
54
-    public Back(final CommandController controller) {
55
-        super(controller);
56
-    }
57
-
58 48
     /** {@inheritDoc} */
59 49
     @Override
60 50
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/ChangeServer.java Voir le fichier

@@ -32,7 +32,6 @@ 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
 import com.dmdirc.commandparser.commands.global.NewServer;
35
-import com.dmdirc.interfaces.CommandController;
36 35
 
37 36
 import java.net.URI;
38 37
 import java.net.URISyntaxException;
@@ -47,15 +46,6 @@ public class ChangeServer extends Command {
47 46
             "server <host[:[+]port]> [password] - connect to a different server",
48 47
             CommandType.TYPE_SERVER);
49 48
 
50
-    /**
51
-     * Creates a new instance of the ChangeServer command
52
-     *
53
-     * @param controller Command controller for the command
54
-     */
55
-    public ChangeServer(final CommandController controller) {
56
-        super(controller);
57
-    }
58
-
59 49
     /** {@inheritDoc} */
60 50
     @Override
61 51
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Ctcp.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
38 37
 import com.dmdirc.ui.input.TabCompletionType;
39 38
 
@@ -48,15 +47,6 @@ public class Ctcp extends Command implements IntelligentCommand {
48 47
             "ctcp <target> <type> [arguments] - sends a CTCP message",
49 48
             CommandType.TYPE_SERVER);
50 49
 
51
-    /**
52
-     * Creates a new instance of the Ctcp command
53
-     *
54
-     * @param controller Command controller for the command
55
-     */
56
-    public Ctcp(final CommandController controller) {
57
-        super(controller);
58
-    }
59
-
60 50
     /** {@inheritDoc} */
61 51
     @Override
62 52
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Disconnect.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.CommandType;
31 31
 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
-import com.dmdirc.interfaces.CommandController;
35 34
 
36 35
 /**
37 36
  * The disconnect command disconnects from the current server.
@@ -43,15 +42,6 @@ public class Disconnect extends Command {
43 42
             "disconnect [reason] - disconnect from this server",
44 43
             CommandType.TYPE_SERVER);
45 44
 
46
-    /**
47
-     * Creates a new instance of the Disconnect command
48
-     *
49
-     * @param controller Command controller for the command
50
-     */
51
-    public Disconnect(final CommandController controller) {
52
-        super(controller);
53
-    }
54
-
55 45
     /** {@inheritDoc} */
56 46
     @Override
57 47
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Ignore.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 import com.dmdirc.commandparser.commands.IntelligentCommand;
33 33
 import com.dmdirc.commandparser.commands.context.CommandContext;
34 34
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
35
-import com.dmdirc.interfaces.CommandController;
36 35
 import com.dmdirc.parser.common.IgnoreList;
37 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
38 37
 import com.dmdirc.ui.input.TabCompletionType;
@@ -51,15 +50,6 @@ public class Ignore extends Command implements IntelligentCommand {
51 50
             "ignore [--remove|--regex] [host] - manages the network's ignore list",
52 51
             CommandType.TYPE_SERVER);
53 52
 
54
-    /**
55
-     * Creates a new instance of the Ignore command
56
-     *
57
-     * @param controller Command controller for the command
58
-     */
59
-    public Ignore(final CommandController controller) {
60
-        super(controller);
61
-    }
62
-
63 53
     /** {@inheritDoc} */
64 54
     @Override
65 55
     public void execute(final FrameContainer origin,

+ 2
- 5
src/com/dmdirc/commandparser/commands/server/JoinChannelCommand.java Voir le fichier

@@ -35,7 +35,6 @@ import com.dmdirc.commandparser.commands.IntelligentCommand;
35 35
 import com.dmdirc.commandparser.commands.context.CommandContext;
36 36
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
37 37
 import com.dmdirc.interfaces.ActionListener;
38
-import com.dmdirc.interfaces.CommandController;
39 38
 import com.dmdirc.interfaces.actions.ActionType;
40 39
 import com.dmdirc.parser.common.ChannelJoinRequest;
41 40
 import com.dmdirc.ui.input.AdditionalTabTargets;
@@ -64,11 +63,9 @@ public class JoinChannelCommand extends Command implements
64 63
 
65 64
     /**
66 65
      * Creates a new instance of the join channel command.
67
-     *
68
-     * @param controller Command controller for the command
69 66
      */
70
-    public JoinChannelCommand(final CommandController controller) {
71
-        super(controller);
67
+    public JoinChannelCommand() {
68
+        super();
72 69
 
73 70
         ActionManager.getActionManager().registerListener(this,
74 71
                 CoreActionType.CLIENT_LINE_ADDED);

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Message.java Voir le fichier

@@ -35,7 +35,6 @@ import com.dmdirc.commandparser.commands.IntelligentCommand;
35 35
 import com.dmdirc.commandparser.commands.WrappableCommand;
36 36
 import com.dmdirc.commandparser.commands.context.CommandContext;
37 37
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
38
-import com.dmdirc.interfaces.CommandController;
39 38
 import com.dmdirc.parser.interfaces.Parser;
40 39
 import com.dmdirc.ui.input.AdditionalTabTargets;
41 40
 import com.dmdirc.ui.input.TabCompletionType;
@@ -52,15 +51,6 @@ public class Message extends Command implements IntelligentCommand,
52 51
             "msg <target> <message> - sends a private message",
53 52
             CommandType.TYPE_SERVER);
54 53
 
55
-    /**
56
-     * Creates a new instance of the Message command
57
-     *
58
-     * @param controller Command controller for the command
59
-     */
60
-    public Message(final CommandController controller) {
61
-        super(controller);
62
-    }
63
-
64 54
     /** {@inheritDoc} */
65 55
     @Override
66 56
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Nick.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
38 37
 import com.dmdirc.ui.input.TabCompletionType;
39 38
 
@@ -48,15 +47,6 @@ public class Nick extends Command implements IntelligentCommand {
48 47
             "nick <new nickname> - attempts to change your nickname to the one specified",
49 48
             CommandType.TYPE_SERVER);
50 49
 
51
-    /**
52
-     * Creates a new instance of the Nick command
53
-     *
54
-     * @param controller Command controller for the command
55
-     */
56
-    public Nick(final CommandController controller) {
57
-        super(controller);
58
-    }
59
-
60 50
     /** {@inheritDoc} */
61 51
     @Override
62 52
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Notice.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.CommandOptions;
33 33
 import com.dmdirc.commandparser.commands.IntelligentCommand;
34 34
 import com.dmdirc.commandparser.commands.context.CommandContext;
35 35
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
36
-import com.dmdirc.interfaces.CommandController;
37 36
 import com.dmdirc.ui.input.AdditionalTabTargets;
38 37
 import com.dmdirc.ui.input.TabCompletionType;
39 38
 
@@ -48,15 +47,6 @@ public class Notice extends Command implements IntelligentCommand {
48 47
             "notice <target> <message> - sends a notice",
49 48
             CommandType.TYPE_SERVER);
50 49
 
51
-    /**
52
-     * Creates a new instance of the Notice command
53
-     *
54
-     * @param controller Command controller for the command
55
-     */
56
-    public Notice(final CommandController controller) {
57
-        super(controller);
58
-    }
59
-
60 50
     /** {@inheritDoc} */
61 51
     @Override
62 52
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/OpenQuery.java Voir le fichier

@@ -35,7 +35,6 @@ import com.dmdirc.commandparser.commands.IntelligentCommand;
35 35
 import com.dmdirc.commandparser.commands.WrappableCommand;
36 36
 import com.dmdirc.commandparser.commands.context.CommandContext;
37 37
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
38
-import com.dmdirc.interfaces.CommandController;
39 38
 import com.dmdirc.ui.input.AdditionalTabTargets;
40 39
 import com.dmdirc.ui.input.TabCompletionType;
41 40
 import com.dmdirc.ui.messages.Styliser;
@@ -51,15 +50,6 @@ public class OpenQuery extends Command implements IntelligentCommand,
51 50
             "query <user> [message] - opens a query with the specified user",
52 51
             CommandType.TYPE_SERVER);
53 52
 
54
-    /**
55
-     * Creates a new instance of the OpenQuery command
56
-     *
57
-     * @param controller Command controller for the command
58
-     */
59
-    public OpenQuery(final CommandController controller) {
60
-        super(controller);
61
-    }
62
-
63 53
     /** {@inheritDoc} */
64 54
     @Override
65 55
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Raw.java Voir le fichier

@@ -32,7 +32,6 @@ import com.dmdirc.commandparser.commands.Command;
32 32
 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
-import com.dmdirc.interfaces.CommandController;
36 35
 
37 36
 /**
38 37
  * The raw command allows the user to send a raw line of text directly to the
@@ -46,15 +45,6 @@ public class Raw extends Command {
46 45
             "raw <text> - sends the specified text directly to the server",
47 46
             CommandType.TYPE_SERVER);
48 47
 
49
-    /**
50
-     * Creates a new instance of the Raw command
51
-     *
52
-     * @param controller Command controller for the command
53
-     */
54
-    public Raw(final CommandController controller) {
55
-        super(controller);
56
-    }
57
-
58 48
     /** {@inheritDoc} */
59 49
     @Override
60 50
     public void execute(final FrameContainer origin,

+ 2
- 4
src/com/dmdirc/commandparser/commands/server/RawServerCommand.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.commands.Command;
31 31
 import com.dmdirc.commandparser.commands.CommandOptions;
32 32
 import com.dmdirc.commandparser.commands.context.CommandContext;
33 33
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
34
-import com.dmdirc.interfaces.CommandController;
35 34
 
36 35
 /**
37 36
  * Implements a raw server command (i.e., a command that is sent to the server
@@ -46,11 +45,10 @@ public class RawServerCommand extends Command implements CommandInfo {
46 45
     /**
47 46
      * Creates a new instance of RawServerCommand.
48 47
      *
49
-     * @param controller Command controller for the command
50 48
      * @param command The command name for this raw command
51 49
      */
52
-    public RawServerCommand(final CommandController controller, final String command) {
53
-        super(controller);
50
+    public RawServerCommand(final String command) {
51
+        super();
54 52
 
55 53
         myName = command;
56 54
     }

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Reconnect.java Voir le fichier

@@ -31,7 +31,6 @@ import com.dmdirc.commandparser.CommandType;
31 31
 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
-import com.dmdirc.interfaces.CommandController;
35 34
 
36 35
 /**
37 36
  * The reconnect command reconnects to the current server.
@@ -43,15 +42,6 @@ public class Reconnect extends Command {
43 42
             "reconnect [reason] - reconnect to this server",
44 43
             CommandType.TYPE_SERVER);
45 44
 
46
-    /**
47
-     * Creates a new instance of the Reconnect command
48
-     *
49
-     * @param controller Command controller for the command
50
-     */
51
-    public Reconnect(final CommandController controller) {
52
-        super(controller);
53
-    }
54
-
55 45
     /** {@inheritDoc} */
56 46
     @Override
57 47
     public void execute(final FrameContainer origin,

+ 0
- 10
src/com/dmdirc/commandparser/commands/server/Umode.java Voir le fichier

@@ -33,7 +33,6 @@ import com.dmdirc.commandparser.commands.Command;
33 33
 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
-import com.dmdirc.interfaces.CommandController;
37 36
 
38 37
 /**
39 38
  * Allows the user to change user modes.
@@ -46,15 +45,6 @@ public class Umode extends Command {
46 45
             "umode [modes] - sets or displays your user modes",
47 46
             CommandType.TYPE_SERVER);
48 47
 
49
-    /**
50
-     * Creates a new instance of the Umode command
51
-     *
52
-     * @param controller Command controller for the command
53
-     */
54
-    public Umode(final CommandController controller) {
55
-        super(controller);
56
-    }
57
-
58 48
     /** {@inheritDoc} */
59 49
     @Override
60 50
     public void execute(final FrameContainer origin,

+ 1
- 1
src/com/dmdirc/commandparser/parsers/CommandParser.java Voir le fichier

@@ -204,7 +204,7 @@ public abstract class CommandParser implements Serializable {
204 204
                     if (actCommand != null && actCommand.getValue() instanceof ExternalCommand) {
205 205
                         ((ExternalCommand) actCommand.getValue()).execute(
206 206
                                 origin, server, channel, silent,
207
-                                new CommandArguments(commandManager, args.getCommandName()
207
+                                new CommandArguments(args.getCommandName()
208 208
                                 + " " + args.getWordsAsString(2)));
209 209
                     }
210 210
                 }

+ 2
- 7
src/com/dmdirc/ui/core/util/URLHandler.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.ui.core.util;
24 24
 
25
-import com.dmdirc.ServerManager;
26 25
 import com.dmdirc.config.ConfigManager;
27 26
 import com.dmdirc.config.IdentityManager;
28 27
 import com.dmdirc.interfaces.ui.UIController;
@@ -46,8 +45,6 @@ public class URLHandler {
46 45
     private static Date lastLaunch;
47 46
     /** The UI Controller that owns this handler. */
48 47
     private final UIController controller;
49
-    /** Server manager used to create servers. */
50
-    private final ServerManager serverManager;
51 48
     /** Config manager. */
52 49
     private final ConfigManager config;
53 50
     /** Desktop handler. */
@@ -57,11 +54,9 @@ public class URLHandler {
57 54
      * Instantiates a new URL Handler.
58 55
      *
59 56
      * @param controller The UI controller to show dialogs etc on
60
-     * @param serverManager Server manager used to create servers
61 57
      */
62
-    public URLHandler(final UIController controller, final ServerManager serverManager) {
58
+    public URLHandler(final UIController controller) {
63 59
         this.controller = controller;
64
-        this.serverManager = serverManager;
65 60
         this.config = IdentityManager.getIdentityManager().getGlobalConfiguration();
66 61
         this.desktop = Desktop.isDesktopSupported() ? Desktop.getDesktop() : null;
67 62
     }
@@ -160,7 +155,7 @@ public class URLHandler {
160 155
             StatusBarManager.getStatusBarManager().setMessage(
161 156
                     new StatusMessage("Connecting to: " + uri.toString(),
162 157
                     config));
163
-            serverManager.connectToAddress(uri);
158
+            controller.getMain().getServerManager().connectToAddress(uri);
164 159
         } else if ("BROWSER".equals(command)) {
165 160
             StatusBarManager.getStatusBarManager().setMessage(
166 161
                     new StatusMessage("Opening: " + uri.toString(),

+ 7
- 9
src/com/dmdirc/ui/input/InputHandler.java Voir le fichier

@@ -35,8 +35,8 @@ import com.dmdirc.commandparser.parsers.CommandParser;
35 35
 import com.dmdirc.interfaces.ConfigChangeListener;
36 36
 import com.dmdirc.interfaces.ui.InputField;
37 37
 import com.dmdirc.interfaces.ui.InputValidationListener;
38
+import com.dmdirc.interfaces.ui.UIController;
38 39
 import com.dmdirc.parser.common.CompositionState;
39
-import com.dmdirc.plugins.PluginManager;
40 40
 import com.dmdirc.ui.input.tabstyles.TabCompletionResult;
41 41
 import com.dmdirc.ui.input.tabstyles.TabCompletionStyle;
42 42
 import com.dmdirc.ui.messages.Styliser;
@@ -110,8 +110,8 @@ public abstract class InputHandler implements ConfigChangeListener {
110 110
     private CompositionState state = CompositionState.IDLE;
111 111
     /** Timer used to manage timeouts of composition state. */
112 112
     private Timer compositionTimer;
113
-    /** Plugin managed used to retrieve tab completers. */
114
-    private final PluginManager pluginManager;
113
+    /** UIController that owns this InputHandler. */
114
+    private final UIController controller;
115 115
 
116 116
     /**
117 117
      * Creates a new instance of InputHandler. Adds listeners to the target
@@ -120,14 +120,12 @@ public abstract class InputHandler implements ConfigChangeListener {
120 120
      * @param thisTarget The text field this input handler is dealing with.
121 121
      * @param thisCommandParser The command parser to use for this text field.
122 122
      * @param thisParentWindow The window that owns this input handler
123
-     * @param pluginManager pluginManager used to retrieve tab completers
124 123
      */
125
-    public InputHandler(final InputField thisTarget,
124
+    public InputHandler(final UIController controller, final InputField thisTarget,
126 125
             final CommandParser thisCommandParser,
127
-            final WritableFrameContainer thisParentWindow,
128
-            final PluginManager pluginManager) {
126
+            final WritableFrameContainer thisParentWindow) {
129 127
 
130
-        this.pluginManager = pluginManager;
128
+        this.controller = controller;
131 129
         buffer = new RollingList<String>(thisParentWindow.getConfigManager()
132 130
                 .getOptionInt("ui", "inputbuffersize"), "");
133 131
 
@@ -193,7 +191,7 @@ public abstract class InputHandler implements ConfigChangeListener {
193 191
      * Sets this inputhandler's tab completion style.
194 192
      */
195 193
     private void setStyle() {
196
-        style = (TabCompletionStyle) pluginManager
194
+        style = (TabCompletionStyle) controller.getMain().getPluginManager()
197 195
                 .getServiceProvider("tabcompletion", parentWindow
198 196
                 .getConfigManager().getOption("tabcompletion", "style"))
199 197
                 .getExportedService("getCompletionStyle").execute(tabCompleter,

+ 3
- 4
test/com/dmdirc/ServerTest.java Voir le fichier

@@ -22,15 +22,16 @@
22 22
 
23 23
 package com.dmdirc;
24 24
 
25
+import com.dmdirc.commandparser.CommandManager;
25 26
 import com.dmdirc.config.IdentityManager;
26 27
 
28
+import com.dmdirc.plugins.PluginManager;
27 29
 import java.net.URI;
28 30
 
29 31
 import org.junit.BeforeClass;
30 32
 import org.junit.Test;
31 33
 
32 34
 import static org.junit.Assert.*;
33
-import static org.mockito.Mockito.*;
34 35
 
35 36
 public class ServerTest {
36 37
 
@@ -39,9 +40,7 @@ public class ServerTest {
39 40
     @BeforeClass
40 41
     public static void setUp() throws Exception {
41 42
         TestMain.getTestMain();
42
-        server = new Server(mock(ParserFactory.class),
43
-                mock(ServerManager.class),
44
-                new URI("irc-test://255.255.255.255"),
43
+        server = new Server(TestMain.getTestMain().getServerManager(), new URI("irc-test://255.255.255.255"),
45 44
                 IdentityManager.getIdentityManager()
46 45
                 .getIdentitiesByType("profile").get(0));
47 46
     }

+ 1
- 1
test/com/dmdirc/TestMain.java Voir le fichier

@@ -28,10 +28,10 @@ public class TestMain extends Main {
28 28
             // DON'T do anything to the user's configuration... (so no calls
29 29
             // to handleInvalidConfigFile(); here)
30 30
         }
31
+        serverManager = new ServerManager(this);
31 32
         ActionManager.initActionManager(this, serverManager, IdentityManager.getIdentityManager());
32 33
         pluginManager = new PluginManager(IdentityManager.getIdentityManager(), this);
33 34
         pluginManager.refreshPlugins();
34
-        serverManager = new ServerManager(new ParserFactory(pluginManager));
35 35
         CommandManager.initCommandManager(IdentityManager.getIdentityManager(), this);
36 36
 
37 37
         ActionManager.getActionManager().initialise();

+ 1
- 3
test/com/dmdirc/commandparser/commands/HelpTest.java Voir le fichier

@@ -27,7 +27,6 @@ import com.dmdirc.commandparser.CommandLoader;
27 27
 import com.dmdirc.commandparser.CommandManager;
28 28
 import com.dmdirc.commandparser.CommandType;
29 29
 import com.dmdirc.config.InvalidIdentityFileException;
30
-import com.dmdirc.interfaces.ServerFactory;
31 30
 
32 31
 import java.util.LinkedList;
33 32
 import java.util.List;
@@ -37,7 +36,6 @@ import org.junit.runner.RunWith;
37 36
 import org.junit.runners.Parameterized;
38 37
 
39 38
 import static org.junit.Assert.*;
40
-import static org.mockito.Mockito.*;
41 39
 
42 40
 @RunWith(Parameterized.class)
43 41
 public class HelpTest {
@@ -59,7 +57,7 @@ public class HelpTest {
59 57
         final List<Object[]> res = new LinkedList<Object[]>();
60 58
 
61 59
         TestMain.getTestMain();
62
-        new CommandLoader(mock(ServerFactory.class)).loadCommands(CommandManager.getCommandManager());
60
+        new CommandLoader().loadCommands(CommandManager.getCommandManager());
63 61
 
64 62
         for (CommandType type : CommandType.values()) {
65 63
             for (CommandInfo command : CommandManager.getCommandManager().getCommands(type).keySet()) {

+ 13
- 20
test/com/dmdirc/commandparser/commands/channel/BanTest.java Voir le fichier

@@ -19,48 +19,43 @@
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
21 21
  */
22
+
22 23
 package com.dmdirc.commandparser.commands.channel;
23 24
 
24 25
 import com.dmdirc.Channel;
25 26
 import com.dmdirc.FrameContainer;
27
+import com.dmdirc.TestMain;
26 28
 import com.dmdirc.commandparser.CommandArguments;
27 29
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
28
-import com.dmdirc.interfaces.CommandController;
29 30
 import com.dmdirc.parser.interfaces.ChannelClientInfo;
30 31
 import com.dmdirc.parser.interfaces.ChannelInfo;
31 32
 import com.dmdirc.parser.interfaces.ClientInfo;
32 33
 
33
-import org.junit.Before;
34
+import org.junit.BeforeClass;
34 35
 import org.junit.Test;
35 36
 
36 37
 import static org.mockito.Mockito.*;
37 38
 
38 39
 public class BanTest {
39 40
 
40
-    private CommandController controller;
41
-    private Ban command;
42
-
43
-    @Before
44
-    public void setUp() throws Exception {
45
-        controller = mock(CommandController.class);
46
-        when(controller.getCommandChar()).thenReturn('/');
47
-        when(controller.getSilenceChar()).thenReturn('.');
48
-        command = new Ban(controller);
41
+    @BeforeClass
42
+    public static void setUpClass() throws Exception {
43
+        TestMain.getTestMain();
49 44
     }
50 45
 
46
+    private final Ban command = new Ban();
47
+
51 48
     @Test
52 49
     public void testUsage() {
53 50
         final FrameContainer tiw = mock(FrameContainer.class);
54 51
         final Channel channel = mock(Channel.class);
55
-        command.execute(tiw, new CommandArguments(controller, "/ban"),
52
+        command.execute(tiw, new CommandArguments("/ban"),
56 53
                 new ChannelCommandContext(null, Ban.INFO, channel));
57 54
 
58 55
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
59 56
     }
60 57
 
61
-    /**
62
-     * Tests that the ban command uses the correct hostname if given a user.
63
-     */
58
+    /** Tests that the ban command uses the correct hostname if given a user. */
64 59
     @Test
65 60
     public void testKnownUser() {
66 61
         final FrameContainer container = mock(FrameContainer.class);
@@ -74,16 +69,14 @@ public class BanTest {
74 69
         when(ccInfo.getClient()).thenReturn(clientInfo);
75 70
         when(clientInfo.getHostname()).thenReturn("my.host.name");
76 71
 
77
-        command.execute(container, new CommandArguments(controller, "/ban user"),
72
+        command.execute(container, new CommandArguments("/ban user"),
78 73
                 new ChannelCommandContext(null, Ban.INFO, channel));
79 74
 
80 75
         verify(channelInfo).alterMode(true, 'b', "*!*@my.host.name");
81 76
         verify(channelInfo).flushModes();
82 77
     }
83 78
 
84
-    /**
85
-     * Tests that the ban command works if given a mask not a username.
86
-     */
79
+    /** Tests that the ban command works if given a mask not a username. */
87 80
     @Test
88 81
     public void testHostmask() {
89 82
         final FrameContainer container = mock(FrameContainer.class);
@@ -92,7 +85,7 @@ public class BanTest {
92 85
 
93 86
         when(channel.getChannelInfo()).thenReturn(channelInfo);
94 87
 
95
-        command.execute(container, new CommandArguments(controller, "/ban *!*@my.host.name"),
88
+        command.execute(container, new CommandArguments("/ban *!*@my.host.name"),
96 89
                 new ChannelCommandContext(null, Ban.INFO, channel));
97 90
 
98 91
         verify(channelInfo).alterMode(true, 'b', "*!*@my.host.name");

+ 11
- 14
test/com/dmdirc/commandparser/commands/channel/KickReasonTest.java Voir le fichier

@@ -22,37 +22,34 @@
22 22
 
23 23
 package com.dmdirc.commandparser.commands.channel;
24 24
 
25
+import com.dmdirc.TestMain;
25 26
 import com.dmdirc.Channel;
26 27
 import com.dmdirc.FrameContainer;
27 28
 import com.dmdirc.commandparser.CommandArguments;
28 29
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
29 30
 import com.dmdirc.config.ConfigManager;
30
-import com.dmdirc.interfaces.CommandController;
31 31
 import com.dmdirc.parser.irc.IRCChannelClientInfo;
32 32
 import com.dmdirc.parser.irc.IRCChannelInfo;
33 33
 
34
-import org.junit.Before;
34
+import org.junit.BeforeClass;
35 35
 import org.junit.Test;
36 36
 
37 37
 import static org.mockito.Mockito.*;
38 38
 
39 39
 public class KickReasonTest {
40 40
 
41
-    private CommandController controller;
42
-    private KickReason command;
43
-
44
-    @Before
45
-    public void setUp() throws Exception {
46
-        controller = mock(CommandController.class);
47
-        when(controller.getCommandChar()).thenReturn('/');
48
-        command = new KickReason(controller);
41
+    @BeforeClass
42
+    public static void setUpClass() throws Exception {
43
+        TestMain.getTestMain();
49 44
     }
50 45
 
46
+    private final KickReason command = new KickReason();
47
+
51 48
     @Test
52 49
     public void testUsage() {
53 50
         final FrameContainer tiw = mock(FrameContainer.class);
54 51
         final Channel channel = mock(Channel.class);
55
-        command.execute(tiw, new CommandArguments(controller, "/kick"),
52
+        command.execute(tiw, new CommandArguments("/kick"),
56 53
                 new ChannelCommandContext(null, KickReason.INFO, channel));
57 54
 
58 55
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -67,7 +64,7 @@ public class KickReasonTest {
67 64
         when(channel.getChannelInfo()).thenReturn(channelInfo);
68 65
         when(channelInfo.getChannelClient(anyString())).thenReturn(null);
69 66
 
70
-        command.execute(tiw, new CommandArguments(controller, "/kick user1"),
67
+        command.execute(tiw, new CommandArguments("/kick user1"),
71 68
                 new ChannelCommandContext(null, KickReason.INFO, channel));
72 69
 
73 70
         verify(tiw).addLine(eq("commandError"), matches(".*user1"));
@@ -83,7 +80,7 @@ public class KickReasonTest {
83 80
         when(channel.getChannelInfo()).thenReturn(channelInfo);
84 81
         when(channelInfo.getChannelClient("user1")).thenReturn(cci);
85 82
 
86
-        command.execute(tiw, new CommandArguments(controller, "/kick user1 reason here"),
83
+        command.execute(tiw, new CommandArguments("/kick user1 reason here"),
87 84
                 new ChannelCommandContext(null, KickReason.INFO, channel));
88 85
 
89 86
         verify(cci).kick("reason here");
@@ -102,7 +99,7 @@ public class KickReasonTest {
102 99
         when(channelInfo.getChannelClient("user1")).thenReturn(cci);
103 100
         when(manager.getOption("general", "kickmessage")).thenReturn("reason here");
104 101
 
105
-        command.execute(tiw, new CommandArguments(controller, "/kick user1"),
102
+        command.execute(tiw, new CommandArguments("/kick user1"),
106 103
                 new ChannelCommandContext(null, KickReason.INFO, channel));
107 104
 
108 105
         verify(cci).kick("reason here");

+ 8
- 9
test/com/dmdirc/commandparser/commands/channel/ModeTest.java Voir le fichier

@@ -25,10 +25,10 @@ package com.dmdirc.commandparser.commands.channel;
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.FrameContainer;
27 27
 import com.dmdirc.Server;
28
+import com.dmdirc.TestMain;
28 29
 import com.dmdirc.commandparser.CommandArguments;
29 30
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
30 31
 import com.dmdirc.config.InvalidIdentityFileException;
31
-import com.dmdirc.interfaces.CommandController;
32 32
 import com.dmdirc.parser.irc.IRCChannelInfo;
33 33
 import com.dmdirc.parser.irc.IRCParser;
34 34
 
@@ -39,7 +39,6 @@ import static org.mockito.Mockito.*;
39 39
 
40 40
 public class ModeTest {
41 41
 
42
-    private CommandController controller;
43 42
     private Mode command;
44 43
     private IRCChannelInfo channelinfo;
45 44
     private Channel channel;
@@ -48,27 +47,27 @@ public class ModeTest {
48 47
 
49 48
     @Before
50 49
     public void setUp() throws InvalidIdentityFileException {
51
-        controller = mock(CommandController.class);
50
+        TestMain.getTestMain();
51
+
52 52
         parser = mock(IRCParser.class);
53 53
         server = mock(Server.class);
54 54
         channel = mock(Channel.class);
55 55
         channelinfo = mock(IRCChannelInfo.class);
56 56
 
57
-        when(controller.getCommandChar()).thenReturn('/');
58 57
         when(channel.getServer()).thenReturn(server);
59 58
         when(server.getParser()).thenReturn(parser);
60 59
         when(channel.getChannelInfo()).thenReturn(channelinfo);
61 60
         when(channelinfo.getModes()).thenReturn("my mode string!");
62 61
         when(channelinfo.toString()).thenReturn("#chan");
63 62
 
64
-        command = new Mode(controller);
63
+        command = new Mode();
65 64
     }
66 65
 
67 66
     @Test
68 67
     public void testWithoutArgs() {
69 68
         final FrameContainer origin = mock(FrameContainer.class);
70 69
 
71
-        command.execute(origin, new CommandArguments(controller, "/mode"),
70
+        command.execute(origin, new CommandArguments("/mode"),
72 71
                 new ChannelCommandContext(null, Mode.INFO, channel));
73 72
 
74 73
         verify(origin).addLine("channelModeDiscovered", "my mode string!", channelinfo);
@@ -78,7 +77,7 @@ public class ModeTest {
78 77
     public void testWithArgs() {
79 78
         final FrameContainer origin = mock(FrameContainer.class);
80 79
 
81
-        command.execute(origin, new CommandArguments(controller, "/mode +hello -bye"),
80
+        command.execute(origin, new CommandArguments("/mode +hello -bye"),
82 81
                 new ChannelCommandContext(null, Mode.INFO, channel));
83 82
 
84 83
         verify(parser).sendRawMessage("MODE #chan +hello -bye");
@@ -88,7 +87,7 @@ public class ModeTest {
88 87
     public void testExternalWithArgs() {
89 88
         final FrameContainer origin = mock(FrameContainer.class);
90 89
 
91
-        command.execute(origin, new CommandArguments(controller, "/mode +hello -bye"),
90
+        command.execute(origin, new CommandArguments("/mode +hello -bye"),
92 91
                 new ChannelCommandContext(null, Mode.INFO, channel));
93 92
 
94 93
         verify(parser).sendRawMessage("MODE #chan +hello -bye");
@@ -99,7 +98,7 @@ public class ModeTest {
99 98
         final FrameContainer origin = mock(FrameContainer.class);
100 99
 
101 100
         command.execute(origin, server, "#chan", false,
102
-                new CommandArguments(controller, "/mode"));
101
+                new CommandArguments("/mode"));
103 102
 
104 103
         verify(parser).sendRawMessage("MODE #chan");
105 104
     }

+ 6
- 7
test/com/dmdirc/commandparser/commands/channel/NamesTest.java Voir le fichier

@@ -24,10 +24,10 @@ package com.dmdirc.commandparser.commands.channel;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.Server;
27
+import com.dmdirc.TestMain;
27 28
 import com.dmdirc.commandparser.CommandArguments;
28 29
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
29 30
 import com.dmdirc.config.InvalidIdentityFileException;
30
-import com.dmdirc.interfaces.CommandController;
31 31
 import com.dmdirc.parser.irc.IRCChannelInfo;
32 32
 import com.dmdirc.parser.irc.IRCParser;
33 33
 
@@ -38,7 +38,6 @@ import static org.mockito.Mockito.*;
38 38
 
39 39
 public class NamesTest {
40 40
 
41
-    private CommandController controller;
42 41
     private Names command;
43 42
     private IRCChannelInfo channelinfo;
44 43
     private Channel channel;
@@ -47,24 +46,24 @@ public class NamesTest {
47 46
 
48 47
     @Before
49 48
     public void setUp() throws InvalidIdentityFileException {
50
-        controller = mock(CommandController.class);
49
+        TestMain.getTestMain();
50
+
51 51
         parser = mock(IRCParser.class);
52 52
         server = mock(Server.class);
53 53
         channel = mock(Channel.class);
54 54
         channelinfo = mock(IRCChannelInfo.class);
55 55
 
56
-        when(controller.getCommandChar()).thenReturn('/');
57 56
         when(channel.getServer()).thenReturn(server);
58 57
         when(server.getParser()).thenReturn(parser);
59 58
         when(channel.getChannelInfo()).thenReturn(channelinfo);
60 59
         when(channelinfo.getName()).thenReturn("#chan");
61 60
 
62
-        command = new Names(controller);
61
+        command = new Names();
63 62
     }
64 63
 
65 64
     @Test
66 65
     public void testNormal() {
67
-        command.execute(null, new CommandArguments(controller, "/names"),
66
+        command.execute(null, new CommandArguments("/names"),
68 67
                 new ChannelCommandContext(null, Names.INFO, channel));
69 68
 
70 69
         verify(parser).sendRawMessage("NAMES #chan");
@@ -72,7 +71,7 @@ public class NamesTest {
72 71
 
73 72
     @Test
74 73
     public void testExternal() {
75
-        command.execute(null, server, "#chan", false, new CommandArguments(controller, "/names #chan"));
74
+        command.execute(null, server, "#chan", false, new CommandArguments("/names #chan"));
76 75
 
77 76
         verify(parser).sendRawMessage("NAMES #chan");
78 77
     }

+ 6
- 7
test/com/dmdirc/commandparser/commands/channel/PartTest.java Voir le fichier

@@ -22,13 +22,13 @@
22 22
 
23 23
 package com.dmdirc.commandparser.commands.channel;
24 24
 
25
+import com.dmdirc.TestMain;
25 26
 import com.dmdirc.Channel;
26 27
 import com.dmdirc.FrameContainer;
27 28
 import com.dmdirc.commandparser.CommandArguments;
28 29
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
29 30
 import com.dmdirc.config.ConfigManager;
30 31
 import com.dmdirc.config.InvalidIdentityFileException;
31
-import com.dmdirc.interfaces.CommandController;
32 32
 
33 33
 import org.junit.Before;
34 34
 import org.junit.Test;
@@ -37,7 +37,6 @@ import static org.mockito.Mockito.*;
37 37
 
38 38
 public class PartTest {
39 39
 
40
-    private CommandController controller;
41 40
     private Part command;
42 41
     private Channel channel;
43 42
     private FrameContainer origin;
@@ -45,21 +44,21 @@ public class PartTest {
45 44
 
46 45
     @Before
47 46
     public void setUp() throws InvalidIdentityFileException {
48
-        controller = mock(CommandController.class);
47
+        TestMain.getTestMain();
48
+
49 49
         channel = mock(Channel.class);
50 50
         origin = mock(FrameContainer.class);
51 51
         manager = mock(ConfigManager.class);
52 52
 
53
-        when(controller.getCommandChar()).thenReturn('/');
54 53
         when(origin.getConfigManager()).thenReturn(manager);
55 54
         when(manager.getOption("general", "partmessage")).thenReturn("config part message");
56 55
 
57
-        command = new Part(controller);
56
+        command = new Part();
58 57
     }
59 58
 
60 59
     @Test
61 60
     public void testWithoutArgs() {
62
-        command.execute(origin, new CommandArguments(controller, "/part"),
61
+        command.execute(origin, new CommandArguments("/part"),
63 62
                 new ChannelCommandContext(null, Part.INFO, channel));
64 63
 
65 64
         verify(channel).part("config part message");
@@ -68,7 +67,7 @@ public class PartTest {
68 67
 
69 68
     @Test
70 69
     public void testWithArgs() {
71
-        command.execute(origin, new CommandArguments(controller, "/part custom part"),
70
+        command.execute(origin, new CommandArguments("/part custom part"),
72 71
                 new ChannelCommandContext(null, Part.INFO, channel));
73 72
 
74 73
         verify(channel).part("custom part");

+ 12
- 9
test/com/dmdirc/commandparser/commands/channel/SetNickColourTest.java Voir le fichier

@@ -21,35 +21,38 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.channel;
23 23
 
24
+import com.dmdirc.TestMain;
24 25
 import com.dmdirc.Channel;
25 26
 import com.dmdirc.FrameContainer;
26 27
 import com.dmdirc.commandparser.CommandArguments;
27 28
 import com.dmdirc.commandparser.commands.context.ChannelCommandContext;
28
-import com.dmdirc.interfaces.CommandController;
29 29
 
30 30
 import org.junit.Before;
31
+import org.junit.BeforeClass;
31 32
 import org.junit.Test;
32 33
 
33 34
 import static org.mockito.Mockito.*;
34 35
 
35 36
 public class SetNickColourTest {
36 37
 
37
-    private CommandController controller;
38 38
     private Channel channel;
39
-    private SetNickColour command;
39
+
40
+    @BeforeClass
41
+    public static void setUpClass() throws Exception {
42
+        TestMain.getTestMain();
43
+    }
40 44
 
41 45
     @Before
42 46
     public void setUp() {
43
-        controller = mock(CommandController.class);
44
-        when(controller.getCommandChar()).thenReturn('/');
45 47
         channel = mock(Channel.class);
46
-        command = new SetNickColour(controller);
47 48
     }
48 49
 
50
+    private final SetNickColour command = new SetNickColour();
51
+
49 52
     @Test
50 53
     public void testUsageNoArgs() {
51 54
         final FrameContainer tiw = mock(FrameContainer.class);
52
-        command.execute(tiw, new CommandArguments(controller, "/foo"),
55
+        command.execute(tiw, new CommandArguments("/foo"),
53 56
                 new ChannelCommandContext(null, SetNickColour.INFO, channel));
54 57
 
55 58
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -58,7 +61,7 @@ public class SetNickColourTest {
58 61
     @Test
59 62
     public void testUsageNicklist() {
60 63
         final FrameContainer tiw = mock(FrameContainer.class);
61
-        command.execute(tiw, new CommandArguments(controller, "/foo --nicklist"),
64
+        command.execute(tiw, new CommandArguments("/foo --nicklist"),
62 65
                 new ChannelCommandContext(null, SetNickColour.INFO, channel));
63 66
 
64 67
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -67,7 +70,7 @@ public class SetNickColourTest {
67 70
     @Test
68 71
     public void testUsageText() {
69 72
         final FrameContainer tiw = mock(FrameContainer.class);
70
-        command.execute(tiw, new CommandArguments(controller, "/foo --text"),
73
+        command.execute(tiw, new CommandArguments("/foo --text"),
71 74
                 new ChannelCommandContext(null, SetNickColour.INFO, channel));
72 75
 
73 76
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());

+ 10
- 8
test/com/dmdirc/commandparser/commands/chat/MeTest.java Voir le fichier

@@ -21,35 +21,37 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.chat;
23 23
 
24
+import com.dmdirc.TestMain;
24 25
 import com.dmdirc.FrameContainer;
25 26
 import com.dmdirc.MessageTarget;
26 27
 import com.dmdirc.commandparser.CommandArguments;
27 28
 import com.dmdirc.commandparser.commands.context.ChatCommandContext;
28
-import com.dmdirc.interfaces.CommandController;
29 29
 
30 30
 import org.junit.Before;
31
+import org.junit.BeforeClass;
31 32
 import org.junit.Test;
32 33
 
33 34
 import static org.mockito.Mockito.*;
34 35
 
35 36
 public class MeTest {
36 37
 
37
-    private CommandController controller;
38
-    private Me command;
38
+    private final Me command = new Me();
39 39
     private MessageTarget mtt;
40 40
 
41
+    @BeforeClass
42
+    public static void setUpClass() throws Exception {
43
+        TestMain.getTestMain();
44
+    }
45
+
41 46
     @Before
42 47
     public void setUp() {
43
-        controller = mock(CommandController.class);
44
-        when(controller.getCommandChar()).thenReturn('/');
45 48
         mtt = mock(MessageTarget.class);
46
-        command = new Me(controller);
47 49
     }
48 50
 
49 51
     @Test
50 52
     public void testUsage() {
51 53
         final FrameContainer tiw = mock(FrameContainer.class);
52
-        command.execute(tiw, new CommandArguments(controller, "/foo"),
54
+        command.execute(tiw, new CommandArguments("/foo"),
53 55
                 new ChatCommandContext(null, Me.INFO, mtt));
54 56
 
55 57
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -57,7 +59,7 @@ public class MeTest {
57 59
 
58 60
     @Test
59 61
     public void testSend() {
60
-        command.execute(null, new CommandArguments(controller, "/foo hello meep moop"),
62
+        command.execute(null, new CommandArguments("/foo hello meep moop"),
61 63
                 new ChatCommandContext(null, Me.INFO, mtt));
62 64
 
63 65
         verify(mtt).sendAction("hello meep moop");

+ 8
- 11
test/com/dmdirc/commandparser/commands/global/AliasCommandTest.java Voir le fichier

@@ -21,33 +21,30 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.global;
23 23
 
24
+import com.dmdirc.TestMain;
24 25
 import com.dmdirc.FrameContainer;
25 26
 import com.dmdirc.commandparser.CommandArguments;
26 27
 import com.dmdirc.commandparser.commands.context.CommandContext;
27
-import com.dmdirc.interfaces.CommandController;
28 28
 
29
-import org.junit.Before;
29
+import org.junit.BeforeClass;
30 30
 import org.junit.Test;
31 31
 
32 32
 import static org.mockito.Mockito.*;
33 33
 
34 34
 public class AliasCommandTest {
35 35
 
36
-    private CommandController controller;
37
-    private AliasCommand command;
36
+    private final AliasCommand command = new AliasCommand();
38 37
 
39
-    @Before
40
-    public void setUp() throws Exception {
41
-        controller = mock(CommandController.class);
42
-        when(controller.getCommandChar()).thenReturn('/');
43
-        command = new AliasCommand(controller);
38
+    @BeforeClass
39
+    public static void setUpClass() throws Exception {
40
+        TestMain.getTestMain();
44 41
     }
45 42
 
46 43
     @Test
47 44
     public void testUsageNoArgs() {
48 45
         final FrameContainer tiw = mock(FrameContainer.class);
49 46
 
50
-        command.execute(tiw, new CommandArguments(controller, "/foo"),
47
+        command.execute(tiw, new CommandArguments("/foo"),
51 48
                 new CommandContext(null, AliasCommand.INFO));
52 49
 
53 50
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -57,7 +54,7 @@ public class AliasCommandTest {
57 54
     public void testUsageOneArg() {
58 55
         final FrameContainer tiw = mock(FrameContainer.class);
59 56
 
60
-        command.execute(tiw, new CommandArguments(controller, "/foo --remove"),
57
+        command.execute(tiw, new CommandArguments("/foo --remove"),
61 58
                 new CommandContext(null, AliasCommand.INFO));
62 59
 
63 60
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());

+ 8
- 11
test/com/dmdirc/commandparser/commands/global/IfpluginTest.java Voir le fichier

@@ -21,32 +21,29 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.global;
23 23
 
24
+import com.dmdirc.TestMain;
24 25
 import com.dmdirc.FrameContainer;
25 26
 import com.dmdirc.commandparser.CommandArguments;
26 27
 import com.dmdirc.commandparser.commands.context.CommandContext;
27
-import com.dmdirc.interfaces.CommandController;
28 28
 
29
-import org.junit.Before;
29
+import org.junit.BeforeClass;
30 30
 import org.junit.Test;
31 31
 
32 32
 import static org.mockito.Mockito.*;
33 33
 
34 34
 public class IfpluginTest {
35 35
 
36
-    private CommandController controller;
37
-    private Ifplugin command;
36
+    private final Ifplugin command = new Ifplugin();
38 37
 
39
-    @Before
40
-    public void setUpClass() throws Exception {
41
-        controller = mock(CommandController.class);
42
-        when(controller.getCommandChar()).thenReturn('/');
43
-        command = new Ifplugin(controller);
38
+    @BeforeClass
39
+    public static void setUpClass() throws Exception {
40
+        TestMain.getTestMain();
44 41
     }
45 42
 
46 43
     @Test
47 44
     public void testUsageNoArgs() {
48 45
         final FrameContainer tiw = mock(FrameContainer.class);
49
-        command.execute(tiw, new CommandArguments(controller, "/foo"),
46
+        command.execute(tiw, new CommandArguments("/foo"),
50 47
                 new CommandContext(null, Ifplugin.INFO));
51 48
 
52 49
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -55,7 +52,7 @@ public class IfpluginTest {
55 52
     @Test
56 53
     public void testUsageOneArg() {
57 54
         final FrameContainer tiw = mock(FrameContainer.class);
58
-        command.execute(tiw, new CommandArguments(controller, "/foo bar"),
55
+        command.execute(tiw, new CommandArguments("/foo bar"),
59 56
                 new CommandContext(null, Ifplugin.INFO));
60 57
 
61 58
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());

+ 9
- 13
test/com/dmdirc/commandparser/commands/global/NewServerTest.java Voir le fichier

@@ -21,13 +21,12 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.global;
23 23
 
24
+import com.dmdirc.TestMain;
24 25
 import com.dmdirc.FrameContainer;
25 26
 import com.dmdirc.Server;
26
-import com.dmdirc.TestMain;
27 27
 import com.dmdirc.commandparser.CommandArguments;
28 28
 import com.dmdirc.commandparser.commands.context.CommandContext;
29 29
 import com.dmdirc.config.Identity;
30
-import com.dmdirc.interfaces.CommandController;
31 30
 import com.dmdirc.interfaces.ServerFactory;
32 31
 
33 32
 import java.net.URI;
@@ -46,7 +45,6 @@ public class NewServerTest {
46 45
         TestMain.getTestMain();
47 46
     }
48 47
 
49
-    private CommandController controller;
50 48
     private FrameContainer container;
51 49
     private ServerFactory factory;
52 50
     private Server server;
@@ -54,20 +52,18 @@ public class NewServerTest {
54 52
 
55 53
     @Before
56 54
     public void setup() {
57
-        controller = mock(CommandController.class);
58 55
         container = mock(FrameContainer.class);
59 56
         factory = mock(ServerFactory.class);
60 57
         server = mock(Server.class);
61 58
 
62
-        when(controller.getCommandChar()).thenReturn('/');
63 59
         when(factory.createServer(any(URI.class), any(Identity.class))).thenReturn(server);
64 60
 
65
-        command = new NewServer(controller, factory);
61
+        command = new NewServer(factory);
66 62
     }
67 63
 
68 64
     @Test
69 65
     public void testBasicUsage() throws URISyntaxException {
70
-        command.execute(container, new CommandArguments(controller, "/foo irc.foo.com"),
66
+        command.execute(container, new CommandArguments("/foo irc.foo.com"),
71 67
                 new CommandContext(null, NewServer.INFO));
72 68
 
73 69
         verify(factory).createServer(eq(new URI("irc://irc.foo.com:6667")), any(Identity.class));
@@ -76,7 +72,7 @@ public class NewServerTest {
76 72
 
77 73
     @Test
78 74
     public void testPortUsage() throws URISyntaxException {
79
-        command.execute(container, new CommandArguments(controller, "/foo irc.foo.com:1234"),
75
+        command.execute(container, new CommandArguments("/foo irc.foo.com:1234"),
80 76
                 new CommandContext(null, NewServer.INFO));
81 77
 
82 78
         verify(factory).createServer(eq(new URI("irc://irc.foo.com:1234")), any(Identity.class));
@@ -85,7 +81,7 @@ public class NewServerTest {
85 81
 
86 82
     @Test
87 83
     public void testUriUsage() throws URISyntaxException {
88
-        command.execute(container, new CommandArguments(controller, "/foo otheruri://foo.com:123/blah"),
84
+        command.execute(container, new CommandArguments("/foo otheruri://foo.com:123/blah"),
89 85
                 new CommandContext(null, NewServer.INFO));
90 86
 
91 87
         verify(factory).createServer(eq(new URI("otheruri://foo.com:123/blah")), any(Identity.class));
@@ -94,7 +90,7 @@ public class NewServerTest {
94 90
 
95 91
     @Test
96 92
     public void testUsageNoArgs() {
97
-        command.execute(container, new CommandArguments(controller, "/foo"),
93
+        command.execute(container, new CommandArguments("/foo"),
98 94
                 new CommandContext(null, NewServer.INFO));
99 95
 
100 96
         verify(container).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -102,7 +98,7 @@ public class NewServerTest {
102 98
 
103 99
     @Test
104 100
     public void testInvalidPort() {
105
-        command.execute(container, new CommandArguments(controller, "/foo foo:abc"),
101
+        command.execute(container, new CommandArguments("/foo foo:abc"),
106 102
                 new CommandContext(null, NewServer.INFO));
107 103
 
108 104
         verify(container).addLine(eq("commandError"), anyString());
@@ -110,7 +106,7 @@ public class NewServerTest {
110 106
 
111 107
     @Test
112 108
     public void testOutOfRangePort1() {
113
-        command.execute(container, new CommandArguments(controller, "/foo foo:0"),
109
+        command.execute(container, new CommandArguments("/foo foo:0"),
114 110
                 new CommandContext(null, NewServer.INFO));
115 111
 
116 112
         verify(container).addLine(eq("commandError"), anyString());
@@ -118,7 +114,7 @@ public class NewServerTest {
118 114
 
119 115
     @Test
120 116
     public void testOutOfRangePort2() {
121
-        command.execute(container, new CommandArguments(controller, "/foo foo:65537"),
117
+        command.execute(container, new CommandArguments("/foo foo:65537"),
122 118
                 new CommandContext(null, NewServer.INFO));
123 119
 
124 120
         verify(container).addLine(eq("commandError"), anyString());

+ 16
- 14
test/com/dmdirc/commandparser/commands/server/ChangeServerTest.java Voir le fichier

@@ -21,43 +21,45 @@
21 21
  */
22 22
 package com.dmdirc.commandparser.commands.server;
23 23
 
24
+import com.dmdirc.TestMain;
24 25
 import com.dmdirc.FrameContainer;
25 26
 import com.dmdirc.Server;
26 27
 import com.dmdirc.commandparser.CommandArguments;
27 28
 import com.dmdirc.commandparser.commands.context.ServerCommandContext;
28 29
 import com.dmdirc.config.Identity;
29
-import com.dmdirc.interfaces.CommandController;
30 30
 
31 31
 import java.net.URI;
32 32
 import java.net.URISyntaxException;
33 33
 
34 34
 import org.junit.Before;
35
+import org.junit.BeforeClass;
35 36
 import org.junit.Test;
36 37
 
37 38
 import static org.mockito.Mockito.*;
38 39
 
39 40
 public class ChangeServerTest {
40 41
 
41
-    private CommandController controller;
42
-    private ChangeServer command;
42
+    private final ChangeServer command = new ChangeServer();
43 43
     private FrameContainer tiw;
44 44
     private Identity profile;
45 45
     private Server server;
46 46
 
47
+    @BeforeClass
48
+    public static void setUpClass() throws Exception {
49
+        TestMain.getTestMain();
50
+    }
51
+
47 52
     @Before
48 53
     public void setUp() {
49
-        controller = mock(CommandController.class);
50 54
         tiw = mock(FrameContainer.class);
51 55
         profile = mock(Identity.class);
52 56
         server = mock(Server.class);
53
-        when(controller.getCommandChar()).thenReturn('/');
54 57
         when(server.getProfile()).thenReturn(profile);
55
-        command = new ChangeServer(controller);
56 58
     }
57 59
 
58 60
     @Test
59 61
     public void testUsageNoArgs() {
60
-        command.execute(tiw, new CommandArguments(controller, "/server"),
62
+        command.execute(tiw, new CommandArguments("/server"),
61 63
                 new ServerCommandContext(null, ChangeServer.INFO, server));
62 64
 
63 65
         verify(tiw).addLine(eq("commandUsage"), anyChar(), anyString(), anyString());
@@ -65,7 +67,7 @@ public class ChangeServerTest {
65 67
 
66 68
     @Test
67 69
     public void testInvalidPort() {
68
-        command.execute(tiw, new CommandArguments(controller, "/server foo:abc"),
70
+        command.execute(tiw, new CommandArguments("/server foo:abc"),
69 71
                 new ServerCommandContext(null, ChangeServer.INFO, server));
70 72
 
71 73
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -73,7 +75,7 @@ public class ChangeServerTest {
73 75
 
74 76
     @Test
75 77
     public void testOutOfRangePort1() {
76
-        command.execute(tiw, new CommandArguments(controller, "/server foo:0"),
78
+        command.execute(tiw, new CommandArguments("/server foo:0"),
77 79
                 new ServerCommandContext(null, ChangeServer.INFO, server));
78 80
 
79 81
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -81,7 +83,7 @@ public class ChangeServerTest {
81 83
 
82 84
     @Test
83 85
     public void testOutOfRangePort2() {
84
-        command.execute(tiw, new CommandArguments(controller, "/server foo:65537"),
86
+        command.execute(tiw, new CommandArguments("/server foo:65537"),
85 87
                 new ServerCommandContext(null, ChangeServer.INFO, server));
86 88
 
87 89
         verify(tiw).addLine(eq("commandError"), anyString());
@@ -89,7 +91,7 @@ public class ChangeServerTest {
89 91
 
90 92
     @Test
91 93
     public void testExecuteBasic() throws URISyntaxException {
92
-        command.execute(tiw, new CommandArguments(controller, "/server foo:1234"),
94
+        command.execute(tiw, new CommandArguments("/server foo:1234"),
93 95
                 new ServerCommandContext(null, ChangeServer.INFO, server));
94 96
 
95 97
         verify(server).connect(eq(new URI("irc://foo:1234")), same(profile));
@@ -97,7 +99,7 @@ public class ChangeServerTest {
97 99
 
98 100
     @Test
99 101
     public void testExecuteNoPort() throws URISyntaxException {
100
-        command.execute(tiw, new CommandArguments(controller, "/server foo"),
102
+        command.execute(tiw, new CommandArguments("/server foo"),
101 103
                 new ServerCommandContext(null, ChangeServer.INFO, server));
102 104
 
103 105
         verify(server).connect(eq(new URI("irc://foo:6667")), same(profile));
@@ -105,7 +107,7 @@ public class ChangeServerTest {
105 107
 
106 108
     @Test
107 109
     public void testDeprecatedSSL() throws URISyntaxException {
108
-        command.execute(tiw, new CommandArguments(controller, "/server --ssl foo"),
110
+        command.execute(tiw, new CommandArguments("/server --ssl foo"),
109 111
                 new ServerCommandContext(null, ChangeServer.INFO, server));
110 112
 
111 113
         verify(server).connect(eq(new URI("ircs://foo:6667")), same(profile));
@@ -113,7 +115,7 @@ public class ChangeServerTest {
113 115
 
114 116
     @Test
115 117
     public void testExecuteComplex() throws URISyntaxException {
116
-        command.execute(tiw, new CommandArguments(controller, "/server foo:+1234 password"),
118
+        command.execute(tiw, new CommandArguments("/server foo:+1234 password"),
117 119
                 new ServerCommandContext(null, ChangeServer.INFO, server));
118 120
 
119 121
         verify(server).connect(eq(new URI("ircs://password@foo:1234")), same(profile));

+ 8
- 8
test/com/dmdirc/ui/WindowManagerTest.java Voir le fichier

@@ -60,7 +60,7 @@ public class WindowManagerTest {
60 60
     public void testAddRoot() {
61 61
         final WindowManager manager = new WindowManager();
62 62
         final FrameListener tfm = mock(FrameListener.class);
63
-        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
63
+        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
64 64
 
65 65
         manager.addListener(tfm);
66 66
 
@@ -77,8 +77,8 @@ public class WindowManagerTest {
77 77
     public void testAddChild() {
78 78
         final WindowManager manager = new WindowManager();
79 79
         final FrameListener tfm = mock(FrameListener.class);
80
-        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
81
-        final Window child = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
80
+        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
81
+        final Window child = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
82 82
         manager.addWindow(parent.getContainer());
83 83
         manager.addListener(tfm);
84 84
 
@@ -92,7 +92,7 @@ public class WindowManagerTest {
92 92
     public void testRemoveRoot() {
93 93
         final WindowManager manager = new WindowManager();
94 94
         final FrameListener tfm = mock(FrameListener.class);
95
-        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
95
+        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
96 96
         manager.addWindow(parent.getContainer());
97 97
         manager.addListener(tfm);
98 98
 
@@ -105,8 +105,8 @@ public class WindowManagerTest {
105 105
     public void testRemoveChild() {
106 106
         final WindowManager manager = new WindowManager();
107 107
         final FrameListener tfm = mock(FrameListener.class);
108
-        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
109
-        final Window child = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
108
+        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
109
+        final Window child = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
110 110
         manager.addWindow(parent.getContainer());
111 111
         manager.addWindow(parent.getContainer(), child.getContainer());
112 112
         manager.addListener(tfm);
@@ -123,8 +123,8 @@ public class WindowManagerTest {
123 123
     public void testRemoveFrameManager() {
124 124
         final WindowManager manager = new WindowManager();
125 125
         final FrameListener tfm = mock(FrameListener.class);
126
-        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
127
-        final Window child = new DummyInputWindow(new DummyController(TestMain.getTestMain(), TestMain.getTestMain().getPluginManager()), new TestWritableFrameContainer(512, cm, commands));
126
+        final Window parent = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
127
+        final Window child = new DummyInputWindow(new DummyController(TestMain.getTestMain()), new TestWritableFrameContainer(512, cm, commands));
128 128
         manager.addWindow(parent.getContainer());
129 129
 
130 130
         manager.addListener(tfm);

Chargement…
Annuler
Enregistrer