diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java index d75175f6bd26..c5bbe0bded29 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java @@ -103,6 +103,11 @@ public class JavaExecutionStack extends XExecutionStack { } else { myDebugProcess.getManagerThread().invokeAndWait(new DebuggerCommandImpl() { + @Override + public Priority getPriority() { + return Priority.HIGH; + } + @Override protected void action() throws Exception { myTopFrame = calcTopFrame(); @@ -117,6 +122,11 @@ public class JavaExecutionStack extends XExecutionStack { public void computeStackFrames(final int firstFrameIndex, final XStackFrameContainer container) { final AtomicInteger skipCounter = new AtomicInteger(firstFrameIndex); myDebugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(myDebugProcess.getDebuggerContext()) { + @Override + public Priority getPriority() { + return Priority.NORMAL; + } + @Override public void threadAction() { if (!myThreadProxy.isCollected() && myDebugProcess.getSuspendManager().isSuspended(myThreadProxy)) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java index 316c49201e4c..5af05ebb1ec4 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java @@ -150,6 +150,11 @@ public class JavaStackFrame extends XStackFrame { return; } myDebugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(myDebugProcess.getDebuggerContext()) { + @Override + public Priority getPriority() { + return Priority.NORMAL; + } + @Override public void threadAction() { XValueChildrenList children = new XValueChildrenList(); diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java index a06f831c0413..0a8c557a4e95 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java @@ -68,10 +68,6 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider { private static JavaValue create(JavaValue parent, @NotNull ValueDescriptorImpl valueDescriptor, EvaluationContextImpl evaluationContext, NodeManagerImpl nodeManager, boolean init) { DebuggerManagerThreadImpl.assertIsManagerThread(); - if (init) { - valueDescriptor.setContext(evaluationContext); - valueDescriptor.updateRepresentation(evaluationContext, DescriptorLabelListener.DUMMY_LISTENER); - } return new JavaValue(parent, valueDescriptor, evaluationContext, nodeManager); } @@ -98,42 +94,58 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider { public void computePresentation(@NotNull final XValueNode node, @NotNull XValuePlace place) { if (myEvaluationContext.getSuspendContext().isResumed()) return; myEvaluationContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(getDebuggerContext()) { + @Override + public Priority getPriority() { + return Priority.NORMAL; + } + @Override public void threadAction() { - Icon nodeIcon = DebuggerTreeRenderer.getValueIcon(myValueDescriptor); - final String[] strings = splitValue(myValueDescriptor.getValueLabel()); - final String value = StringUtil.notNullize(strings[1]); - String type = strings[0]; - XValuePresentation presentation; - if (myValueDescriptor.isString()) { - presentation = new TypedStringValuePresentation(StringUtil.unquoteString(value), type); - } - else if (myValueDescriptor.getLastRenderer() instanceof ToStringRenderer) { - presentation = new XRegularValuePresentation(StringUtil.wrapWithDoubleQuote(value), type); - } - else { - presentation = new XRegularValuePresentation(value, type); - } - if (value.length() > XValueNode.MAX_VALUE_LENGTH) { - node.setFullValueEvaluator(new XFullValueEvaluator() { - @Override - public void startEvaluation(@NotNull final XFullValueEvaluationCallback callback) { - myEvaluationContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(getDebuggerContext()) { + myValueDescriptor.setContext(myEvaluationContext); + myValueDescriptor.updateRepresentation(myEvaluationContext, new DescriptorLabelListener() { + @Override + public void labelChanged() { + Icon nodeIcon = DebuggerTreeRenderer.getValueIcon(myValueDescriptor); + final String[] strings = splitValue(myValueDescriptor.getValueLabel()); + final String value = StringUtil.notNullize(strings[1]); + String type = strings[0]; + XValuePresentation presentation; + if (myValueDescriptor.isString()) { + presentation = new TypedStringValuePresentation(StringUtil.unquoteString(value), type); + } + else if (myValueDescriptor.getLastRenderer() instanceof ToStringRenderer) { + presentation = new XRegularValuePresentation(StringUtil.wrapWithDoubleQuote(value), type); + } + else { + presentation = new XRegularValuePresentation(value, type); + } + if (value.length() > XValueNode.MAX_VALUE_LENGTH) { + node.setFullValueEvaluator(new XFullValueEvaluator() { @Override - public void threadAction() { - final String valueAsString = DebuggerUtilsEx.getValueOrErrorAsString(myEvaluationContext, myValueDescriptor.getValue()); - DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() { + public void startEvaluation(@NotNull final XFullValueEvaluationCallback callback) { + myEvaluationContext.getDebugProcess().getManagerThread().schedule(new DebuggerContextCommandImpl(getDebuggerContext()) { @Override - public void run() { - callback.evaluated(valueAsString); + public Priority getPriority() { + return Priority.NORMAL; + } + + @Override + public void threadAction() { + final String valueAsString = DebuggerUtilsEx.getValueOrErrorAsString(myEvaluationContext, myValueDescriptor.getValue()); + DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() { + @Override + public void run() { + callback.evaluated(valueAsString); + } + }); } }); } }); } - }); - } - node.setPresentation(nodeIcon, presentation, myValueDescriptor.isExpandable()); + node.setPresentation(nodeIcon, presentation, myValueDescriptor.isExpandable()); + } + }); } }); } @@ -173,6 +185,11 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider { public void computeChildren(@NotNull final XCompositeNode node) { if (myEvaluationContext.getSuspendContext().isResumed()) return; myEvaluationContext.getDebugProcess().getManagerThread().schedule(new SuspendContextCommandImpl(myEvaluationContext.getSuspendContext()) { + @Override + public Priority getPriority() { + return Priority.NORMAL; + } + @Override public void contextAction() throws Exception { final XValueChildrenList children = new XValueChildrenList(); @@ -278,6 +295,11 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider { if (myEvaluationContext.getSuspendContext().isResumed()) return; DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess(); debugProcess.getManagerThread().schedule(new JumpToObjectAction.NavigateCommand(getDebuggerContext(), myValueDescriptor, debugProcess, null) { + @Override + public Priority getPriority() { + return Priority.HIGH; + } + @Override protected void doAction(@Nullable final SourcePosition sourcePosition) { if (sourcePosition != null) { @@ -307,6 +329,11 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider { // TODO: change API to allow to calculate it asynchronously DebugProcessImpl debugProcess = myEvaluationContext.getDebugProcess(); debugProcess.getManagerThread().invokeAndWait(new DebuggerCommandImpl() { + @Override + public Priority getPriority() { + return Priority.HIGH; + } + @Override protected void action() throws Exception { evaluationExpression = ApplicationManager.getApplication().runReadAction(new Computable() {