mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Step Into My Code (PY-15500): include in python plugin
This commit is contained in:
@@ -133,13 +133,6 @@
|
||||
<add-to-group group-id="MarkRootGroup"/>
|
||||
</action>
|
||||
|
||||
<action id="StepIntoMyCode" class="com.jetbrains.python.debugger.PyStepIntoMyCodeAction" icon="PythonIcons.Python.Debug.StepIntoMyCode"
|
||||
text="Step Into My Code" description="Step to the next line executed ignoring libraries"
|
||||
use-shortcut-of="ForceStepInto">
|
||||
<add-to-group group-id="DebugMainMenu" relative-to-action="StepInto" anchor="after"/>
|
||||
<add-to-group group-id="XDebugger.ToolWindow.TopToolbar" relative-to-action="StepInto" anchor="after"/>
|
||||
</action>
|
||||
|
||||
<action overrides="true" id="ForceStepInto" class="com.intellij.openapi.actionSystem.EmptyAction"/>
|
||||
|
||||
<group id="TypeHierarchyPopupMenu">
|
||||
|
||||
@@ -40,6 +40,9 @@
|
||||
<action id="PyManagePackages" class="com.jetbrains.python.packaging.PyManagePackagesAction" text="Manage Python Packages...">
|
||||
<add-to-group group-id="ToolsMenu" anchor="last"/>
|
||||
</action>
|
||||
|
||||
<action overrides="true" id="ForceStepInto" class="com.jetbrains.python.debugger.PyForceStepIntoAction" text="Fo_rce Step Into"
|
||||
icon="AllIcons.Debugger.Actions.Force_step_into" description="Step into, ignore stepping filters for libraries, constructors, etc."/>
|
||||
</actions>
|
||||
|
||||
</idea-plugin>
|
||||
@@ -763,6 +763,12 @@
|
||||
<add-to-group group-id="RefactoringMenu" anchor="last" />
|
||||
</action>
|
||||
|
||||
<action id="StepIntoMyCode" class="com.jetbrains.python.debugger.PyStepIntoMyCodeAction" icon="PythonIcons.Python.Debug.StepIntoMyCode"
|
||||
text="Step Into My Code" description="Step to the next line executed ignoring libraries"
|
||||
use-shortcut-of="ForceStepInto">
|
||||
<add-to-group group-id="DebugMainMenu" relative-to-action="StepInto" anchor="after"/>
|
||||
<add-to-group group-id="XDebugger.ToolWindow.TopToolbar" relative-to-action="StepInto" anchor="after"/>
|
||||
</action>
|
||||
|
||||
</actions>
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user