|
@@ -33,7 +33,7 @@ import java.util.List;
|
33
|
33
|
/**
|
34
|
34
|
* The tab completer handles a user's request to tab complete some word.
|
35
|
35
|
*/
|
36
|
|
-public class TabCompleter {
|
|
36
|
+public class TabCompleterImpl implements TabCompleter {
|
37
|
37
|
|
38
|
38
|
/**
|
39
|
39
|
* The parent TabCompleter. Results from parents are merged with results from this completer.
|
|
@@ -46,36 +46,29 @@ public class TabCompleter {
|
46
|
46
|
private final Multimap<TabCompletionType, String> entries = ArrayListMultimap.create();
|
47
|
47
|
|
48
|
48
|
/**
|
49
|
|
- * Creates a new instance of {@link TabCompleter}.
|
|
49
|
+ * Creates a new instance of {@link TabCompleterImpl}.
|
50
|
50
|
*
|
51
|
51
|
* @param configManager The manager to read config settings from.
|
52
|
52
|
*/
|
53
|
|
- public TabCompleter(final AggregateConfigProvider configManager) {
|
|
53
|
+ public TabCompleterImpl(final AggregateConfigProvider configManager) {
|
54
|
54
|
this.parent = null;
|
55
|
55
|
this.configManager = configManager;
|
56
|
56
|
}
|
57
|
57
|
|
58
|
58
|
/**
|
59
|
|
- * Creates a new instance of {@link TabCompleter}.
|
|
59
|
+ * Creates a new instance of {@link TabCompleterImpl}.
|
60
|
60
|
*
|
61
|
61
|
* @param configManager The manager to read config settings from.
|
62
|
62
|
* @param parent The parent tab completer to inherit completions from.
|
63
|
63
|
*/
|
64
|
|
- public TabCompleter(
|
|
64
|
+ public TabCompleterImpl(
|
65
|
65
|
final AggregateConfigProvider configManager,
|
66
|
66
|
@Nullable final TabCompleter parent) {
|
67
|
67
|
this.parent = parent;
|
68
|
68
|
this.configManager = configManager;
|
69
|
69
|
}
|
70
|
70
|
|
71
|
|
- /**
|
72
|
|
- * Attempts to complete the partial string.
|
73
|
|
- *
|
74
|
|
- * @param partial The string to tab complete
|
75
|
|
- * @param additionals A list of additional strings to use
|
76
|
|
- *
|
77
|
|
- * @return A TabCompleterResult containing any matches found
|
78
|
|
- */
|
|
71
|
+ @Override
|
79
|
72
|
public List<String> complete(final String partial, @Nullable final AdditionalTabTargets additionals) {
|
80
|
73
|
final List<String> result = new ArrayList<>();
|
81
|
74
|
|
|
@@ -118,22 +111,12 @@ public class TabCompleter {
|
118
|
111
|
return result;
|
119
|
112
|
}
|
120
|
113
|
|
121
|
|
- /**
|
122
|
|
- * Adds a new entry to this tab completer's list.
|
123
|
|
- *
|
124
|
|
- * @param type The type of the entry that's being added
|
125
|
|
- * @param entry The new entry to be added
|
126
|
|
- */
|
|
114
|
+ @Override
|
127
|
115
|
public void addEntry(final TabCompletionType type, final String entry) {
|
128
|
116
|
entries.put(type, entry);
|
129
|
117
|
}
|
130
|
118
|
|
131
|
|
- /**
|
132
|
|
- * Adds multiple new entries to this tab completer's list.
|
133
|
|
- *
|
134
|
|
- * @param type The type of the entries that're being added
|
135
|
|
- * @param newEntries Entries to be added
|
136
|
|
- */
|
|
119
|
+ @Override
|
137
|
120
|
public void addEntries(final TabCompletionType type, final Iterable<String> newEntries) {
|
138
|
121
|
if (newEntries == null) {
|
139
|
122
|
return;
|
|
@@ -144,28 +127,17 @@ public class TabCompleter {
|
144
|
127
|
}
|
145
|
128
|
}
|
146
|
129
|
|
147
|
|
- /**
|
148
|
|
- * Removes a specified entry from this tab completer's list.
|
149
|
|
- *
|
150
|
|
- * @param type The type of the entry that should be removed
|
151
|
|
- * @param entry The entry to be removed
|
152
|
|
- */
|
|
130
|
+ @Override
|
153
|
131
|
public void removeEntry(final TabCompletionType type, final String entry) {
|
154
|
132
|
entries.remove(type, entry);
|
155
|
133
|
}
|
156
|
134
|
|
157
|
|
- /**
|
158
|
|
- * Clears all entries in this tab completer.
|
159
|
|
- */
|
|
135
|
+ @Override
|
160
|
136
|
public void clear() {
|
161
|
137
|
entries.clear();
|
162
|
138
|
}
|
163
|
139
|
|
164
|
|
- /**
|
165
|
|
- * Clears all entries of the specified type in this tab completer.
|
166
|
|
- *
|
167
|
|
- * @param type The type of entry to clear
|
168
|
|
- */
|
|
140
|
+ @Override
|
169
|
141
|
public void clear(final TabCompletionType type) {
|
170
|
142
|
entries.removeAll(type);
|
171
|
143
|
}
|