mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-63378 Switching threads should be optional, not forced - enabled threads view updates when stepping
This commit is contained in:
+26
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -23,16 +23,35 @@ import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.sun.jdi.ObjectCollectedException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class DebuggerContextCommandImpl extends SuspendContextCommandImpl {
|
||||
private static final Logger LOG = Logger.getInstance(DebuggerContextCommandImpl.class);
|
||||
|
||||
private final DebuggerContextImpl myDebuggerContext;
|
||||
private final ThreadReferenceProxyImpl myCustomThread; // thread to perform command in
|
||||
|
||||
protected DebuggerContextCommandImpl(@NotNull DebuggerContextImpl debuggerContext) {
|
||||
super(debuggerContext.getSuspendContext());
|
||||
this(debuggerContext, null);
|
||||
}
|
||||
|
||||
protected DebuggerContextCommandImpl(@NotNull DebuggerContextImpl debuggerContext, @Nullable ThreadReferenceProxyImpl customThread) {
|
||||
super(debuggerContext.getSuspendContext());
|
||||
myDebuggerContext = debuggerContext;
|
||||
myCustomThread = customThread;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public SuspendContextImpl getSuspendContext() {
|
||||
if (myCustomThread != null) {
|
||||
return SuspendManagerUtil.findContextByThread(myDebuggerContext.getDebugProcess().getSuspendManager(), myCustomThread);
|
||||
}
|
||||
return super.getSuspendContext();
|
||||
}
|
||||
|
||||
private ThreadReferenceProxyImpl getThread() {
|
||||
return myCustomThread != null ? myCustomThread : myDebuggerContext.getThreadProxy();
|
||||
}
|
||||
|
||||
public final DebuggerContextImpl getDebuggerContext() {
|
||||
@@ -41,11 +60,10 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
|
||||
|
||||
@Override
|
||||
public final void contextAction() throws Exception {
|
||||
final SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
|
||||
final ThreadReferenceProxyImpl debuggerContextThread = myDebuggerContext.getThreadProxy();
|
||||
final boolean isSuspendedByContext;
|
||||
SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
|
||||
boolean isSuspendedByContext;
|
||||
try {
|
||||
isSuspendedByContext = suspendManager.isSuspended(debuggerContextThread);
|
||||
isSuspendedByContext = suspendManager.isSuspended(getThread());
|
||||
}
|
||||
catch (ObjectCollectedException ignored) {
|
||||
notifyCancelled();
|
||||
@@ -54,13 +72,13 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
|
||||
if (isSuspendedByContext) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Context thread " + getSuspendContext().getThread());
|
||||
LOG.debug("Debug thread" + debuggerContextThread);
|
||||
LOG.debug("Debug thread" + getThread());
|
||||
}
|
||||
threadAction();
|
||||
}
|
||||
else {
|
||||
// there are no suspend context currently registered
|
||||
SuspendContextImpl suspendContextForThread = SuspendManagerUtil.findContextByThread(suspendManager, debuggerContextThread);
|
||||
SuspendContextImpl suspendContextForThread = SuspendManagerUtil.findContextByThread(suspendManager, getThread());
|
||||
if (suspendContextForThread != null) {
|
||||
suspendContextForThread.postponeCommand(this);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,9 @@ package com.intellij.debugger.ui.impl.watch;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.DebuggerInvocationUtil;
|
||||
import com.intellij.debugger.engine.*;
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.SuspendContextImpl;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
|
||||
@@ -31,7 +33,10 @@ import com.intellij.debugger.engine.events.SuspendContextCommandImpl;
|
||||
import com.intellij.debugger.impl.DebuggerContextImpl;
|
||||
import com.intellij.debugger.impl.DebuggerSession;
|
||||
import com.intellij.debugger.impl.DebuggerUtilsEx;
|
||||
import com.intellij.debugger.jdi.*;
|
||||
import com.intellij.debugger.jdi.LocalVariableProxyImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadGroupReferenceProxyImpl;
|
||||
import com.intellij.debugger.jdi.ThreadReferenceProxyImpl;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.settings.ThreadsViewSettings;
|
||||
import com.intellij.debugger.ui.breakpoints.Breakpoint;
|
||||
@@ -408,7 +413,11 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
protected final List<DebuggerTreeNodeImpl> myChildren = new LinkedList<DebuggerTreeNodeImpl>();
|
||||
|
||||
protected BuildNodeCommand(DebuggerTreeNodeImpl node) {
|
||||
super(DebuggerTree.this.getDebuggerContext());
|
||||
this(node, null);
|
||||
}
|
||||
|
||||
protected BuildNodeCommand(DebuggerTreeNodeImpl node, ThreadReferenceProxyImpl thread) {
|
||||
super(DebuggerTree.this.getDebuggerContext(), thread);
|
||||
myNode = node;
|
||||
}
|
||||
|
||||
@@ -628,7 +637,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
|
||||
private class BuildThreadCommand extends BuildNodeCommand {
|
||||
public BuildThreadCommand(DebuggerTreeNodeImpl threadNode) {
|
||||
super(threadNode);
|
||||
super(threadNode, ((ThreadDescriptorImpl)threadNode.getDescriptor()).getThreadReference());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user