smart step into and set breakpoint popups extra shortcuts ad

This commit is contained in:
Egor.Ushakov
2015-12-28 11:40:10 +03:00
parent f65bf12e13
commit 730c646012
4 changed files with 31 additions and 12 deletions
@@ -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();
@@ -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}
@@ -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);
@@ -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());
}
}