From 62aa21ef27bfa2d1f8817e1d7ae7be3fe9cde925 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Wed, 12 Mar 2014 19:09:39 +0100 Subject: [PATCH] avoid status bar update on internal method invoke --- .../debugger/engine/DebugProcessImpl.java | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java index 97e3320f2395..2570d9a01f8d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessImpl.java @@ -908,8 +908,11 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb ClassNotLoadedException, IncompatibleThreadStateException, InvalidTypeException; - public E start(EvaluationContextImpl evaluationContext, Method method) throws EvaluateException { + return start(evaluationContext, method, false); + } + + public E start(EvaluationContextImpl evaluationContext, Method method, boolean internalEvaluate) throws EvaluateException { DebuggerManagerThreadImpl.assertIsManagerThread(); SuspendContextImpl suspendContext = evaluationContext.getSuspendContext(); SuspendManagerUtil.assertSuspendContext(suspendContext); @@ -924,11 +927,11 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb final ThreadReference invokeThreadRef = invokeThread.getThreadReference(); myEvaluationDispatcher.getMulticaster().evaluationStarted(suspendContext); - beforeMethodInvocation(suspendContext, method); + beforeMethodInvocation(suspendContext, method, internalEvaluate); Object resumeData = null; try { - for (final SuspendContextImpl suspendingContext : suspendingContexts) { + for (SuspendContextImpl suspendingContext : suspendingContexts) { final ThreadReferenceProxyImpl suspendContextThread = suspendingContext.getThread(); if (suspendContextThread != invokeThread) { if (LOG.isDebugEnabled()) { @@ -947,11 +950,11 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb while (true) { try { return invokeMethodAndFork(suspendContext); - } + } catch (ClassNotLoadedException e) { ReferenceType loadedClass; try { - loadedClass = evaluationContext.isAutoLoadClasses()? loadClass(evaluationContext, e.className(), evaluationContext.getClassLoader()) : null; + loadedClass = evaluationContext.isAutoLoadClasses() ? loadClass(evaluationContext, e.className(), evaluationContext.getClassLoader()) : null; } catch (EvaluateException ignored) { loadedClass = null; @@ -998,7 +1001,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb LOG.debug("getVirtualMachine().clearCaches()"); } getVirtualMachineProxy().clearCaches(); - afterMethodInvocation(suspendContext); + afterMethodInvocation(suspendContext, internalEvaluate); myEvaluationDispatcher.getMulticaster().evaluationFinished(suspendContext); } @@ -1118,9 +1121,16 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb public Value invokeMethod(final EvaluationContext evaluationContext, final ClassType classType, final Method method, final List args) throws EvaluateException { + return invokeMethod(evaluationContext, classType, method, args, false); + } + public Value invokeMethod(@NotNull EvaluationContext evaluationContext, + @NotNull final ClassType classType, + @NotNull final Method method, + final List args, + boolean internalEvaluate) throws EvaluateException { final ThreadReference thread = getEvaluationThread(evaluationContext); - InvokeCommand invokeCommand = new InvokeCommand(args) { + return new InvokeCommand(args) { @Override protected Value invokeMethod(int invokePolicy, final List args) throws InvocationException, ClassNotLoadedException, @@ -1131,8 +1141,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb } return classType.invokeMethod(thread, method, args, invokePolicy); } - }; - return invokeCommand.start((EvaluationContextImpl)evaluationContext, method); + }.start((EvaluationContextImpl)evaluationContext, method, internalEvaluate); } @Override @@ -1179,25 +1188,29 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb clearCashes(suspendContext.getSuspendPolicy()); } - private void beforeMethodInvocation(SuspendContextImpl suspendContext, Method method) { + private void beforeMethodInvocation(SuspendContextImpl suspendContext, Method method, boolean internalEvaluate) { if (LOG.isDebugEnabled()) { LOG.debug( "before invocation in thread " + suspendContext.getThread().name() + " method " + (method == null ? "null" : method.name())); } - if (method != null) { - showStatusText(DebuggerBundle.message("progress.evaluating", DebuggerUtilsEx.methodName(method))); - } - else { - showStatusText(DebuggerBundle.message("title.evaluating")); + if (!internalEvaluate) { + if (method != null) { + showStatusText(DebuggerBundle.message("progress.evaluating", DebuggerUtilsEx.methodName(method))); + } + else { + showStatusText(DebuggerBundle.message("title.evaluating")); + } } } - private void afterMethodInvocation(SuspendContextImpl suspendContext) { + private void afterMethodInvocation(SuspendContextImpl suspendContext, boolean internalEvaluate) { if (LOG.isDebugEnabled()) { LOG.debug("after invocation in thread " + suspendContext.getThread().name()); } - showStatusText(""); + if (!internalEvaluate) { + showStatusText(""); + } } @Override