|
@@ -0,0 +1,77 @@
|
|
1
|
+/*
|
|
2
|
+ * Copyright (c) 2006-2017 DMDirc Developers
|
|
3
|
+ *
|
|
4
|
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
5
|
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
|
6
|
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
|
7
|
+ * permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+ *
|
|
9
|
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
|
10
|
+ * Software.
|
|
11
|
+ *
|
|
12
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
13
|
+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
|
|
14
|
+ * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
15
|
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
16
|
+ */
|
|
17
|
+
|
|
18
|
+package com.dmdirc.commandparser.commands.global;
|
|
19
|
+
|
|
20
|
+import com.dmdirc.commandparser.BaseCommandInfo;
|
|
21
|
+import com.dmdirc.commandparser.CommandArguments;
|
|
22
|
+import com.dmdirc.commandparser.CommandInfo;
|
|
23
|
+import com.dmdirc.commandparser.CommandType;
|
|
24
|
+import com.dmdirc.commandparser.commands.BaseCommand;
|
|
25
|
+import com.dmdirc.commandparser.commands.IntelligentCommand;
|
|
26
|
+import com.dmdirc.commandparser.commands.context.CommandContext;
|
|
27
|
+import com.dmdirc.interfaces.CommandController;
|
|
28
|
+import com.dmdirc.interfaces.WindowModel;
|
|
29
|
+import com.dmdirc.interfaces.config.IdentityController;
|
|
30
|
+import com.dmdirc.ui.input.AdditionalTabTargets;
|
|
31
|
+import com.dmdirc.ui.messages.EventFormatProvider;
|
|
32
|
+import com.dmdirc.ui.messages.MultiEventFormatProvider;
|
|
33
|
+import com.dmdirc.ui.messages.YamlEventFormatProvider;
|
|
34
|
+
|
|
35
|
+import javax.annotation.Nonnull;
|
|
36
|
+import javax.inject.Inject;
|
|
37
|
+
|
|
38
|
+/**
|
|
39
|
+ * Allows the user to save the config file.
|
|
40
|
+ */
|
|
41
|
+public final class ReloadFormat extends BaseCommand implements IntelligentCommand {
|
|
42
|
+
|
|
43
|
+ /** A command info object for this command. */
|
|
44
|
+ public static final CommandInfo INFO = new BaseCommandInfo("reloadformat",
|
|
45
|
+ "reloadformat - force the client to reload the format.yml file",
|
|
46
|
+ CommandType.TYPE_GLOBAL);
|
|
47
|
+ /** Format provider for events. */
|
|
48
|
+ private final EventFormatProvider formatProvider;
|
|
49
|
+
|
|
50
|
+ /**
|
|
51
|
+ * Creates a new instance of the {@link ReloadFormat} command.
|
|
52
|
+ *
|
|
53
|
+ * @param controller The controller to use for command information.
|
|
54
|
+ * @param identityController The controller to save identities on.
|
|
55
|
+ */
|
|
56
|
+ @Inject
|
|
57
|
+ public ReloadFormat(final CommandController controller,
|
|
58
|
+ final IdentityController identityController,
|
|
59
|
+ final EventFormatProvider formatProvider) {
|
|
60
|
+ super(controller);
|
|
61
|
+ this.formatProvider = formatProvider;
|
|
62
|
+ }
|
|
63
|
+
|
|
64
|
+ @Override
|
|
65
|
+ public void execute(@Nonnull final WindowModel origin,
|
|
66
|
+ final CommandArguments args, final CommandContext context) {
|
|
67
|
+ formatProvider.reload();
|
|
68
|
+ showOutput(origin, args.isSilent(), "Format file reloaded.");
|
|
69
|
+ }
|
|
70
|
+
|
|
71
|
+ @Override
|
|
72
|
+ public AdditionalTabTargets getSuggestions(final int arg,
|
|
73
|
+ final IntelligentCommandContext context) {
|
|
74
|
+ return new AdditionalTabTargets().excludeAll();
|
|
75
|
+ }
|
|
76
|
+
|
|
77
|
+}
|