瀏覽代碼

Tidy up.

Remove deprecated methods, make all methods on TCUtils non-static.
pull/123/head
Chris Smith 9 年之前
父節點
當前提交
6cc6ceab91

+ 1
- 11
src/com/dmdirc/commandparser/parsers/CommandParser.java 查看文件

84
         loadCommands();
84
         loadCommands();
85
     }
85
     }
86
 
86
 
87
-    /**
88
-     * @deprecated Callers should obtain their own instance of command controller.
89
-     *
90
-     * @return The command manager for this parser.
91
-     */
92
-    @Deprecated
93
-    public CommandController getCommandManager() {
94
-        return commandManager;
95
-    }
96
-
97
     /**
87
     /**
98
      * Sets the owner of this command parser.
88
      * Sets the owner of this command parser.
99
      *
89
      *
212
                 final String newCommandString = commandManager.getCommandChar()
202
                 final String newCommandString = commandManager.getCommandChar()
213
                         + (silent ? String.valueOf(commandManager.getSilenceChar()) : "")
203
                         + (silent ? String.valueOf(commandManager.getSilenceChar()) : "")
214
                         + args.getCommandName()
204
                         + args.getCommandName()
215
-                        + (cargs.length > 1 ? " " + args.getArgumentsAsString(1) : "");
205
+                        + (cargs.length > 1 ? ' ' + args.getArgumentsAsString(1) : "");
216
 
206
 
217
                 if (server.hasChannel(channel)) {
207
                 if (server.hasChannel(channel)) {
218
                     server.getChannel(channel).getCommandParser().parseCommand(origin,
208
                     server.getChannel(channel).getCommandParser().parseCommand(origin,

+ 0
- 13
src/com/dmdirc/ui/input/InputHandler.java 查看文件

115
     /** The event bus to use to dispatch input events. */
115
     /** The event bus to use to dispatch input events. */
116
     private final DMDircMBassador eventBus;
116
     private final DMDircMBassador eventBus;
117
 
117
 
118
-    /** Temporary ctor to allow plugins to specify a new one. */
119
-    @Deprecated
120
-    public InputHandler(
121
-            final ServiceManager serviceManager,
122
-            final InputField target,
123
-            final CommandController commandController,
124
-            final CommandParser commandParser,
125
-            final FrameContainer parentWindow,
126
-            final DMDircMBassador eventBus) {
127
-        this(serviceManager, target, commandController, commandParser, parentWindow,
128
-                new TabCompleterUtils(), eventBus);
129
-    }
130
-
131
     /**
118
     /**
132
      * Creates a new instance of InputHandler. Adds listeners to the target that we need to operate.
119
      * Creates a new instance of InputHandler. Adds listeners to the target that we need to operate.
133
      *
120
      *

+ 10
- 7
src/com/dmdirc/ui/input/TabCompleterUtils.java 查看文件

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

Loading…
取消
儲存