瀏覽代碼

Rewrite the entire UI to pass extra deps in.

Conflicts:
        src/com/dmdirc/addons/ui_swing/components/TopicBar.java
        src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java
        src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java
        src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelSettingsDialog.java
        src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicDisplayPane.java
        src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicPane.java
        src/com/dmdirc/addons/ui_swing/injection/DialogModule.java

Change-Id: Iec6278e7aa84c74fa8a6fea1af2d021f3835b241
Depends-On: Ib0cbe91bec51db7e66d860d65840e784f880e53d
Reviewed-on: http://gerrit.dmdirc.com/3391
Reviewed-by: Greg Holmes <greg@dmdirc.com>
Automatic-Compile: DMDirc Build Manager
changes/91/3391/4
Chris Smith 10 年之前
父節點
當前提交
25dce6a4d5

+ 5
- 1
src/com/dmdirc/addons/ui_swing/components/TopicBar.java 查看文件

@@ -33,6 +33,7 @@ import com.dmdirc.addons.ui_swing.components.frames.ChannelFrame;
33 33
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputHandler;
34 34
 import com.dmdirc.addons.ui_swing.components.inputfields.TextPaneInputField;
35 35
 import com.dmdirc.addons.ui_swing.components.text.WrapEditorKit;
36
+import com.dmdirc.interfaces.CommandController;
36 37
 import com.dmdirc.interfaces.TopicChangeListener;
37 38
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
38 39
 import com.dmdirc.interfaces.config.ConfigChangeListener;
@@ -118,6 +119,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
118 119
      * @param colourManager The colour manager to use for colour input.
119 120
      * @param pluginManager The plugin manager to use for plugin information.
120 121
      * @param clipboard     The clipboard to copy and paste from
122
+     * @param commandController The controller to use for command information.
121 123
      * @param channel       The channel that this topic bar is for.
122 124
      * @param window        The window this topic bar is for.
123 125
      * @param iconManager   The icon manager to use for this bar's icons.
@@ -129,6 +131,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
129 131
             final ColourManager colourManager,
130 132
             final PluginManager pluginManager,
131 133
             final Clipboard clipboard,
134
+            final CommandController commandController,
132 135
             @Unbound final Channel channel,
133 136
             @Unbound final ChannelFrame window,
134 137
             @Unbound final IconManager iconManager) {
@@ -155,7 +158,8 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
155 158
                 iconManager.getIcon("close-active"));
156 159
 
157 160
         final SwingInputHandler handler = new SwingInputHandler(
158
-                pluginManager, topicText, channel.getCommandParser(), channel);
161
+                pluginManager, topicText, commandController, channel.getCommandParser(),
162
+                channel, channel.getEventBus());
159 163
         handler.setTypes(true, false, true, false);
160 164
         handler.setTabCompleter(channel.getTabCompleter());
161 165
 

+ 11
- 2
src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java 查看文件

@@ -34,6 +34,7 @@ import com.dmdirc.addons.ui_swing.components.TypingLabel;
34 34
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputField;
35 35
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputHandler;
36 36
 import com.dmdirc.addons.ui_swing.dialogs.paste.PasteDialogFactory;
37
+import com.dmdirc.interfaces.CommandController;
37 38
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
38 39
 import com.dmdirc.interfaces.ui.InputWindow;
39 40
 import com.dmdirc.logger.ErrorLevel;
@@ -42,6 +43,8 @@ import com.dmdirc.plugins.PluginManager;
42 43
 import com.dmdirc.ui.input.InputHandler;
43 44
 import com.dmdirc.ui.messages.ColourManager;
44 45
 
46
+import com.google.common.eventbus.EventBus;
47
+
45 48
 import java.awt.BorderLayout;
46 49
 import java.awt.Point;
47 50
 import java.awt.Toolkit;
@@ -94,6 +97,10 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
94 97
     private final PasteDialogFactory pasteDialogFactory;
95 98
     /** Clipboard to use for copying and pasting. */
96 99
     private final Clipboard clipboard;
100
+    /** The controller to use to retrieve command information. */
101
+    private final CommandController commandController;
102
+    /** The bus to despatch input events on. */
103
+    private final EventBus eventBus;
97 104
 
