|
@@ -43,8 +43,11 @@ import javax.inject.Singleton;
|
43
|
43
|
@Singleton
|
44
|
44
|
public class TabCompleterUtils {
|
45
|
45
|
|
|
46
|
+ private final CommandController commandController;
|
|
47
|
+
|
46
|
48
|
@Inject
|
47
|
|
- public TabCompleterUtils() {
|
|
49
|
+ public TabCompleterUtils(final CommandController commandController) {
|
|
50
|
+ this.commandController = commandController;
|
48
|
51
|
}
|
49
|
52
|
|
50
|
53
|
/**
|
|
@@ -57,7 +60,7 @@ public class TabCompleterUtils {
|
57
|
60
|
* @return Additional tab targets for the text, or null if none are available
|
58
|
61
|
*/
|
59
|
62
|
@Nullable
|
60
|
|
- public static AdditionalTabTargets getIntelligentResults(final int arg,
|
|
63
|
+ public AdditionalTabTargets getIntelligentResults(final int arg,
|
61
|
64
|
final IntelligentCommand.IntelligentCommandContext context, final int offset) {
|
62
|
65
|
if (arg == offset) {
|
63
|
66
|
final AdditionalTabTargets targets = new AdditionalTabTargets().excludeAll();
|
|
@@ -65,7 +68,7 @@ public class TabCompleterUtils {
|
65
|
68
|
return targets;
|
66
|
69
|
} else {
|
67
|
70
|
return getIntelligentResults(context.getWindow(),
|
68
|
|
- new CommandArguments(context.getWindow().getCommandParser().getCommandManager(),
|
|
71
|
+ new CommandArguments(commandController,
|
69
|
72
|
context.getPreviousArgs().subList(offset,
|
70
|
73
|
context.getPreviousArgs().size())), context.getPartial());
|
71
|
74
|
}
|
|
@@ -83,15 +86,15 @@ public class TabCompleterUtils {
|
83
|
86
|
* @since 0.6.4
|
84
|
87
|
*/
|
85
|
88
|
@Nullable
|
86
|
|
- private static AdditionalTabTargets getIntelligentResults(
|
|
89
|
+ private AdditionalTabTargets getIntelligentResults(
|
87
|
90
|
final FrameContainer window,
|
88
|
91
|
final CommandArguments args, final String partial) {
|
89
|
92
|
if (!args.isCommand()) {
|
90
|
93
|
return null;
|
91
|
94
|
}
|
92
|
95
|
|
93
|
|
- final Map.Entry<CommandInfo, Command> command = window.getCommandParser().
|
94
|
|
- getCommandManager().getCommand(args.getCommandName());
|
|
96
|
+ final Map.Entry<CommandInfo, Command> command =
|
|
97
|
+ commandController.getCommand(args.getCommandName());
|
95
|
98
|
|
96
|
99
|
AdditionalTabTargets targets = null;
|
97
|
100
|
|
|
@@ -127,7 +130,7 @@ public class TabCompleterUtils {
|
127
|
130
|
* @since 0.6.4
|
128
|
131
|
*/
|
129
|
132
|
@Nullable
|
130
|
|
- public static AdditionalTabTargets getIntelligentResults(
|
|
133
|
+ public AdditionalTabTargets getIntelligentResults(
|
131
|
134
|
final FrameContainer window, final CommandController commandController,
|
132
|
135
|
final String text, final String partial) {
|
133
|
136
|
return getIntelligentResults(window,
|