mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
smart step into and set breakpoint popups extra shortcuts ad
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user