diff --git a/platform/platform-resources/src/idea/Keymap_Default.xml b/platform/platform-resources/src/idea/Keymap_Default.xml index a843d5c6cf53..66d81bbbd679 100644 --- a/platform/platform-resources/src/idea/Keymap_Default.xml +++ b/platform/platform-resources/src/idea/Keymap_Default.xml @@ -689,10 +689,19 @@ + + + + + + + + + - + diff --git a/platform/platform-resources/src/idea/LangActions.xml b/platform/platform-resources/src/idea/LangActions.xml index dfba57cd93e1..1b76370488e4 100644 --- a/platform/platform-resources/src/idea/LangActions.xml +++ b/platform/platform-resources/src/idea/LangActions.xml @@ -712,25 +712,29 @@ - + - - + + - - + + - + diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java index 516b4468e99e..88595f071501 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java @@ -43,6 +43,7 @@ import com.intellij.xdebugger.impl.XDebugSessionImpl; import com.intellij.xdebugger.impl.actions.XDebuggerActions; import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl; import com.intellij.xdebugger.impl.frame.actions.XWatchesTreeActionBase; +import com.intellij.xdebugger.impl.ui.DebuggerUIUtil; import com.intellij.xdebugger.impl.ui.XDebugSessionData; import com.intellij.xdebugger.impl.ui.XDebugSessionTab; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree; @@ -80,19 +81,11 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget, XDebuggerTree tree = getTree(); createNewRootNode(null); - AnAction newWatchAction = actionManager.getAction(XDebuggerActions.XNEW_WATCH); - AnAction removeWatchAction = actionManager.getAction(XDebuggerActions.XREMOVE_WATCH); - AnAction copyAction = actionManager.getAction(XDebuggerActions.XCOPY_WATCH); - AnAction editWatchAction = actionManager.getAction(XDebuggerActions.XEDIT_WATCH); - newWatchAction.registerCustomShortcutSet(CommonShortcuts.INSERT, tree, myDisposables); - removeWatchAction.registerCustomShortcutSet(CommonShortcuts.getDelete(), tree, myDisposables); - - CustomShortcutSet f2Shortcut = new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)); - editWatchAction.registerCustomShortcutSet(f2Shortcut, tree, myDisposables); - - copyAction.registerCustomShortcutSet( - ActionManager.getInstance().getAction(IdeActions.ACTION_EDITOR_DUPLICATE).getShortcutSet(), tree, myDisposables); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XNEW_WATCH, tree, myDisposables); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XREMOVE_WATCH, tree, myDisposables); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XCOPY_WATCH, tree, myDisposables); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XEDIT_WATCH, tree, myDisposables); DnDManager.getInstance().registerTarget(this, tree); @@ -113,8 +106,9 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget, final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(getTree()).disableUpDownActions(); decorator.setAddAction(button -> executeAction(XDebuggerActions.XNEW_WATCH)); - decorator.setAddActionName(newWatchAction.getTemplatePresentation().getText()); + decorator.setAddActionName(actionManager.getAction(XDebuggerActions.XNEW_WATCH).getTemplatePresentation().getText()); + AnAction removeWatchAction = actionManager.getAction(XDebuggerActions.XREMOVE_WATCH); decorator.setRemoveAction(button -> executeAction(XDebuggerActions.XREMOVE_WATCH)); decorator.setRemoveActionName(removeWatchAction.getTemplatePresentation().getText()); @@ -122,7 +116,7 @@ public class XWatchesViewImpl extends XVariablesView implements DnDNativeTarget, removeWatchAction.update(e); return e.getPresentation().isEnabled(); }); - decorator.addExtraAction(AnActionButton.fromAction(copyAction)); + decorator.addExtraAction(AnActionButton.fromAction(actionManager.getAction(XDebuggerActions.XCOPY_WATCH))); decorator.addExtraAction( new ToggleActionButton(XDebuggerBundle.message("debugger.session.tab.show.watches.in.variables"), AllIcons.Debugger.Watches) { @Override diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java index ddd95fc54ace..4764e4047bc7 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/DebuggerUIUtil.java @@ -16,7 +16,9 @@ package com.intellij.xdebugger.impl.ui; import com.intellij.codeInsight.hint.HintUtil; +import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.ActionManager; +import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.LogicalPosition; @@ -370,6 +372,11 @@ public class DebuggerUIUtil { return true; } + public static void registerActionOnComponent(String name, JComponent component, Disposable parentDisposable) { + AnAction action = ActionManager.getInstance().getAction(name); + action.registerCustomShortcutSet(action.getShortcutSet(), component, parentDisposable); + } + public static void registerExtraHandleShortcuts(final ListPopupImpl popup, String... actionNames) { for (String name : actionNames) { KeyStroke stroke = KeymapUtil.getKeyStroke(ActionManager.getInstance().getAction(name).getShortcutSet()); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java index 08360d67d2aa..6c18386ed254 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XDebuggerTree.java @@ -350,16 +350,11 @@ public class XDebuggerTree extends DnDAwareTree implements DataProvider, Disposa } private void registerShortcuts() { - ActionManager actionManager = ActionManager.getInstance(); - actionManager.getAction(XDebuggerActions.SET_VALUE) - .registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)), this, this); - actionManager.getAction(XDebuggerActions.COPY_VALUE).registerCustomShortcutSet(CommonShortcuts.getCopy(), this, this); - actionManager.getAction(XDebuggerActions.JUMP_TO_SOURCE).registerCustomShortcutSet(CommonShortcuts.getEditSource(), this, this); - Shortcut[] editTypeShortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(XDebuggerActions.EDIT_TYPE_SOURCE); - actionManager.getAction(XDebuggerActions.JUMP_TO_TYPE_SOURCE).registerCustomShortcutSet( - new CustomShortcutSet(editTypeShortcuts), this, this); - actionManager.getAction(XDebuggerActions.MARK_OBJECT).registerCustomShortcutSet( - new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("ToggleBookmark")), this, this); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.SET_VALUE, this, this); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.COPY_VALUE, this, this); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.JUMP_TO_SOURCE, this, this); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.JUMP_TO_TYPE_SOURCE, this, this); + DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.MARK_OBJECT, this, this); } private static void markNodesObsolete(final XValueContainerNode node) {