OSDN Git Service

Fix #32187: anyActionPerformed -> getActionMap().get(cmd).actionPerformed... t32187
authorargius <argius.net@gmail.com>
Mon, 2 Dec 2013 13:15:27 +0000 (22:15 +0900)
committerargius <argius.net@gmail.com>
Mon, 2 Dec 2013 13:15:27 +0000 (22:15 +0900)
src/net/argius/stew/ui/window/DatabaseInfoTree.java

index 7189470..8d2f8a1 100644 (file)
@@ -77,15 +77,10 @@ final class DatabaseInfoTree extends JTree implements AnyActionListener, TextSea
     public void anyActionPerformed(AnyActionEvent ev) {
         log.atEnter("anyActionPerformed", ev);
         if (ev.isAnyOf(copy)) {
-            Object src = ev.getSource();
-            if (src != null && src instanceof JMenuItem) {
-                KeyStroke k = ((JMenuItem)src).getAccelerator();
-                if (k != null) {
-                    ActionListener action = getActionForKeyStroke(k);
-                    if (action != null) {
-                        action.actionPerformed(new ActionEvent(this, 1001, ""));
-                    }
-                }
+            final String cmd = ev.getActionCommand();
+            Action action = getActionMap().get(cmd);
+            if (action != null) {
+                action.actionPerformed(new ActionEvent(this, 1001, cmd));
             }
         } else if (ev.isAnyOf(copySimpleName)) {
             copySimpleName();