From 7c2383c749920410abd659aa2b523a9b70993451 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 16 Mar 2011 14:55:23 +0300 Subject: [PATCH] fixed 'add new watch' shortcut on Mac (IDEA-64654) --- .../com/intellij/debugger/ui/impl/MainWatchPanel.java | 9 +++------ .../com/intellij/xdebugger/impl/frame/XWatchesView.java | 8 +++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java index 03ffd3c689c7..08a719fdd627 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/MainWatchPanel.java @@ -53,19 +53,16 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; public class MainWatchPanel extends WatchPanel implements DataProvider { - private final KeyStroke myRemoveWatchAccelerator = KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0); - private final KeyStroke myNewWatchAccelerator = KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0); - private final KeyStroke myEditWatchAccelerator = KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0); public MainWatchPanel(Project project, DebuggerStateManager stateManager) { super(project,stateManager); final WatchDebuggerTree watchTree = getWatchTree(); final AnAction removeWatchesAction = ActionManager.getInstance().getAction(DebuggerActions.REMOVE_WATCH); - removeWatchesAction.registerCustomShortcutSet(new CustomShortcutSet(myRemoveWatchAccelerator), watchTree); + removeWatchesAction.registerCustomShortcutSet(CommonShortcuts.DELETE, watchTree); final AnAction newWatchAction = ActionManager.getInstance().getAction(DebuggerActions.NEW_WATCH); - newWatchAction.registerCustomShortcutSet(new CustomShortcutSet(myNewWatchAccelerator), watchTree); + newWatchAction.registerCustomShortcutSet(CommonShortcuts.INSERT, watchTree); final MouseAdapter mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { @@ -82,7 +79,7 @@ public class MainWatchPanel extends WatchPanel implements DataProvider { ListenerUtil.addMouseListener(watchTree, mouseListener); final AnAction editWatchAction = ActionManager.getInstance().getAction(DebuggerActions.EDIT_WATCH); - editWatchAction.registerCustomShortcutSet(new CustomShortcutSet(myEditWatchAccelerator), watchTree); + editWatchAction.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), watchTree); registerDisposable(new Disposable() { public void dispose() { ListenerUtil.removeMouseListener(watchTree, mouseListener); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesView.java index c5a536566bd7..c2189a4ced9f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesView.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesView.java @@ -20,6 +20,7 @@ import com.intellij.ide.dnd.DnDManager; import com.intellij.ide.dnd.DnDNativeTarget; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionManager; +import com.intellij.openapi.actionSystem.CommonShortcuts; import com.intellij.openapi.actionSystem.CustomShortcutSet; import com.intellij.util.ArrayUtil; import com.intellij.util.ui.tree.TreeUtil; @@ -64,12 +65,9 @@ public class XWatchesView extends XDebugViewBase implements DnDNativeTarget { ActionManager actionManager = ActionManager.getInstance(); - CustomShortcutSet insertShortcut = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_INSERT, 0)); XDebuggerTree tree = myTreePanel.getTree(); - actionManager.getAction(XDebuggerActions.XNEW_WATCH).registerCustomShortcutSet(insertShortcut, tree); - - CustomShortcutSet deleteShortcut = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0)); - actionManager.getAction(XDebuggerActions.XREMOVE_WATCH).registerCustomShortcutSet(deleteShortcut, tree); + actionManager.getAction(XDebuggerActions.XNEW_WATCH).registerCustomShortcutSet(CommonShortcuts.INSERT, tree); + actionManager.getAction(XDebuggerActions.XREMOVE_WATCH).registerCustomShortcutSet(CommonShortcuts.DELETE, tree); CustomShortcutSet f2Shortcut = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)); actionManager.getAction(XDebuggerActions.XEDIT_WATCH).registerCustomShortcutSet(f2Shortcut, tree);