|
@@ -30,7 +30,7 @@ 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.IntelligentCommand.IntelligentCommandContext;
|
33
|
|
-import com.dmdirc.config.IdentityManager;
|
|
33
|
+import com.dmdirc.interfaces.CommandController;
|
34
|
34
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
35
|
35
|
import com.dmdirc.util.collections.MapList;
|
36
|
36
|
|
|
@@ -53,40 +53,42 @@ public class TabCompleter {
|
53
|
53
|
@Nullable
|
54
|
54
|
private final TabCompleter parent;
|
55
|
55
|
|
56
|
|
- /**
|
57
|
|
- * The config manager to use for reading settings.
|
58
|
|
- */
|
|
56
|
+ /** The config manager to use for reading settings. */
|
59
|
57
|
private final AggregateConfigProvider configManager;
|
60
|
58
|
|
61
|
|
- /**
|
62
|
|
- * The entries in this completer.
|
63
|
|
- */
|
64
|
|
- private final MapList<TabCompletionType, String> entries = new MapList<>();
|
|
59
|
+ /** The controller to use to retrieve command information. */
|
|
60
|
+ private final CommandController commandController;
|
65
|
61
|
|
66
|
|
- /** Creates a new instance of TabCompleter. */
|
67
|
|
- @Deprecated
|
68
|
|
- public TabCompleter() {
|
69
|
|
- this(IdentityManager.getIdentityManager().getGlobalConfiguration());
|
70
|
|
- }
|
|
62
|
+ /** The entries in this completer. */
|
|
63
|
+ private final MapList<TabCompletionType, String> entries = new MapList<>();
|
71
|
64
|
|
72
|
65
|
/**
|
73
|
66
|
* Creates a new instance of {@link TabCompleter}.
|
74
|
67
|
*
|
|
68
|
+ * @param commandController The controller to use for command information.
|
75
|
69
|
* @param configManager The manager to read config settings from.
|
76
|
70
|
*/
|
77
|
|
- public TabCompleter(final AggregateConfigProvider configManager) {
|
|
71
|
+ public TabCompleter(
|
|
72
|
+ final CommandController commandController,
|
|
73
|
+ final AggregateConfigProvider configManager) {
|
78
|
74
|
this.parent = null;
|
|
75
|
+ this.commandController = commandController;
|
79
|
76
|
this.configManager = configManager;
|
80
|
77
|
}
|
81
|
78
|
|
82
|
79
|
/**
|
83
|
80
|
* Creates a new instance of {@link TabCompleter}.
|
84
|
81
|
*
|
|
82
|
+ * @param commandController The controller to use for command information.
|
85
|
83
|
* @param configManager The manager to read config settings from.
|
86
|
84
|
* @param parent The parent tab completer to inherit completions from.
|
87
|
85
|
*/
|
88
|
|
- public TabCompleter(final AggregateConfigProvider configManager, final TabCompleter parent) {
|
|
86
|
+ public TabCompleter(
|
|
87
|
+ final CommandController commandController,
|
|
88
|
+ final AggregateConfigProvider configManager,
|
|
89
|
+ final TabCompleter parent) {
|
89
|
90
|
this.parent = parent;
|
|
91
|
+ this.commandController = commandController;
|
90
|
92
|
this.configManager = configManager;
|
91
|
93
|
}
|
92
|
94
|
|
|
@@ -156,11 +158,11 @@ public class TabCompleter {
|
156
|
158
|
entries.add(type, entry);
|
157
|
159
|
|
158
|
160
|
if (type == TabCompletionType.COMMAND && entry.length() > 1
|
159
|
|
- && entry.charAt(0) == CommandManager.getCommandManager().getCommandChar()
|
160
|
|
- && entry.charAt(1) != CommandManager.getCommandManager().getSilenceChar()) {
|
|
161
|
+ && entry.charAt(0) == commandController.getCommandChar()
|
|
162
|
+ && entry.charAt(1) != commandController.getSilenceChar()) {
|
161
|
163
|
// If we're adding a command name that doesn't include the silence
|
162
|
164
|
// character, also add a version with the silence char
|
163
|
|
- addEntry(type, entry.substring(0, 1) + CommandManager.getCommandManager().getSilenceChar()
|
|
165
|
+ addEntry(type, entry.substring(0, 1) + commandController.getSilenceChar()
|
164
|
166
|
+ entry.substring(1));
|
165
|
167
|
}
|
166
|
168
|
}
|