From 730c646012d6377d5dc61a7e642e85e4560b4441 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Mon, 28 Dec 2015 11:35:33 +0300 Subject: [PATCH] smart step into and set breakpoint popups extra shortcuts ad --- .../actions/JvmSmartStepIntoHandler.java | 5 +-- .../src/messages/XDebuggerBundle.properties | 2 ++ .../xdebugger/impl/XDebuggerUtilImpl.java | 2 ++ .../xdebugger/impl/ui/DebuggerUIUtil.java | 34 +++++++++++++------ 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java b/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java index 41d4368ff66e..4985cd6eef8c 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/JvmSmartStepIntoHandler.java @@ -73,8 +73,9 @@ public abstract class JvmSmartStepIntoHandler { } }); ListPopupImpl popup = new ListPopupImpl(popupStep); - DebuggerUIUtil.registerExtraHandleShortcuts(popup, XDebuggerActions.STEP_INTO); - DebuggerUIUtil.registerExtraHandleShortcuts(popup, XDebuggerActions.SMART_STEP_INTO); + DebuggerUIUtil.registerExtraHandleShortcuts(popup, XDebuggerActions.STEP_INTO, XDebuggerActions.SMART_STEP_INTO); + popup.setAdText(DebuggerUIUtil.getSelectionShortcutsAdText(XDebuggerActions.STEP_INTO, XDebuggerActions.SMART_STEP_INTO)); + popup.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { popupStep.getScopeHighlighter().dropHighlight(); diff --git a/platform/platform-resources-en/src/messages/XDebuggerBundle.properties b/platform/platform-resources-en/src/messages/XDebuggerBundle.properties index ca129821f44e..a02870baed79 100644 --- a/platform/platform-resources-en/src/messages/XDebuggerBundle.properties +++ b/platform/platform-resources-en/src/messages/XDebuggerBundle.properties @@ -138,3 +138,5 @@ settings.show.value.tooltip=Show value tooltip. settings.show.tooltip.on.selection=Show value tooltip on code selection settings.scroll.to.center=Scroll execution point to center settings.tooltip.label=If disabled, use "{0}" to show/hide tooltips + +ad.extra.selection.shortcut=You can also choose an item with: {0} diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java index 9915c1b3e862..6df5ffa8efa6 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java @@ -247,6 +247,8 @@ public class XDebuggerUtilImpl extends XDebuggerUtil { } }); DebuggerUIUtil.registerExtraHandleShortcuts(popup, IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT); + popup.setAdText(DebuggerUIUtil.getSelectionShortcutsAdText(IdeActions.ACTION_TOGGLE_LINE_BREAKPOINT)); + popup.addListSelectionListener(selectionListener); popup.show(relativePoint); result.setResult(res); 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 c5e79244a3eb..3b876ecd65ed 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 @@ -35,6 +35,7 @@ import com.intellij.ui.EditorTextField; import com.intellij.ui.ScreenUtil; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.popup.list.ListPopupImpl; +import com.intellij.xdebugger.XDebuggerBundle; import com.intellij.xdebugger.XDebuggerManager; import com.intellij.xdebugger.XExpression; import com.intellij.xdebugger.breakpoints.XBreakpoint; @@ -400,16 +401,29 @@ public class DebuggerUIUtil { return true; } - public static void registerExtraHandleShortcuts(final ListPopupImpl popup, String actionName) { - AnAction action = ActionManager.getInstance().getAction(actionName); - KeyStroke stroke = KeymapUtil.getKeyStroke(action.getShortcutSet()); - if (stroke != null) { - popup.registerAction("handleSelection " + stroke, stroke, new AbstractAction() { - @Override - public void actionPerformed(ActionEvent e) { - popup.handleSelect(true); - } - }); + public static void registerExtraHandleShortcuts(final ListPopupImpl popup, String... actionNames) { + for (String name : actionNames) { + KeyStroke stroke = KeymapUtil.getKeyStroke(ActionManager.getInstance().getAction(name).getShortcutSet()); + if (stroke != null) { + popup.registerAction("handleSelection " + stroke, stroke, new AbstractAction() { + @Override + public void actionPerformed(ActionEvent e) { + popup.handleSelect(true); + } + }); + } } } + + public static String getSelectionShortcutsAdText(String... actionNames) { + StringBuilder res = new StringBuilder(); + for (String name : actionNames) { + KeyStroke stroke = KeymapUtil.getKeyStroke(ActionManager.getInstance().getAction(name).getShortcutSet()); + if (stroke != null) { + if (res.length() > 0) res.append(", "); + res.append(KeymapUtil.getKeystrokeText(stroke)); + } + } + return XDebuggerBundle.message("ad.extra.selection.shortcut", res.toString()); + } }