|
@@ -34,6 +34,8 @@ import com.dmdirc.ui.messages.Styliser;
|
34
|
34
|
import com.dmdirc.updater.UpdateChecker;
|
35
|
35
|
import com.dmdirc.updater.manager.CachingUpdateManager;
|
36
|
36
|
|
|
37
|
+import com.google.common.eventbus.EventBus;
|
|
38
|
+
|
37
|
39
|
import javax.inject.Inject;
|
38
|
40
|
import javax.inject.Provider;
|
39
|
41
|
|
|
@@ -48,6 +50,8 @@ public class ForceUpdate extends DebugCommand {
|
48
|
50
|
private final IdentityController identityController;
|
49
|
51
|
/** The update manager to use when forcing an update. */
|
50
|
52
|
private final CachingUpdateManager updateManager;
|
|
53
|
+ /** The event bus to post errors to. */
|
|
54
|
+ private final EventBus eventBus;
|
51
|
55
|
|
52
|
56
|
/**
|
53
|
57
|
* Creates a new instance of the command.
|
|
@@ -56,18 +60,21 @@ public class ForceUpdate extends DebugCommand {
|
56
|
60
|
* @param globalConfig The global config to use to check if updates are enabled.
|
57
|
61
|
* @param identityController The controller to use to read/write settings for the updater.
|
58
|
62
|
* @param updateManager The update manager to use when forcing an update.
|
|
63
|
+ * @param eventBus The event bus to post errors to
|
59
|
64
|
*/
|
60
|
65
|
@Inject
|
61
|
66
|
public ForceUpdate(
|
62
|
67
|
final Provider<Debug> commandProvider,
|
63
|
68
|
@GlobalConfig final AggregateConfigProvider globalConfig,
|
64
|
69
|
final IdentityController identityController,
|
65
|
|
- final CachingUpdateManager updateManager) {
|
|
70
|
+ final CachingUpdateManager updateManager,
|
|
71
|
+ final EventBus eventBus) {
|
66
|
72
|
super(commandProvider);
|
67
|
73
|
|
68
|
74
|
this.globalConfig = globalConfig;
|
69
|
75
|
this.identityController = identityController;
|
70
|
76
|
this.updateManager = updateManager;
|
|
77
|
+ this.eventBus = eventBus;
|
71
|
78
|
}
|
72
|
79
|
|
73
|
80
|
@Override
|
|
@@ -84,7 +91,8 @@ public class ForceUpdate extends DebugCommand {
|
84
|
91
|
public void execute(final FrameContainer origin,
|
85
|
92
|
final CommandArguments args, final CommandContext context) {
|
86
|
93
|
if (globalConfig.getOptionBool("updater", "enable")) {
|
87
|
|
- UpdateChecker.checkNow(updateManager, identityController, "Forced update checker");
|
|
94
|
+ UpdateChecker.checkNow(updateManager, identityController, eventBus,
|
|
95
|
+ "Forced update checker");
|
88
|
96
|
} else {
|
89
|
97
|
sendLine(origin, args.isSilent(), FORMAT_ERROR, "Update checking is "
|
90
|
98
|
+ "currently disabled. You can enable it by typing:");
|