diff --git a/python/ide/src/META-INF/pycharm-core.xml b/python/ide/src/META-INF/pycharm-core.xml index 4a3aa83e2303..be2d315adf7d 100644 --- a/python/ide/src/META-INF/pycharm-core.xml +++ b/python/ide/src/META-INF/pycharm-core.xml @@ -132,6 +132,9 @@ + + + diff --git a/python/pluginSrc/META-INF/python-plugin-core.xml b/python/pluginSrc/META-INF/python-plugin-core.xml index 33b1489475b9..42eea6e0a5da 100644 --- a/python/pluginSrc/META-INF/python-plugin-core.xml +++ b/python/pluginSrc/META-INF/python-plugin-core.xml @@ -40,6 +40,8 @@ + + \ 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 d2d6a99cd6b4..06071c0173d4 100644 --- a/python/src/META-INF/python-core.xml +++ b/python/src/META-INF/python-core.xml @@ -734,7 +734,7 @@ text="Step Into My Code" description="Step to the next line executed ignoring libraries"> - + diff --git a/python/src/com/jetbrains/python/debugger/PyForceStepIntoAction.java b/python/src/com/jetbrains/python/debugger/PyForceStepIntoAction.java new file mode 100644 index 000000000000..6e03067bcb01 --- /dev/null +++ b/python/src/com/jetbrains/python/debugger/PyForceStepIntoAction.java @@ -0,0 +1,52 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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.project.Project; +import com.intellij.xdebugger.impl.DebuggerSupport; +import com.intellij.xdebugger.impl.actions.DebuggerActionHandler; +import com.intellij.xdebugger.impl.actions.XDebuggerActionBase; +import com.jetbrains.python.run.AbstractPythonRunConfiguration; +import org.jetbrains.annotations.NotNull; + +public class PyForceStepIntoAction extends XDebuggerActionBase { + @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; + } + } + } + + return super.isEnabled(e); + } + + @NotNull + @Override + protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) { + return debuggerSupport.getForceStepIntoHandler(); + } +} diff --git a/python/src/com/jetbrains/python/debugger/PyStepIntoMyCodeAction.java b/python/src/com/jetbrains/python/debugger/PyStepIntoMyCodeAction.java index 59a198892776..3366225d4384 100644 --- a/python/src/com/jetbrains/python/debugger/PyStepIntoMyCodeAction.java +++ b/python/src/com/jetbrains/python/debugger/PyStepIntoMyCodeAction.java @@ -15,12 +15,19 @@ */ 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.DataContext; +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.XDebuggerActionBase; import com.intellij.xdebugger.impl.actions.XDebuggerSuspendedActionHandler; +import com.jetbrains.python.run.AbstractPythonRunConfiguration; import org.jetbrains.annotations.NotNull; @@ -43,4 +50,20 @@ public class PyStepIntoMyCodeAction extends XDebuggerActionBase { protected DebuggerActionHandler getHandler(@NotNull DebuggerSupport debuggerSupport) { return myStepIntoMyCodeHandler; } + + @Override + protected boolean isHidden(AnActionEvent event) { + Project project = event.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; + } + } + } + + return true; + } }