Parcourir la source

Recompile a few more times and fix errant EventBouses

pull/423/head
Greg Holmes il y a 9 ans
Parent
révision
195986e694

+ 3
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/UIUtilities.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.components.DMDircUndoableEditListener;
27 26
 import com.dmdirc.addons.ui_swing.components.RunnableLoggingSwingWorker;
28 27
 import com.dmdirc.addons.ui_swing.components.RunnableSwingWorker;
@@ -91,10 +90,9 @@ public final class UIUtilities {
91 90
     /**
92 91
      * Adds an undo manager and associated key bindings to the specified text component.
93 92
      *
94
-     * @param eventBus  The event bus to post errors to
95 93
      * @param component The text component to add an undo manager to
96 94
      */
97
-    public static void addUndoManager(final DMDircMBassador eventBus, final JTextComponent component) {
95
+    public static void addUndoManager(final JTextComponent component) {
98 96
         final UndoManager undoManager = new UndoManager();
99 97
 
100 98
         // Listen for undo and redo events
@@ -102,13 +100,13 @@ public final class UIUtilities {
102 100
                 new DMDircUndoableEditListener(undoManager));
103 101
 
104 102
         // Create an undo action and add it to the text component
105
-        component.getActionMap().put("Undo", new UndoAction(eventBus, undoManager));
103
+        component.getActionMap().put("Undo", new UndoAction(undoManager));
106 104
 
107 105
         // Bind the undo action to ctl-Z
108 106
         component.getInputMap().put(KeyStroke.getKeyStroke("control Z"), "Undo");
109 107
 
110 108
         // Create a redo action and add it to the text component
111
-        component.getActionMap().put("Redo", new RedoAction(eventBus, undoManager));
109
+        component.getActionMap().put("Redo", new RedoAction(undoManager));
112 110
 
113 111
         // Bind the redo action to ctl-Y
114 112
         component.getInputMap().put(KeyStroke.getKeyStroke("control Y"), "Redo");

+ 2
- 4
ui_swing/src/com/dmdirc/addons/ui_swing/components/TopicBar.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.Topic;
27 26
 import com.dmdirc.addons.ui_swing.EdtHandlerInvocation;
28 27
 import com.dmdirc.addons.ui_swing.UIUtilities;
@@ -136,8 +135,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
136 135
             final GroupChat channel,
137 136
             final ChannelFrame window,
138 137
             final IconManager iconManager,
139
-            final TabCompleterUtils tabCompleterUtils,
140
-            final DMDircMBassador eventBus) {
138
+            final TabCompleterUtils tabCompleterUtils) {
141 139
         this.channel = channel;
142 140
         this.domain = domain;
143 141
         this.colourManager = colourManager;
@@ -151,7 +149,7 @@ public class TopicBar extends JComponent implements ActionListener, ConfigChange
151 149
                 new NewlinesDocumentFilter());
152 150
 
153 151
         topicText.getActionMap().put("paste-from-clipboard",
154
-                new ReplacePasteAction(eventBus, clipboard, "(\r\n|\n|\r)", " "));
152
+                new ReplacePasteAction(clipboard, "(\r\n|\n|\r)", " "));
155 153
         topicEdit = new ImageButton<>("edit",
156 154
                 iconManager.getIcon("edit-inactive"),
157 155
                 iconManager.getIcon("edit"));

+ 1
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/components/TopicBarFactory.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.SwingController;
27 26
 import com.dmdirc.addons.ui_swing.components.frames.ChannelFrame;
28 27
 import com.dmdirc.addons.ui_swing.injection.MainWindow;
@@ -56,7 +55,6 @@ public class TopicBarFactory {
56 55
     private final ServiceManager serviceManager;
57 56
     private final Clipboard clipboard;
58 57
     private final CommandController commandController;
59
-    private final DMDircMBassador eventBus;
60 58
     private final TabCompleterUtils tabCompleterUtils;
61 59
     private final IconManager iconManager;
62 60
 
@@ -69,7 +67,6 @@ public class TopicBarFactory {
69 67
             final ServiceManager serviceManager,
70 68
             final Clipboard clipboard,
71 69
             final CommandController commandController,
72
-            final DMDircMBassador eventBus,
73 70
             final TabCompleterUtils tabCompleterUtils,
74 71
             final IconManager iconManager) {
75 72
         this.parentWindow = parentWindow;
@@ -79,7 +76,6 @@ public class TopicBarFactory {
79 76
         this.serviceManager = serviceManager;
80 77
         this.clipboard = clipboard;
81 78
         this.commandController = commandController;
82
-        this.eventBus = eventBus;
83 79
         this.tabCompleterUtils = tabCompleterUtils;
84 80
         this.iconManager = iconManager;
85 81
     }
@@ -90,7 +86,7 @@ public class TopicBarFactory {
90 86
         return new TopicBar(parentWindow.get(), globalConfig, domain,
91 87
                 colourManagerFactory.getColourManager(channel.getWindowModel().getConfigManager()),
92 88
                 serviceManager, clipboard, commandController, channel, window, iconManager,
93
-                tabCompleterUtils, eventBus);
89
+                tabCompleterUtils);
94 90
     }
95 91
 
96 92
 }

+ 1
- 1
ui_swing/src/com/dmdirc/addons/ui_swing/components/frames/InputTextFrame.java Voir le fichier

@@ -172,7 +172,7 @@ public abstract class InputTextFrame extends TextFrame implements InputWindow, M
172 172
      * Initialises the input field.
173 173
      */
174 174
     private void initInputField() {
175
-        UIUtilities.addUndoManager(eventBus, getInputField().getTextField());
175
+        UIUtilities.addUndoManager(getInputField().getTextField());
176 176
 
177 177
         getInputField().getActionMap().put("paste", inputTextFramePasteActionFactory
178 178
                 .getInputTextFramePasteAction(this, inputField, getContainer()));

+ 2
- 5
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/aliases/AliasManagerDialog.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.aliases;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
27 26
 import com.dmdirc.addons.ui_swing.components.IconManager;
28 27
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
@@ -55,7 +54,6 @@ public class AliasManagerDialog extends StandardDialog {
55 54
     private static final long serialVersionUID = 1;
56 55
     private final AliasDialogModel model;
57 56
     private final IconManager iconManager;
58
-    private final DMDircMBassador eventBus;
59 57
     private JList<Alias> aliasList;
60 58
     private JTextField command;
61 59
     private JSpinner argumentsNumber;
@@ -66,11 +64,10 @@ public class AliasManagerDialog extends StandardDialog {
66 64
 
67 65
     @Inject
68 66
     public AliasManagerDialog(@MainWindow final Window mainFrame, final AliasDialogModel model,
69
-            final IconManager iconManager, final DMDircMBassador eventBus) {
67
+            final IconManager iconManager) {
70 68
         super(mainFrame, ModalityType.DOCUMENT_MODAL);
71 69
         this.model = model;
72 70
         this.iconManager = iconManager;
73
-        this.eventBus = eventBus;
74 71
         initComponents();
75 72
         layoutComponents();
76 73
     }
@@ -78,7 +75,7 @@ public class AliasManagerDialog extends StandardDialog {
78 75
     @Override
79 76
     public void display() {
80 77
         final AliasManagerLinker linker = new AliasManagerLinker(model, this, iconManager);
81
-        UIUtilities.addUndoManager(eventBus, response);
78
+        UIUtilities.addUndoManager(response);
82 79
         linker.bindCommandList(aliasList);
83 80
         linker.bindCommand(command);
84 81
         linker.bindArgumentsNumber(argumentsNumber);

+ 3
- 8
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelSettingsDialog.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.addons.ui_swing.PrefsComponentFactory;
27 26
 import com.dmdirc.addons.ui_swing.SwingWindowFactory;
28 27
 import com.dmdirc.addons.ui_swing.UIUtilities;
@@ -48,6 +47,7 @@ import java.awt.event.ActionListener;
48 47
 import javax.swing.JButton;
49 48
 import javax.swing.JScrollPane;
50 49
 import javax.swing.JTabbedPane;
50
+import javax.swing.ScrollPaneConstants;
51 51
 import javax.swing.WindowConstants;
52 52
 
53 53
 import net.miginfocom.swing.MigLayout;
@@ -90,8 +90,6 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
90 90
     private final Clipboard clipboard;
91 91
     /** The controller to use to retrieve command information. */
92 92
     private final CommandController commandController;
93
-    /** The event bus to post errors to. */
94
-    private final DMDircMBassador eventBus;
95 93
     /** Colour manager factory. */
96 94
     private final ColourManagerFactory colourManagerFactory;
97 95
 
@@ -108,7 +106,6 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
108 106
      * @param parentWindow       Parent window
109 107
      * @param clipboard          Clipboard to copy and paste from
110 108
      * @param commandController  The controller to use to retrieve command information.
111
-     * @param eventBus           The event bus to post errors to.
112 109
      */
113 110
     public ChannelSettingsDialog(
114 111
             final IdentityFactory identityFactory,
@@ -121,7 +118,6 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
121 118
             final Window parentWindow,
122 119
             final Clipboard clipboard,
123 120
             final CommandController commandController,
124
-            final DMDircMBassador eventBus,
125 121
             final ColourManagerFactory colourManagerFactory,
126 122
             final TabCompleterUtils tabCompleterUtils,
127 123
             final IconManager iconManager) {
@@ -134,7 +130,6 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
134 130
         this.channel = checkNotNull(groupChat);
135 131
         this.clipboard = clipboard;
136 132
         this.commandController = checkNotNull(commandController);
137
-        this.eventBus = eventBus;
138 133
         this.colourManagerFactory = colourManagerFactory;
139 134
         this.iconManager = iconManager;
140 135
 
@@ -178,7 +173,7 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
178 173
     private void initTopicTab(final TabCompleterUtils tabCompleterUtils) {
179 174
         topicModesPane = new TopicPane(channel, iconManager,
180 175
                 commandController, serviceManager,
181
-                this, channelWindow, clipboard, eventBus, colourManagerFactory, tabCompleterUtils);
176
+                this, channelWindow, clipboard, colourManagerFactory, tabCompleterUtils);
182 177
         tabbedPane.addTab("Topic", topicModesPane);
183 178
     }
184 179
 
@@ -187,7 +182,7 @@ public class ChannelSettingsDialog extends StandardDialog implements ActionListe
187 182
         channelModesPane = new ChannelModesPane(channel, iconManager);
188 183
 
189 184
         final JScrollPane channelModesSP = new JScrollPane(channelModesPane);
190
-        channelModesSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
185
+        channelModesSP.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
191 186
         channelModesSP.setOpaque(UIUtilities.getTabbedPaneOpaque());
192 187
         channelModesSP.getViewport().setOpaque(UIUtilities.getTabbedPaneOpaque());
193 188
         channelModesSP.setBorder(null);

+ 3
- 8
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicDisplayPane.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.Topic;
27 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
28 27
 import com.dmdirc.addons.ui_swing.actions.ReplacePasteAction;
@@ -71,8 +70,6 @@ public class TopicDisplayPane extends JPanel implements DocumentListener {
71 70
     private final int topicLengthMax;
72 71
     /** Clipboard to copy and paste from. */
73 72
     private final Clipboard clipboard;
74
-    /** The event bus to post errors to. */
75
-    private final DMDircMBassador eventBus;
76 73
     /** label showing the number of characters left in a topic. */
77 74
     private JLabel topicLengthLabel;
78 75
     /** Topic text entry text area. */
@@ -91,12 +88,11 @@ public class TopicDisplayPane extends JPanel implements DocumentListener {
91 88
      * @param channelWindow     Channel window
92 89
      * @param clipboard         Clipboard to copy and paste
93 90
      * @param commandController The controller to use to retrieve command information.
94
-     * @param eventBus          The event bus to post errors to.
95 91
      */
96 92
     public TopicDisplayPane(final GroupChat groupChat, final IconManager iconManager,
97 93
             final ServiceManager serviceManager, final ChannelSettingsDialog parent,
98 94
             final InputWindow channelWindow, final Clipboard clipboard,
99
-            final CommandController commandController, final DMDircMBassador eventBus,
95
+            final CommandController commandController,
100 96
             final ColourManagerFactory colourManagerFactory,
101 97
             final TabCompleterUtils tabCompleterUtils) {
102 98
         this.clipboard = clipboard;
@@ -104,7 +100,6 @@ public class TopicDisplayPane extends JPanel implements DocumentListener {
104 100
         this.parent = parent;
105 101
         topicLengthMax = groupChat.getConnection().get().getParser().get().getMaxTopicLength();
106 102
         this.channelWindow = channelWindow;
107
-        this.eventBus = eventBus;
108 103
 
109 104
         initComponents(iconManager, groupChat.getWindowModel().getConfigManager(), serviceManager,
110 105
                 commandController, colourManagerFactory, tabCompleterUtils);
@@ -137,13 +132,13 @@ public class TopicDisplayPane extends JPanel implements DocumentListener {
137 132
         handler.setTabCompleter(groupChat.getWindowModel().getTabCompleter());
138 133
 
139 134
         topicText.getActionMap().put("paste-from-clipboard",
140
-                new ReplacePasteAction(eventBus, clipboard, "(\r\n|\n|\r)", " "));
135
+                new ReplacePasteAction(clipboard, "(\r\n|\n|\r)", " "));
141 136
         topicText.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
142 137
                 0), new TopicEnterAction(parent));
143 138
         topicText.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
144 139
                 UIUtilities.getCtrlDownMask()), new TopicEnterAction(parent));
145 140
 
146
-        UIUtilities.addUndoManager(eventBus, topicText);
141
+        UIUtilities.addUndoManager(topicText);
147 142
     }
148 143
 
149 144
     /** Adds listeners to the components. */

+ 3
- 7
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/TopicPane.java Voir le fichier

@@ -22,7 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.dialogs.channelsetting;
24 24
 
25
-import com.dmdirc.DMDircMBassador;
26 25
 import com.dmdirc.Topic;
27 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
28 27
 import com.dmdirc.addons.ui_swing.components.IconManager;
@@ -70,13 +69,11 @@ public class TopicPane extends JPanel implements ActionListener {
70 69
      * @param parent            Parent dialog
71 70
      * @param channelWindow     Channel window
72 71
      * @param clipboard         Clipboard to copy and paste with
73
-     * @param eventBus          The event bus to post errors to
74 72
      */
75 73
     public TopicPane(final GroupChat groupChat, final IconManager iconManager,
76 74
             final CommandController commandController,
77 75
             final ServiceManager serviceManager, final ChannelSettingsDialog parent,
78 76
             final InputWindow channelWindow, final Clipboard clipboard,
79
-            final DMDircMBassador eventBus,
80 77
             final ColourManagerFactory colourManagerFactory,
81 78
             final TabCompleterUtils tabCompleterUtils) {
82 79
         setOpaque(UIUtilities.getTabbedPaneOpaque());
@@ -88,8 +85,8 @@ public class TopicPane extends JPanel implements ActionListener {
88 85
         setVisible(false);
89 86
 
90 87
         removeAll();
91
-        initTopicsPanel(iconManager, serviceManager, commandController, eventBus,
92
-                colourManagerFactory, tabCompleterUtils);
88
+        initTopicsPanel(iconManager, serviceManager, commandController, colourManagerFactory,
89
+                tabCompleterUtils);
93 90
         layoutComponents();
94 91
 
95 92
         topicHistoryPane.addActionListener(this);
@@ -101,11 +98,10 @@ public class TopicPane extends JPanel implements ActionListener {
101 98
             final IconManager iconManager,
102 99
             final ServiceManager serviceManager,
103 100
             final CommandController commandController,
104
-            final DMDircMBassador eventBus,
105 101
             final ColourManagerFactory colourManagerFactory,
106 102
             final TabCompleterUtils tabCompleterUtils) {
107 103
         topicDisplayPane = new TopicDisplayPane(groupChat, iconManager, serviceManager, parent,
108
-                channelWindow, clipboard, commandController, eventBus, colourManagerFactory,
104
+                channelWindow, clipboard, commandController, colourManagerFactory,
109 105
                 tabCompleterUtils);
110 106
         topicHistoryPane = new TopicHistoryPane(groupChat);
111 107
     }

+ 1
- 1
ui_swing/src/com/dmdirc/addons/ui_swing/dialogs/paste/PasteDialog.java Voir le fichier

@@ -137,7 +137,7 @@ public final class PasteDialog extends StandardDialog implements ActionListener,
137 137
         editButton = new JButton("Edit");
138 138
         infoLabel = new TextLabel();
139 139
 
140
-        UIUtilities.addUndoManager(eventBus, textField);
140
+        UIUtilities.addUndoManager(textField);
141 141
 
142 142
         orderButtons(new JButton(), new JButton());
143 143
         getOkButton().setText("Send");

+ 2
- 2
ui_swing/src/com/dmdirc/addons/ui_swing/injection/DialogModule.java Voir le fichier

@@ -222,8 +222,8 @@ public class DialogModule {
222 222
             protected ChannelSettingsDialog getInstance(final GroupChat key) {
223 223
                 return new ChannelSettingsDialog(identityFactory, windowFactory,
224 224
                         userConfig, serviceManager, preferencesManager, compFactory, key,
225
-                        parentWindow, clipboard, commandController, eventBus,
226
-                        colourManagerFactory, tabCompleterUtils, iconManager);
225
+                        parentWindow, clipboard, commandController, colourManagerFactory,
226
+                        tabCompleterUtils, iconManager);
227 227
             }
228 228
         };
229 229
     }

Chargement…
Annuler
Enregistrer