98 105
     /**
99 106
      * Creates a new instance of InputFrame.
@@ -114,6 +121,8 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
114 121
         this.pluginManager = deps.pluginManager;
115 122
         this.pasteDialogFactory = deps.pasteDialog;
116 123
         this.clipboard = deps.clipboard;
124
+        this.commandController = deps.commandController;
125
+        this.eventBus = deps.eventBus;
117 126
 
118 127
         initComponents(inputFieldProvider);
119 128
 
@@ -156,8 +165,8 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow,
156 165
      */
157 166
     private void initComponents(final Provider<SwingInputField> inputFieldProvider) {
158 167
         inputField = inputFieldProvider.get();
159
-        inputHandler = new SwingInputHandler(pluginManager, inputField,
160
-                getContainer().getCommandParser(), getContainer());
168
+        inputHandler = new SwingInputHandler(pluginManager, inputField, commandController,
169
+                getContainer().getCommandParser(), getContainer(), eventBus);
161 170
         inputHandler.addValidationListener(inputField);
162 171
         inputHandler.setTabCompleter(((WritableFrameContainer) frameParent).
163 172
                 getTabCompleter());

+ 5
- 1
src/com/dmdirc/addons/ui_swing/components/frames/TextFrame.java 查看文件

@@ -55,6 +55,7 @@ import com.dmdirc.commandparser.parsers.CommandParser;
55 55
 import com.dmdirc.events.LinkChannelClickedEvent;
56 56
 import com.dmdirc.events.LinkNicknameClickedEvent;
57 57
 import com.dmdirc.events.LinkUrlClickedEvent;
58
+import com.dmdirc.interfaces.CommandController;
58 59
 import com.dmdirc.interfaces.FrameCloseListener;
59 60
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
60 61
 import com.dmdirc.interfaces.config.ConfigChangeListener;
@@ -545,6 +546,7 @@ public abstract class TextFrame extends JPanel implements Window,
545 546
         final IconManager iconManager;
546 547
         final ActiveFrameManager activeFrameManager;
547 548
         final Clipboard clipboard;
549
+        final CommandController commandController;
548 550
 
549 551
         @Inject
550 552
         public TextFrameDependencies(
@@ -558,7 +560,8 @@ public abstract class TextFrame extends JPanel implements Window,
558 560
                 @GlobalConfig final IconManager iconManager,
559 561
                 @GlobalConfig final AggregateConfigProvider globalConfig,
560 562
                 final ActiveFrameManager activeFrameManager,
561
-                final Clipboard clipboard) {
563
+                final Clipboard clipboard,
564
+                final CommandController commandController) {
562 565
             this.textPaneFactory = textPaneFactory;
563 566
             this.controller = controller;
564 567
             this.mainFrame = mainFrame;
@@ -570,6 +573,7 @@ public abstract class TextFrame extends JPanel implements Window,
570 573
             this.iconManager = iconManager;
571 574
             this.activeFrameManager = activeFrameManager;
572 575
             this.clipboard = clipboard;
576
+            this.commandController = commandController;
573 577
         }
574 578
 
575 579
     }

+ 13
- 6
src/com/dmdirc/addons/ui_swing/components/inputfields/SwingInputHandler.java 查看文件

@@ -27,12 +27,15 @@ import com.dmdirc.addons.ui_swing.Apple;
27 27
 import com.dmdirc.addons.ui_swing.UIUtilities;
28 28
 import com.dmdirc.addons.ui_swing.components.LoggingSwingWorker;
29 29
 import com.dmdirc.commandparser.parsers.CommandParser;
30
+import com.dmdirc.interfaces.CommandController;
30 31
 import com.dmdirc.interfaces.ui.InputField;
31 32
 import com.dmdirc.logger.ErrorLevel;
32 33
 import com.dmdirc.logger.Logger;
33 34
 import com.dmdirc.plugins.ServiceManager;
34 35
 import com.dmdirc.ui.input.InputHandler;
35 36
 
37
+import com.google.common.eventbus.EventBus;
38
+
36 39
 import java.awt.event.ActionEvent;
37 40
 import java.awt.event.KeyEvent;
38 41
 import java.awt.event.KeyListener;
