allow to use step into and smart step into shortcuts to select smart step into target

This commit is contained in:
Egor.Ushakov
2014-01-28 21:01:21 +04:00
parent 09846dcdee
commit 69b71e77e6
3 changed files with 32 additions and 2 deletions
+1
View File
@@ -18,6 +18,7 @@
<orderEntry type="module" module-name="java-runtime" />
<orderEntry type="module" module-name="jsp-openapi" />
<orderEntry type="module" module-name="java-impl" />
<orderEntry type="module" module-name="platform-impl" />
</component>
<component name="copyright">
<Base>
@@ -21,21 +21,28 @@ import com.intellij.debugger.engine.BasicStepMethodFilter;
import com.intellij.debugger.engine.LambdaMethodFilter;
import com.intellij.debugger.engine.MethodFilter;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.ShortcutSet;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.fileEditor.TextEditor;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.keymap.KeymapUtil;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.ui.awt.RelativePoint;
import com.intellij.ui.components.JBList;
import com.intellij.ui.popup.list.ListPopupImpl;
import com.intellij.xdebugger.impl.actions.XDebuggerActions;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.event.ActionEvent;
import java.util.Arrays;
import java.util.List;
@@ -72,7 +79,28 @@ public abstract class JvmSmartStepIntoHandler {
session.stepInto(true, createMethodFilter(chosenTarget));
}
});
final ListPopup popup = JBPopupFactory.getInstance().createListPopup(popupStep);
final ListPopup popup = new ListPopupImpl(popupStep) {
@Override
protected JComponent createContent() {
final AnAction stepIntoAction = ActionManager.getInstance().getAction(XDebuggerActions.STEP_INTO);
registerExtraHandleShortcuts(stepIntoAction.getShortcutSet());
final AnAction smartStepIntoAction = ActionManager.getInstance().getAction(XDebuggerActions.SMART_STEP_INTO);
registerExtraHandleShortcuts(smartStepIntoAction.getShortcutSet());
return super.createContent();
}
private void registerExtraHandleShortcuts(ShortcutSet shortcuts) {
KeyStroke stroke = KeymapUtil.getKeyStroke(shortcuts);
if (stroke != null) {
registerAction("handleSelection " + stroke, stroke, new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
handleSelect(true);
}
});
}
}
};
popup.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
popupStep.getScopeHighlighter().dropHighlight();
@@ -28,6 +28,7 @@ public interface XDebuggerActions {
@NonNls String STEP_OVER = "StepOver";
@NonNls String STEP_INTO = "StepInto";
@NonNls String SMART_STEP_INTO = "SmartStepInto";
@NonNls String FORCE_STEP_INTO = "ForceStepInto";
@NonNls String STEP_OUT = "StepOut";