IDEA-144037 Debuger: Api request: Create custom commands for Step Over and etc in DebuggerSession

This commit is contained in:
Egor.Ushakov
2015-08-20 17:49:55 +03:00
parent 08025ce514
commit 1d8ec7b559
3 changed files with 82 additions and 5 deletions
@@ -273,8 +273,15 @@ public class DebuggerSession implements AbstractDebuggerSession {
}
public void stepOut(int stepSize) {
final SuspendContextImpl suspendContext = getSuspendContext();
final DebugProcessImpl.ResumeCommand cmd = myDebugProcess.createStepOutCommand(suspendContext, stepSize);
SuspendContextImpl suspendContext = getSuspendContext();
DebugProcessImpl.ResumeCommand cmd = null;
for (JvmSteppingCommandProvider handler : JvmSteppingCommandProvider.EP_NAME.getExtensions()) {
cmd = handler.getStepOutCommand(suspendContext, stepSize);
if (cmd != null) break;
}
if (cmd == null) {
cmd = myDebugProcess.createStepOutCommand(suspendContext, stepSize);
}
setSteppingThrough(cmd.getContextThread());
resumeAction(cmd, Event.STEP);
}
@@ -284,8 +291,15 @@ public class DebuggerSession implements AbstractDebuggerSession {
}
public void stepOver(boolean ignoreBreakpoints, int stepSize) {
final SuspendContextImpl suspendContext = getSuspendContext();
final DebugProcessImpl.ResumeCommand cmd = myDebugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints, stepSize);
SuspendContextImpl suspendContext = getSuspendContext();
DebugProcessImpl.ResumeCommand cmd = null;
for (JvmSteppingCommandProvider handler : JvmSteppingCommandProvider.EP_NAME.getExtensions()) {
cmd = handler.getStepOverCommand(suspendContext, ignoreBreakpoints, stepSize);
if (cmd != null) break;
}
if (cmd == null) {
cmd = myDebugProcess.createStepOverCommand(suspendContext, ignoreBreakpoints, stepSize);
}
setSteppingThrough(cmd.getContextThread());
resumeAction(cmd, Event.STEP);
}
@@ -296,7 +310,14 @@ public class DebuggerSession implements AbstractDebuggerSession {
public void stepInto(final boolean ignoreFilters, final @Nullable MethodFilter smartStepFilter, int stepSize) {
final SuspendContextImpl suspendContext = getSuspendContext();
final DebugProcessImpl.ResumeCommand cmd = myDebugProcess.createStepIntoCommand(suspendContext, ignoreFilters, smartStepFilter, stepSize);
DebugProcessImpl.ResumeCommand cmd = null;
for (JvmSteppingCommandProvider handler : JvmSteppingCommandProvider.EP_NAME.getExtensions()) {
cmd = handler.getStepIntoCommand(suspendContext, ignoreFilters, smartStepFilter, stepSize);
if (cmd != null) break;
}
if (cmd == null) {
cmd = myDebugProcess.createStepIntoCommand(suspendContext, ignoreFilters, smartStepFilter, stepSize);
}
setSteppingThrough(cmd.getContextThread());
resumeAction(cmd, Event.STEP);
}
@@ -0,0 +1,54 @@
/*
* 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.intellij.debugger.impl;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.MethodFilter;
import com.intellij.debugger.engine.SuspendContextImpl;
import com.intellij.openapi.extensions.ExtensionPointName;
import org.jetbrains.annotations.Nullable;
/**
* @author egor
*/
public abstract class JvmSteppingCommandProvider {
public static ExtensionPointName<JvmSteppingCommandProvider> EP_NAME =
ExtensionPointName.create("com.intellij.debugger.jvmSteppingCommandProvider");
/**
* @return null if can not handle
*/
public DebugProcessImpl.ResumeCommand getStepIntoCommand(SuspendContextImpl suspendContext,
boolean ignoreFilters,
final MethodFilter smartStepFilter,
int stepSize) {
return null;
}
/**
* @return null if can not handle
*/
public DebugProcessImpl.ResumeCommand getStepOutCommand(SuspendContextImpl suspendContext, int stepSize) {
return null;
}
/**
* @return null if can not handle
*/
public DebugProcessImpl.ResumeCommand getStepOverCommand(SuspendContextImpl suspendContext, boolean ignoreBreakpoints, int stepSize) {
return null;
}
}
+2
View File
@@ -135,6 +135,8 @@
area="IDEA_PROJECT"/>
<extensionPoint name="debugger.jvmSmartStepIntoHandler"
interface="com.intellij.debugger.actions.JvmSmartStepIntoHandler"/>
<extensionPoint name="debugger.jvmSteppingCommandProvider"
interface="com.intellij.debugger.impl.JvmSteppingCommandProvider"/>
<extensionPoint name="debugger.frameExtraVarsProvider"
interface="com.intellij.debugger.engine.FrameExtraVariablesProvider"/>