|
@@ -22,11 +22,12 @@
|
22
|
22
|
|
23
|
23
|
package com.dmdirc.addons.ui_swing;
|
24
|
24
|
|
25
|
|
-import com.dmdirc.actions.ActionManager;
|
26
|
|
-import com.dmdirc.actions.CoreActionType;
|
27
|
25
|
import com.dmdirc.addons.ui_swing.actions.CopyAction;
|
28
|
26
|
import com.dmdirc.addons.ui_swing.actions.CutAction;
|
29
|
27
|
import com.dmdirc.addons.ui_swing.actions.PasteAction;
|
|
28
|
+import com.dmdirc.events.ClientKeyPressedEvent;
|
|
29
|
+
|
|
30
|
+import com.google.common.eventbus.EventBus;
|
30
|
31
|
|
31
|
32
|
import java.awt.AWTEvent;
|
32
|
33
|
import java.awt.Component;
|
|
@@ -53,20 +54,17 @@ public class DMDircEventQueue extends EventQueue {
|
53
|
54
|
|
54
|
55
|
/** Swing Controller. */
|
55
|
56
|
private final SwingController controller;
|
|
57
|
+ /** Event bus to despatch events to. */
|
|
58
|
+ private final EventBus eventBus;
|
56
|
59
|
|
57
|
|
- /**
|
58
|
|
- * Instantiates the DMDircEventQueue.
|
59
|
|
- *
|
60
|
|
- * @param controller Swing controller
|
61
|
|
- */
|
62
|
60
|
@Inject
|
63
|
|
- public DMDircEventQueue(final SwingController controller) {
|
|
61
|
+ public DMDircEventQueue(final SwingController controller, final EventBus eventBus) {
|
64
|
62
|
super();
|
65
|
63
|
|
66
|
64
|
this.controller = controller;
|
|
65
|
+ this.eventBus = eventBus;
|
67
|
66
|
}
|
68
|
67
|
|
69
|
|
- /** {@inheritDoc} */
|
70
|
68
|
@Override
|
71
|
69
|
protected void dispatchEvent(final AWTEvent event) {
|
72
|
70
|
preDispatchEvent(event);
|
|
@@ -105,9 +103,8 @@ public class DMDircEventQueue extends EventQueue {
|
105
|
103
|
* @param ke Key event
|
106
|
104
|
*/
|
107
|
105
|
private void handleKeyEvent(final KeyEvent ke) {
|
108
|
|
- ActionManager.getActionManager().triggerEvent(
|
109
|
|
- CoreActionType.CLIENT_KEY_PRESSED, null,
|
110
|
|
- KeyStroke.getKeyStroke(ke.getKeyChar(), ke.getModifiers()));
|
|
106
|
+ eventBus.post(new ClientKeyPressedEvent(
|
|
107
|
+ KeyStroke.getKeyStroke(ke.getKeyChar(), ke.getModifiers())));
|
111
|
108
|
}
|
112
|
109
|
|
113
|
110
|
/**
|
|
@@ -154,7 +151,6 @@ public class DMDircEventQueue extends EventQueue {
|
154
|
151
|
}
|
155
|
152
|
}
|
156
|
153
|
|
157
|
|
- /** {@inheritDoc} */
|
158
|
154
|
@Override
|
159
|
155
|
public void pop() { //NOPMD
|
160
|
156
|
super.pop();
|