ソースを参照

Tidy up some TabCompleter usages.

Change-Id: I2eb5ac89568b524ef13cf1d455eb5b51904c806c
Depends-On: I1d61d1895025f3b7febd7cae1e8411d0b198f141
Reviewed-on: http://gerrit.dmdirc.com/2866
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
tags/0.8
Chris Smith 10年前
コミット
101cd814f1

+ 4
- 0
src/com/dmdirc/addons/dcc/ChatContainer.java ファイルの表示

@@ -29,6 +29,7 @@ import com.dmdirc.interfaces.CommandController;
29 29
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30 30
 import com.dmdirc.messages.MessageSinkManager;
31 31
 import com.dmdirc.ui.core.components.WindowComponent;
32
+import com.dmdirc.ui.input.TabCompleterFactory;
32 33
 
33 34
 import java.util.Arrays;
34 35
 
@@ -53,16 +54,19 @@ public class ChatContainer extends DCCFrameContainer implements DCCChatHandler {
53 54
      * @param title The title of this window
54 55
      * @param nick My Current Nickname
55 56
      * @param targetNick Nickname of target
57
+     * @param tabCompleterFactory The factory to use to create tab completers.
56 58
      * @param messageSinkManager The sink manager to use to despatch messages.
57 59
      */
58 60
     public ChatContainer(final DCCChat dcc,
59 61
             final AggregateConfigProvider configManager,
60 62
             final CommandController commandController,
61 63
             final String title, final String nick, final String targetNick,
64
+            final TabCompleterFactory tabCompleterFactory,
62 65
             final MessageSinkManager messageSinkManager) {
63 66
         super(title, "dcc-chat-inactive", configManager,
64 67
                 new DCCCommandParser(configManager, commandController),
65 68
                 messageSinkManager,
69
+                tabCompleterFactory,
66 70
                 Arrays.asList(
67 71
                     WindowComponent.TEXTAREA.getIdentifier(),
68 72
                     WindowComponent.INPUTFIELD.getIdentifier()));

+ 9
- 2
src/com/dmdirc/addons/dcc/DCCCommand.java ファイルの表示

@@ -45,6 +45,7 @@ import com.dmdirc.messages.MessageSinkManager;
45 45
 import com.dmdirc.parser.interfaces.Parser;
46 46
 import com.dmdirc.ui.WindowManager;
47 47
 import com.dmdirc.ui.input.AdditionalTabTargets;
48
+import com.dmdirc.ui.input.TabCompleterFactory;
48 49
 import com.dmdirc.ui.input.TabCompletionType;
49 50
 
50 51
 import java.io.File;
@@ -72,6 +73,8 @@ public class DCCCommand extends Command implements IntelligentCommand {
72 73
     private final WindowManager windowManager;
73 74
     /** The sink manager to use to despatch messages. */
74 75
     private final MessageSinkManager messageSinkManager;
76
+    /** The factory to use for tab completers. */
77
+    private final TabCompleterFactory tabCompleterFactory;
75 78
 
76 79
     /**
77 80
      * Creates a new instance of DCCCommand.
@@ -81,6 +84,7 @@ public class DCCCommand extends Command implements IntelligentCommand {
81 84
      * @param plugin The DCC Plugin that this command belongs to
82 85
      * @param messageSinkManager The sink manager to use to despatch messages.
83 86
      * @param windowManager Window management
87
+     * @param tabCompleterFactory The factory to use for tab completers.
84 88
      */
85 89
     @Inject
86 90
     public DCCCommand(
@@ -88,12 +92,14 @@ public class DCCCommand extends Command implements IntelligentCommand {
88 92
             final MainFrame mainFrame,
89 93
             final DCCManager plugin,
90 94
             final MessageSinkManager messageSinkManager,
91
-            final WindowManager windowManager) {
95
+            final WindowManager windowManager,
96
+            final TabCompleterFactory tabCompleterFactory) {
92 97
         super(controller);
93 98
         this.mainFrame = mainFrame;
94 99
         myPlugin = plugin;
95 100
         this.messageSinkManager = messageSinkManager;
96 101
         this.windowManager = windowManager;
102
+        this.tabCompleterFactory = tabCompleterFactory;
97 103
     }
98 104
 
99 105
     /** {@inheritDoc} */
@@ -160,7 +166,8 @@ public class DCCCommand extends Command implements IntelligentCommand {
160 166
         final DCCChat chat = new DCCChat();
161 167
         if (myPlugin.listen(chat)) {
162 168
             final ChatContainer window = new ChatContainer(chat, origin.getConfigManager(),
163
-                    getController(), "*Chat: " + target, myNickname, target, messageSinkManager);
169
+                    getController(), "*Chat: " + target, myNickname, target, tabCompleterFactory,
170
+                    messageSinkManager);
164 171
             windowManager.addWindow(myPlugin.getContainer(), window);
165 172
             parser.sendCTCP(target, "DCC", "CHAT chat " + DCC.ipToLong(
166 173
                     myPlugin.getListenIP(parser)) + " " + chat.getPort());

+ 11
- 3
src/com/dmdirc/addons/dcc/DCCFrameContainer.java ファイルの表示

@@ -28,6 +28,7 @@ import com.dmdirc.commandparser.parsers.CommandParser;
28 28
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
29 29
 import com.dmdirc.messages.MessageSinkManager;
30 30
 import com.dmdirc.ui.input.TabCompleter;
31
+import com.dmdirc.ui.input.TabCompleterFactory;
31 32
 
32 33
 import java.util.Collection;
33 34
 
@@ -36,6 +37,9 @@ import java.util.Collection;
36 37
  */
37 38
 public abstract class DCCFrameContainer extends WritableFrameContainer {
38 39
 
40
+    /** The factory to use to create tab completers. */
41
+    private final TabCompleterFactory tabCompleterFactory;
42
+
39 43
     /** The Window we're using. */
40 44
     private boolean windowClosing = false;
41 45
 
@@ -47,13 +51,17 @@ public abstract class DCCFrameContainer extends WritableFrameContainer {
47 51
      * @param configManager Config manager
48 52
      * @param parser Command parser to use for this window
49 53
      * @param messageSinkManager The sink manager to use to despatch messages.
54
+     * @param tabCompleterFactory The factory to use to create tab completers.
50 55
      * @param components The UI components that this frame requires
51 56
      */
52
-    public DCCFrameContainer(final String title, final String icon,
57
+    public DCCFrameContainer(
58
+            final String title, final String icon,
53 59
             final AggregateConfigProvider configManager, final CommandParser parser,
54 60
             final MessageSinkManager messageSinkManager,
61
+            final TabCompleterFactory tabCompleterFactory,
55 62
             final Collection<String> components) {
56 63
         super(icon, title, title, configManager, parser, messageSinkManager, components);
64
+        this.tabCompleterFactory = tabCompleterFactory;
57 65
     }
58 66
 
59 67
     /** {@inheritDoc} */
@@ -71,7 +79,7 @@ public abstract class DCCFrameContainer extends WritableFrameContainer {
71 79
     /** {@inheritDoc} */
72 80
     @Override
73 81
     public TabCompleter getTabCompleter() {
74
-        return new TabCompleter();
82
+        return tabCompleterFactory.getTabCompleter(getConfigManager());
75 83
     }
76 84
 
77 85
     /**
@@ -79,7 +87,7 @@ public abstract class DCCFrameContainer extends WritableFrameContainer {
79 87
      *
80 88
      * @return True if windowClosing has been called.
81 89
      */
82
-    public final boolean isWindowClosing() {
90
+    public boolean isWindowClosing() {
83 91
         return windowClosing;
84 92
     }
85 93
 

+ 9
- 2
src/com/dmdirc/addons/dcc/DCCManager.java ファイルの表示

@@ -51,6 +51,7 @@ import com.dmdirc.parser.interfaces.ClientInfo;
51 51
 import com.dmdirc.parser.interfaces.Parser;
52 52
 import com.dmdirc.plugins.PluginInfo;
53 53
 import com.dmdirc.ui.WindowManager;
54
+import com.dmdirc.ui.input.TabCompleterFactory;
54 55
 
55 56
 import java.io.File;
56 57
 import java.io.IOException;
@@ -88,6 +89,8 @@ public class DCCManager implements ActionListener {
88 89
     private final WindowManager windowManager;
89 90
     /** The command controller to use. */
90 91
     private final CommandController commandController;
92
+    /** The factory to use for tab completers. */
93
+    private final TabCompleterFactory tabCompleterFactory;
91 94
     /** The configuration domain to use. */
92 95
     @Getter
93 96
     private final String domain;
@@ -101,6 +104,7 @@ public class DCCManager implements ActionListener {
101 104
      * @param commandController Command controller to register commands
102 105
      * @param messageSinkManager The sink manager to use to despatch messages.
103 106
      * @param windowManager Window Management
107
+     * @param tabCompleterFactory The factory to use for tab completers.
104 108
      */
105 109
     @Inject
106 110
     public DCCManager(
@@ -109,12 +113,14 @@ public class DCCManager implements ActionListener {
109 113
             final IdentityController identityController,
110 114
             final CommandController commandController,
111 115
             final MessageSinkManager messageSinkManager,
112
-            final WindowManager windowManager) {
116
+            final WindowManager windowManager,
117
+            final TabCompleterFactory tabCompleterFactory) {
113 118
         this.identityController = identityController;
114 119
         this.controller = controller;
115 120
         this.messageSinkManager = messageSinkManager;
116 121
         this.windowManager = windowManager;
117 122
         this.commandController = commandController;
123
+        this.tabCompleterFactory = tabCompleterFactory;
118 124
         this.domain = pluginInfo.getDomain();
119 125
         config = controller.getGlobalConfig();
120 126
         this.pluginInfo = pluginInfo;
@@ -409,7 +415,8 @@ public class DCCManager implements ActionListener {
409 415
             final String myNickname = ((Server) arguments[0]).getParser()
410 416
                     .getLocalClient().getNickname();
411 417
             final DCCFrameContainer f = new ChatContainer(chat, config, commandController,
412
-                    "Chat: " + nickname, myNickname, nickname, messageSinkManager);
418
+                    "Chat: " + nickname, myNickname, nickname, tabCompleterFactory,
419
+                    messageSinkManager);
413 420
             windowManager.addWindow(getContainer(), f);
414 421
             f.addLine("DCCChatStarting", nickname, chat.getHost(),
415 422
                     chat.getPort());

+ 2
- 1
src/com/dmdirc/addons/ui_swing/dialogs/aliases/AliasPanel.java ファイルの表示

@@ -86,7 +86,8 @@ public class AliasPanel extends JPanel implements ActionListener {
86 86
         actionFactory = controller.getActionFactory();
87 87
 
88 88
         command = new ValidatingTextFieldInputField(controller,
89
-                new ValidatorChain<>(new CommandNameValidator(),
89
+                new ValidatorChain<>(
90
+                new CommandNameValidator(controller.getCommandController().getCommandChar()),
90 91
                 new FileNameValidator()));
91 92
         command.setEnabled(false);
92 93
         //new SwingInputHandler(command, GlobalCommandParser

読み込み中…
キャンセル
保存