|
@@ -22,6 +22,7 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc;
|
24
|
24
|
|
|
25
|
+import com.dmdirc.interfaces.LifecycleController;
|
25
|
26
|
import com.dmdirc.actions.ActionManager;
|
26
|
27
|
import com.dmdirc.actions.CoreActionType;
|
27
|
28
|
import com.dmdirc.commandline.CommandLineOptionsModule;
|
|
@@ -90,6 +91,9 @@ public class Main implements LifecycleController {
|
90
|
91
|
/** The plugin manager the client will use. */
|
91
|
92
|
private final PluginManager pluginManager;
|
92
|
93
|
|
|
94
|
+ /** The command loader to use to initialise the command manager. */
|
|
95
|
+ private final CommandLoader commandLoader;
|
|
96
|
+
|
93
|
97
|
/** The config dir to use for the client. */
|
94
|
98
|
private final String configdir;
|
95
|
99
|
|
|
@@ -105,6 +109,7 @@ public class Main implements LifecycleController {
|
105
|
109
|
* @param actionManager The action manager the client will use.
|
106
|
110
|
* @param commandLineParser The command-line parser used for this instance.
|
107
|
111
|
* @param pluginManager The plugin manager the client will use.
|
|
112
|
+ * @param commandLoader The command loader to use to initialise the command manager.
|
108
|
113
|
* @param configDir The base configuration directory to use.
|
109
|
114
|
*/
|
110
|
115
|
@Inject
|
|
@@ -114,12 +119,14 @@ public class Main implements LifecycleController {
|
114
|
119
|
final ActionManager actionManager,
|
115
|
120
|
final CommandLineParser commandLineParser,
|
116
|
121
|
final PluginManager pluginManager,
|
|
122
|
+ final CommandLoader commandLoader,
|
117
|
123
|
@Directory(DirectoryType.BASE) final String configDir) {
|
118
|
124
|
this.identityManager = identityManager;
|
119
|
125
|
this.serverManager = serverManager;
|
120
|
126
|
this.actionManager = actionManager;
|
121
|
127
|
this.commandLineParser = commandLineParser;
|
122
|
128
|
this.pluginManager = pluginManager;
|
|
129
|
+ this.commandLoader = commandLoader;
|
123
|
130
|
this.configdir = configDir;
|
124
|
131
|
}
|
125
|
132
|
|
|
@@ -167,8 +174,7 @@ public class Main implements LifecycleController {
|
167
|
174
|
|
168
|
175
|
commandLineParser.applySettings(identityManager.getGlobalConfigIdentity());
|
169
|
176
|
|
170
|
|
- new CommandLoader(this, serverManager, pluginManager, identityManager)
|
171
|
|
- .loadCommands(CommandManager.initCommandManager(identityManager, serverManager));
|
|
177
|
+ commandLoader.loadCommands(CommandManager.initCommandManager(identityManager, serverManager));
|
172
|
178
|
|
173
|
179
|
for (String service : new String[]{"ui", "tabcompletion", "parser"}) {
|
174
|
180
|
ensureExists(pluginManager, service);
|
|
@@ -400,27 +406,47 @@ public class Main implements LifecycleController {
|
400
|
406
|
}
|
401
|
407
|
}
|
402
|
408
|
|
403
|
|
- /** {@inheritDoc} */
|
|
409
|
+ /**
|
|
410
|
+ * {@inheritDoc}
|
|
411
|
+ *
|
|
412
|
+ * @deprecated Use a proper {@link LifecycleController}.
|
|
413
|
+ */
|
404
|
414
|
@Override
|
|
415
|
+ @Deprecated
|
405
|
416
|
public void quit() {
|
406
|
417
|
quit(0);
|
407
|
418
|
}
|
408
|
419
|
|
409
|
|
- /** {@inheritDoc} */
|
|
420
|
+ /**
|
|
421
|
+ * {@inheritDoc}
|
|
422
|
+ *
|
|
423
|
+ * @deprecated Use a proper {@link LifecycleController}.
|
|
424
|
+ */
|
410
|
425
|
@Override
|
|
426
|
+ @Deprecated
|
411
|
427
|
public void quit(final int exitCode) {
|
412
|
|
- quit(IdentityManager.getIdentityManager().getGlobalConfiguration().getOption("general",
|
|
428
|
+ quit(identityManager.getGlobalConfiguration().getOption("general",
|
413
|
429
|
"closemessage"), exitCode);
|
414
|
430
|
}
|
415
|
431
|
|
416
|
|
- /** {@inheritDoc} */
|
|
432
|
+ /**
|
|
433
|
+ * {@inheritDoc}
|
|
434
|
+ *
|
|
435
|
+ * @deprecated Use a proper {@link LifecycleController}.
|
|
436
|
+ */
|
417
|
437
|
@Override
|
|
438
|
+ @Deprecated
|
418
|
439
|
public void quit(final String reason) {
|
419
|
440
|
quit(reason, 0);
|
420
|
441
|
}
|
421
|
442
|
|
422
|
|
- /** {@inheritDoc} */
|
|
443
|
+ /**
|
|
444
|
+ * {@inheritDoc}
|
|
445
|
+ *
|
|
446
|
+ * @deprecated Use a proper {@link LifecycleController}.
|
|
447
|
+ */
|
423
|
448
|
@Override
|
|
449
|
+ @Deprecated
|
424
|
450
|
public void quit(final String reason, final int exitCode) {
|
425
|
451
|
serverManager.disconnectAll(reason);
|
426
|
452
|
|