@@ -51,17 +54,21 @@ public class SwingInputHandler extends InputHandler implements KeyListener {
51 54
     /**
52 55
      * Creates a new instance of InputHandler. Adds listeners to the target that we need to operate.
53 56
      *
54
-     * @param serviceManager Manager to use to look up tab completion services.
55
-     * @param target         The text field this input handler is dealing with.
56
-     * @param commandParser  The command parser to use for this text field.
57
-     * @param parentWindow   The window that owns this input handler
57
+     * @param serviceManager    Manager to use to look up tab completion services.
58
+     * @param target            The text field this input handler is dealing with.
59
+     * @param commandController The controller to use to retrieve command information.
60
+     * @param commandParser     The command parser to use for this text field.
61
+     * @param parentWindow      The window that owns this input handler
62
+     * @param eventBus          The event bus to use to despatch input events.
58 63
      */
59 64
     public SwingInputHandler(
60 65
             final ServiceManager serviceManager,
61 66
             final InputField target,
67
+            final CommandController commandController,
62 68
             final CommandParser commandParser,
63
-            final WritableFrameContainer parentWindow) {
64
-        super(serviceManager, target, commandParser, parentWindow);
69
+            final WritableFrameContainer parentWindow,
70
+            final EventBus eventBus) {
71
+        super(serviceManager, target, commandController, commandParser, parentWindow, eventBus);
65 72
     }
66 73
 
67 74
     @Override

+ 9
- 2
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelSettingsDialog.java 查看文件

@@ -31,6 +31,7 @@ import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
31 31
 import com.dmdirc.addons.ui_swing.components.modes.ChannelModesPane;
32 32
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
33 33
 import com.dmdirc.config.prefs.PreferencesManager;
34
+import com.dmdirc.interfaces.CommandController;
34 35
 import com.dmdirc.interfaces.config.ConfigProvider;
35 36
 import com.dmdirc.interfaces.config.IdentityFactory;
36 37
 import com.dmdirc.interfaces.ui.InputWindow;
@@ -82,6 +83,8 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
82 83
     private final PrefsComponentFactory compFactory;
83 84
     /** Clipboard to copy and paste from. */
84 85
     private final Clipboard clipboard;
86
+    /** The controller to use to retrieve command information. */
87
+    private final CommandController commandController;
85 88
 
86 89
     /**
87 90
      * Creates a new instance of ChannelSettingsDialog.
@@ -95,6 +98,7 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
95 98
      * @param channel            The channel object that we're editing settings for
96 99
      * @param parentWindow       Parent window
97 100
      * @param clipboard          Clipboard to copy and paste from
101
+     * @param commandController  The controller to use to retrieve command information.
98 102
      */
99 103
     public ChannelSettingsDialog(
100 104
             final IdentityFactory identityFactory,
@@ -105,7 +109,8 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
105 109
             final PrefsComponentFactory compFactory,
106 110
             final Channel channel,
107 111
             final MainFrame parentWindow,
108
-            final Clipboard clipboard) {
112
+            final Clipboard clipboard,
113
+            final CommandController commandController) {
109 114
         super(parentWindow, ModalityType.MODELESS);
110 115
 
111 116
         this.userConfig = checkNotNull(userConfig);
@@ -114,6 +119,7 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
114 119
         this.compFactory = checkNotNull(compFactory);
115 120
         this.channel = checkNotNull(channel);
116 121
         this.clipboard = clipboard;
122
+        this.commandController = checkNotNull(commandController);
117 123
 
118 124
         this.identity = identityFactory.createChannelConfig(channel.getConnection().getNetwork(),
119 125
                 channel.getChannelInfo().getName());
@@ -153,7 +159,8 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
153 159
 
154 160
     /** Initialises the Topic tab. */
155 161
     private void initTopicTab() {
156
-        topicModesPane = new TopicPane(channel, channel.getIconManager(), serviceManager,
162
+        topicModesPane = new TopicPane(channel, channel.getIconManager(),
163
+                commandController, serviceManager,
157 164
                 this, channelWindow, clipboard);
158 165
         tabbedPane.addTab("Topic", topicModesPane);
159 166
     }

+ 12
- 6
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicDisplayPane.java 查看文件

@@ -30,6 +30,7 @@ import com.dmdirc.addons.ui_swing.actions.TopicEnterAction;
30 30
 import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputHandler;
31 31
 import com.dmdirc.addons.ui_swing.components.inputfields.TextAreaInputField;
32 32
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
33
+import com.dmdirc.interfaces.CommandController;
33 34
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
34 35
 import com.dmdirc.interfaces.ui.InputWindow;
35 36
 import com.dmdirc.plugins.ServiceManager;
@@ -83,26 +84,30 @@ public class TopicDisplayPane extends JPanel implements DocumentListener {
83 84
      * @param parent         Parent channel settings dialog
84 85
      * @param channelWindow  Channel window
85 86
      * @param clipboard      Clipboard to copy and paste
87
+     * @param commandController The controller to use to retrieve command information.
86 88
      */
87 89
     public TopicDisplayPane(final Channel channel, final IconManager iconManager,
88 90
             final ServiceManager serviceManager, final ChannelSettingsDialog parent,
89
-            final InputWindow channelWindow, final Clipboard clipboard) {
91
+            final InputWindow channelWindow, final Clipboard clipboard,
92
+            final CommandController commandController) {
90 93
         this.clipboard = clipboard;
91 94
         this.channel = channel;
92 95
         this.parent = parent;
93 96
         topicLengthMax = channel.getConnection().getParser().getMaxTopicLength();
94 97
         this.channelWindow = channelWindow;
95 98
 
96
-        initComponents(iconManager, channel.getConfigManager(), serviceManager);
99
+        initComponents(iconManager, channel.getConfigManager(), serviceManager, commandController);
97 100
         addListeners();
98 101
         layoutComponents();
99 102
 
100 103
         setTopic(channel.getCurrentTopic());
101 104
     }
102 105
 
103
-    /** Initialises the components. */
104
-    private void initComponents(final IconManager iconManager,
105
-            final AggregateConfigProvider config, final ServiceManager serviceManager) {
106
+    private void initComponents(
107
+            final IconManager iconManager,
108
+            final AggregateConfigProvider config,
109
+            final ServiceManager serviceManager,
110
+            final CommandController commandController) {
106 111
         topicLengthLabel = new JLabel();
107 112
         topicText = new TextAreaInputField(iconManager, config, 100, 4);
108 113
         topicWho = new TextLabel();
@@ -113,7 +118,8 @@ public class TopicDisplayPane extends JPanel implements DocumentListener {
113 118
         topicText.setRows(5);
114 119
         topicText.setColumns(30);
115 120
         final SwingInputHandler handler = new SwingInputHandler(serviceManager, topicText,
116
-                channel.getCommandParser(), channelWindow.getContainer());
121
+                commandController, channel.getCommandParser(), channelWindow.getContainer(),
122
+                channel.getEventBus());
117 123
         handler.setTypes(true, false, true, false);
118 124
         handler.setTabCompleter(channel.getTabCompleter());
119 125
 

+ 9
- 10
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicPane.java 查看文件

@@ -24,6 +24,7 @@ package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
27
+import com.dmdirc.interfaces.CommandController;
27 28
 import com.dmdirc.interfaces.ui.InputWindow;
28 29
 import com.dmdirc.plugins.ServiceManager;
29 30
 import com.dmdirc.ui.IconManager;
@@ -59,12 +60,14 @@ public class TopicPane extends JPanel implements ActionListener {
59 60
      *
60 61
      * @param channel        Parent channel
61 62
      * @param iconManager    Icon manager
63
+     * @param commandController The controller to use to retrieve command information.
62 64
      * @param serviceManager Service manager
63 65
      * @param parent         Parent dialog
64 66
      * @param channelWindow  Channel window
65 67
      * @param clipboard      Clipboard to copy and paste with
66 68
      */
67 69
     public TopicPane(final Channel channel, final IconManager iconManager,
70
+            final CommandController commandController,
68 71
             final ServiceManager serviceManager, final ChannelSettingsDialog parent,
69 72
             final InputWindow channelWindow, final Clipboard clipboard) {
70 73
         super();
@@ -75,15 +78,10 @@ public class TopicPane extends JPanel implements ActionListener {
75 78
         this.channelWindow = channelWindow;
76 79
         this.clipboard = clipboard;
77 80
 
78
-        update(iconManager, serviceManager);
79
-    }
80
-
81
-    /** Updates the panel. */
82
-    private void update(final IconManager iconManager, final ServiceManager serviceManager) {
83 81
         setVisible(false);
84 82
 
85 83
         removeAll();
86
-        initTopicsPanel(iconManager, serviceManager);
84
+        initTopicsPanel(iconManager, serviceManager, commandController);
87 85
         layoutComponents();
88 86
 
89 87
         topicHistoryPane.addActionListener(this);
@@ -91,11 +89,12 @@ public class TopicPane extends JPanel implements ActionListener {
91 89
         setVisible(true);
92 90
     }
93 91
 
94
-    /** Initialises the topic panel. */
95
-    private void initTopicsPanel(final IconManager iconManager,
96
-            final ServiceManager serviceManager) {
92
+    private void initTopicsPanel(
93
+            final IconManager iconManager,
94
+            final ServiceManager serviceManager,
95
+            final CommandController commandController) {
97 96
         topicDisplayPane = new TopicDisplayPane(channel, iconManager, serviceManager, parent,
98
-                channelWindow, clipboard);
97
+                channelWindow, clipboard, commandController);
99 98
         topicHistoryPane = new TopicHistoryPane(channel);
100 99
     }
101 100
 

+ 22
- 8
src/com/dmdirc/addons/ui_swing/dialogs/paste/PasteDialog.java 查看文件

@@ -29,12 +29,15 @@ import com.dmdirc.addons.ui_swing.components.inputfields.SwingInputHandler;
29 29
 import com.dmdirc.addons.ui_swing.components.inputfields.TextAreaInputField;
30 30
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
31 31
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
32
+import com.dmdirc.interfaces.CommandController;
32 33
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
33 34
 import com.dmdirc.plugins.PluginManager;
34 35
 import com.dmdirc.ui.IconManager;
35 36
 import com.dmdirc.util.annotations.factory.Factory;
36 37
 import com.dmdirc.util.annotations.factory.Unbound;
37 38
 
39
+import com.google.common.eventbus.EventBus;
40
+
38 41
 import java.awt.Window;
39 42
 import java.awt.event.ActionEvent;
40 43
 import java.awt.event.ActionListener;
@@ -78,21 +81,29 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
78 81
     private final PluginManager pluginManager;
79 82
     /** Config to read settings from. */
80 83
     private final AggregateConfigProvider config;
84
+    /** The controller to use to retrieve command information. */
85
+    private final CommandController commandController;
86
+    /** The bus to despatch events on. */
87
+    private final EventBus eventBus;
81 88
 
82 89
     /**
83 90
      * Creates a new instance of PreferencesDialog.
84 91
      *
85
-     * @param iconManager   Icon manager to retrieve icons with
86
-     * @param config        Config to read settings from
87
-     * @param pluginManager to retrieve tab completers with
88
-     * @param newParent     The frame that owns this dialog
89
-     * @param text          text to show in the paste dialog
90
-     * @param parentWindow  Parent window
92
+     * @param iconManager       Icon manager to retrieve icons with
93
+     * @param config            Config to read settings from
94
+     * @param pluginManager     to retrieve tab completers with
95
+     * @param commandController The controller to use to retrieve command information.
96
+     * @param eventBus          The bus to despatch events on.
97
+     * @param newParent         The frame that owns this dialog
98
+     * @param text              text to show in the paste dialog
99
+     * @param parentWindow      Parent window
91 100
      */
92 101
     public PasteDialog(
93 102
             @SuppressWarnings("qualifiers") @GlobalConfig final IconManager iconManager,
94 103
             @SuppressWarnings("qualifiers") @GlobalConfig final AggregateConfigProvider config,
95 104
             final PluginManager pluginManager,
105
+            final CommandController commandController,
106
+            final EventBus eventBus,
96 107
             @Unbound final InputTextFrame newParent,
97 108
             @Unbound final String text,
98 109
             @Unbound final Window parentWindow) {
@@ -103,6 +114,8 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
103 114
         this.iconManager = iconManager;
104 115
         this.config = config;
105 116
         this.pluginManager = pluginManager;
117
+        this.commandController = commandController;
118
+        this.eventBus = eventBus;
106 119
 
107 120
         initComponents(text);
108 121
         initListeners();
@@ -142,8 +155,9 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
142 155
         textField.setColumns(50);
143 156
         textField.setRows(10);
144 157
 
145
-        new SwingInputHandler(pluginManager, textField, parent.getContainer().getCommandParser(),
146
-                parent.getContainer()).setTypes(false, false, true, false);
158
+        new SwingInputHandler(pluginManager, textField, commandController,
159
+                parent.getContainer().getCommandParser(),
160
+                parent.getContainer(), eventBus).setTypes(false, false, true, false);
147 161
 
148 162
         scrollPane.setViewportView(textField);
149 163
         scrollPane.setVisible(false);

+ 4
- 2
src/com/dmdirc/addons/ui_swing/injection/DialogModule.java 查看文件

@@ -43,6 +43,7 @@ import com.dmdirc.addons.ui_swing.dialogs.serversetting.ServerSettingsDialog;
43 43
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingRestartDialog;
44 44
 import com.dmdirc.addons.ui_swing.dialogs.updater.SwingUpdaterDialog;
45 45
 import com.dmdirc.config.prefs.PreferencesManager;
46
+import com.dmdirc.interfaces.CommandController;
46 47
 import com.dmdirc.interfaces.LifecycleController;
47 48
 import com.dmdirc.interfaces.config.ConfigProvider;
48 49
 import com.dmdirc.interfaces.config.IdentityFactory;
@@ -150,13 +151,14 @@ public class DialogModule {
150 151
             final PreferencesManager preferencesManager,
151 152
             final PrefsComponentFactory compFactory,
152 153
             final MainFrame parentWindow,
153
-            final Clipboard clipboard) {
154
+            final Clipboard clipboard,
155
+            final CommandController commandController) {
154 156
         return new KeyedDialogProvider<Channel, ChannelSettingsDialog>() {
155 157
             @Override
156 158
             protected ChannelSettingsDialog getInstance(final Channel key) {
157 159
                 return new ChannelSettingsDialog(identityFactory, windowFactory,
158 160
                         userConfig, serviceManager, preferencesManager,
159
-                        compFactory, key, parentWindow, clipboard);
161
+                        compFactory, key, parentWindow, clipboard, commandController);
160 162
             }
161 163
         };
162 164
     }

+ 21
- 0
src/com/dmdirc/addons/ui_web/WebInterfaceUI.java 查看文件

@@ -24,6 +24,7 @@ package com.dmdirc.addons.ui_web;
24 24
 
25 25
 import com.dmdirc.ServerManager;
26 26
 import com.dmdirc.addons.ui_web.uicomponents.WebStatusBar;
27
+import com.dmdirc.interfaces.CommandController;
27 28
 import com.dmdirc.interfaces.config.IdentityController;
28 29
 import com.dmdirc.interfaces.ui.UIController;
29 30
 import com.dmdirc.plugins.PluginDomain;
@@ -31,6 +32,8 @@ import com.dmdirc.plugins.PluginManager;
31 32
 import com.dmdirc.ui.WindowManager;
32 33
 import com.dmdirc.ui.core.components.StatusBarManager;
33 34
 
35
+import com.google.common.eventbus.EventBus;
36
+
34 37
 import javax.inject.Inject;
35 38
 
36 39
 import org.mortbay.jetty.Handler;
@@ -52,12 +55,18 @@ public class WebInterfaceUI implements UIController {
52 55
     private final DynamicRequestHandler handler;
53 56
     /** The plugin manager used to find other plugins. */
54 57
     private final PluginManager pluginManager;
58
+    /** The controller to use to retrieve command information. */
59
+    private final CommandController commandController;
60
+    /** The bus to despatch events on. */
61
+    private final EventBus eventBus;
55 62
 
56 63
     /**
57 64
      * Creates a new WebInterfaceUI belonging to the specified plugin.
58 65
      *
59 66
      * @param domain               The domain to retrieve config settings from
60 67
      * @param identityController   The controller to read/write settings with.
68
+     * @param commandController    The controller to use to retrieve command information.
69
+     * @param eventBus             The bus to despatch events on.
61 70
      * @param serverManager        The manager to use to find and create servers
62 71
      * @param pluginManager        The manager to use to find other plugins
63 72
      * @param coreWindowManager    Window management
@@ -68,6 +77,8 @@ public class WebInterfaceUI implements UIController {
68 77
     public WebInterfaceUI(
69 78
             @PluginDomain(WebInterfacePlugin.class) final String domain,
70 79
             final IdentityController identityController,
80
+            final CommandController commandController,
81
+            final EventBus eventBus,
71 82
             final ServerManager serverManager,
72 83
             final PluginManager pluginManager,
73 84
             final WindowManager coreWindowManager,
@@ -76,6 +87,8 @@ public class WebInterfaceUI implements UIController {
76 87
         super();
77 88
 
78 89
         this.pluginManager = pluginManager;
90
+        this.commandController = commandController;
91
+        this.eventBus = eventBus;
79 92
 
80 93
         final SecurityHandler sh = new SecurityHandler();
81 94
         final Constraint constraint = new Constraint();
@@ -124,6 +137,14 @@ public class WebInterfaceUI implements UIController {
124 137
         return pluginManager;
125 138
     }
126 139
 
140
+    public CommandController getCommandController() {
141
+        return commandController;
142
+    }
143
+
144
+    public EventBus getEventBus() {
145
+        return eventBus;
146
+    }
147
+
127 148
     /**
128 149
      * Adds the specified handler to the webserver.
129 150
      *

+ 9
- 4
src/com/dmdirc/addons/ui_web/uicomponents/WebInputHandler.java 查看文件

@@ -24,11 +24,14 @@ package com.dmdirc.addons.ui_web.uicomponents;
24 24
 
25 25
 import com.dmdirc.WritableFrameContainer;
26 26
 import com.dmdirc.commandparser.parsers.CommandParser;
27
+import com.dmdirc.interfaces.CommandController;
27 28
 import com.dmdirc.interfaces.ui.InputField;
28 29
 import com.dmdirc.plugins.ServiceManager;
29 30
 import com.dmdirc.ui.input.InputHandler;
30 31
 import com.dmdirc.ui.input.TabCompleter;
31 32
 
33
+import com.google.common.eventbus.EventBus;
34
+
32 35
 /**
33 36
  * An input handler for the web ui.
34 37
  */
@@ -36,10 +39,12 @@ public class WebInputHandler extends InputHandler {
36 39
 
37 40
     public WebInputHandler(
38 41
             final ServiceManager serviceManager,
39
-            final InputField thisTarget,
40
-            final CommandParser thisCommandParser,
41
-            final WritableFrameContainer thisParentWindow) {
42
-        super(serviceManager, thisTarget, thisCommandParser, thisParentWindow);
42
+            final InputField target,
43
+            final CommandController commandController,
44
+            final CommandParser commandParser,
45
+            final WritableFrameContainer parentWindow,
46
+            final EventBus eventBus) {
47
+        super(serviceManager, target, commandController, commandParser, parentWindow, eventBus);
43 48
     }
44 49
 
45 50
     public InputField getTarget() {

+ 5
- 2
src/com/dmdirc/addons/ui_web/uicomponents/WebInputWindow.java 查看文件

@@ -50,9 +50,11 @@ public class WebInputWindow extends WebWindow implements InputWindow {
50 50
         this.commandparser = parent.getCommandParser();
51 51
         this.controller = controller;
52 52
         this.inputHandler = new WebInputHandler(controller.getPluginManager(),
53
-                new WebInputField(), commandparser, getContainer());
53
+                new WebInputField(), controller.getCommandController(),
54
+                commandparser, getContainer(), controller.getEventBus());
54 55
     }
55 56
 
57
+    @Override
56 58
     public WritableFrameContainer getContainer() {
57 59
         return container;
58 60
     }
@@ -66,7 +68,8 @@ public class WebInputWindow extends WebWindow implements InputWindow {
66 68
         if (!inputHandlers.containsKey(client)) {
67 69
             final WebInputHandler ih = new WebInputHandler(
68 70
                     controller.getPluginManager(), new WebInputField(client),
69
-                    commandparser, getContainer());
71
+                    controller.getCommandController(),
72
+                    commandparser, getContainer(), controller.getEventBus());
70 73
             ih.setTabCompleter(inputHandler.getTabCompleter());
71 74
             inputHandlers.put(client, ih);
72 75
         }

Loading…
取消
儲存