mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
added notification for the case when smart-step's target method was not called
This commit is contained in:
@@ -36,8 +36,11 @@ import com.intellij.openapi.application.ModalityState;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.wm.ToolWindowId;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.sun.jdi.InternalException;
|
||||
import com.sun.jdi.ThreadReference;
|
||||
import com.sun.jdi.VMDisconnectedException;
|
||||
@@ -388,6 +391,12 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
myReturnValueWatcher.disable();
|
||||
}
|
||||
getSuspendManager().voteSuspend(suspendContext);
|
||||
if (hint != null) {
|
||||
final RequestHint.SmartStepFilter smartStepFilter = hint.getSmartStepFilter();
|
||||
if (smartStepFilter != null && !smartStepFilter.wasMethodExecuted()) {
|
||||
ToolWindowManager.getInstance(getProject()).notifyByBalloon(ToolWindowId.DEBUG, MessageType.INFO, "Method <b>" + smartStepFilter.getTargetMethodName() + "()</b> has not been called");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,13 +58,22 @@ public class RequestHint {
|
||||
private final JVMName myDeclaringClassName;
|
||||
private final @NonNls String myTargetMethodName;
|
||||
private final JVMName myTargetMethodSignature;
|
||||
private boolean myMethodExecuted;
|
||||
|
||||
public SmartStepFilter(PsiMethod psiMethod) {
|
||||
myDeclaringClassName = JVMNameUtil.getJVMQualifiedName(psiMethod.getContainingClass());
|
||||
myTargetMethodName = psiMethod.isConstructor()? "<init>" : psiMethod.getName();
|
||||
myTargetMethodSignature = JVMNameUtil.getJVMSignature(psiMethod);
|
||||
}
|
||||
|
||||
|
||||
public String getTargetMethodName() {
|
||||
return myTargetMethodName;
|
||||
}
|
||||
|
||||
public boolean wasMethodExecuted() {
|
||||
return myMethodExecuted;
|
||||
}
|
||||
|
||||
public boolean shouldStopAtLocation(final SuspendContextImpl context) {
|
||||
try {
|
||||
final StackFrameProxyImpl frameProxy = context.getFrameProxy();
|
||||
@@ -80,6 +89,7 @@ public class RequestHint {
|
||||
if (!signatureMatches(method, myTargetMethodSignature.getName(process))) {
|
||||
return false;
|
||||
}
|
||||
myMethodExecuted = true;
|
||||
final ObjectReference thisObject = frameProxy.thisObject();
|
||||
final ReferenceType locationClass = thisObject != null? thisObject.referenceType() : method.declaringType();
|
||||
return DebuggerUtilsEx.isAssignableFrom(myDeclaringClassName.getName(process), locationClass);
|
||||
@@ -168,6 +178,11 @@ public class RequestHint {
|
||||
return mySkipThisMethod ? StepRequest.STEP_OUT : myDepth;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public SmartStepFilter getSmartStepFilter() {
|
||||
return myTargetMethodSignature;
|
||||
}
|
||||
|
||||
public int getNextStepDepth(final SuspendContextImpl context) {
|
||||
try {
|
||||
if ((myDepth == StepRequest.STEP_OVER || myDepth == StepRequest.STEP_INTO) && myPosition != null) {
|
||||
|
||||
Reference in New Issue
Block a user