From 687110d9c7e577b5ded7800da7cf0c757282a962 Mon Sep 17 00:00:00 2001 From: Elizaveta Shashkova Date: Fri, 22 May 2015 14:40:53 +0300 Subject: [PATCH] Step Into My Code (PY-15500): include in python plugin --- python/ide/src/META-INF/pycharm-core.xml | 7 --- .../pluginSrc/META-INF/python-plugin-core.xml | 3 ++ python/src/META-INF/python-core.xml | 6 +++ .../debugger/PyForceStepIntoAction.java | 48 +++++++++++++------ 4 files changed, 42 insertions(+), 22 deletions(-) diff --git a/python/ide/src/META-INF/pycharm-core.xml b/python/ide/src/META-INF/pycharm-core.xml index 0048fb3320b1..be2d315adf7d 100644 --- a/python/ide/src/META-INF/pycharm-core.xml +++ b/python/ide/src/META-INF/pycharm-core.xml @@ -133,13 +133,6 @@ - - - - - diff --git a/python/pluginSrc/META-INF/python-plugin-core.xml b/python/pluginSrc/META-INF/python-plugin-core.xml index 33b1489475b9..28b37921824b 100644 --- a/python/pluginSrc/META-INF/python-plugin-core.xml +++ b/python/pluginSrc/META-INF/python-plugin-core.xml @@ -40,6 +40,9 @@ + + \ No newline at end of file diff --git a/python/src/META-INF/python-core.xml b/python/src/META-INF/python-core.xml index e67f7ebf8582..addd76688e70 100644 --- a/python/src/META-INF/python-core.xml +++ b/python/src/META-INF/python-core.xml @@ -763,6 +763,12 @@ + + + + diff --git a/python/src/com/jetbrains/python/debugger/PyForceStepIntoAction.java b/python/src/com/jetbrains/python/debugger/PyForceStepIntoAction.java index 777e32468be6..756b4bf6bfc7 100644 --- a/python/src/com/jetbrains/python/debugger/PyForceStepIntoAction.java +++ b/python/src/com/jetbrains/python/debugger/PyForceStepIntoAction.java @@ -18,26 +18,44 @@ package com.jetbrains.python.debugger; import com.intellij.execution.RunManager; import com.intellij.execution.RunnerAndConfigurationSettings; import com.intellij.execution.configurations.RunConfiguration; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CommonDataKeys; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.project.Project; +import com.intellij.xdebugger.XDebugSession; +import com.intellij.xdebugger.impl.DebuggerSupport; +import com.intellij.xdebugger.impl.actions.DebuggerActionHandler; import com.intellij.xdebugger.impl.actions.ForceStepIntoAction; +import com.intellij.xdebugger.impl.actions.XDebuggerSuspendedActionHandler; import com.jetbrains.python.run.AbstractPythonRunConfiguration; +import org.jetbrains.annotations.NotNull; public class PyForceStepIntoAction extends ForceStepIntoAction { - @Override - protected boolean isEnabled(AnActionEvent e) { - Project project = e.getData(CommonDataKeys.PROJECT); - if (project != null) { - RunnerAndConfigurationSettings settings = RunManager.getInstance(project).getSelectedConfiguration(); - if (settings != null) { - RunConfiguration runConfiguration = settings.getConfiguration(); - if (runConfiguration instanceof AbstractPythonRunConfiguration) { - return false; - } - } - } + private final XDebuggerSuspendedActionHandler myPyForceStepIntoHandler; - return super.isEnabled(e); + public PyForceStepIntoAction() { + myPyForceStepIntoHandler = new XDebuggerSuspendedActionHandler() { + @Override + protected void perform(@NotNull final XDebugSession session, final DataContext dataContext) { + session.forceStepInto(); + } + + @Override + public boolean isEnabled(@NotNull XDebugSession session, final DataContext dataContext) { + Project project = CommonDataKeys.PROJECT.getData(dataContext); + RunnerAndConfigurationSettings settings = RunManager.getInstance(project).getSelectedConfiguration(); + if (settings != null) { + RunConfiguration runConfiguration = settings.getConfiguration(); + if (runConfiguration instanceof AbstractPythonRunConfiguration) { + return false; + } + } + return super.isEnabled(session, dataContext); + } + }; + } + + @NotNull + @Override + protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) { + return myPyForceStepIntoHandler; } }