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
This commit is contained in:
@@ -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.
|
||||
@@ -80,6 +80,7 @@ public class PopFrameAction extends DebuggerAction {
|
||||
return;
|
||||
}
|
||||
|
||||
debugProcess.getSession().setSteppingThrough(stackFrame.getStackFrameProxy().threadProxy());
|
||||
if (!DebuggerSettings.EVALUATE_FINALLY_NEVER.equals(DebuggerSettings.getInstance().EVALUATE_FINALLY_ON_POP_FRAME)) {
|
||||
List<PsiStatement> statements = getFinallyStatements(debuggerContext.getSourcePosition());
|
||||
if (!statements.isEmpty()) {
|
||||
|
||||
@@ -55,6 +55,7 @@ import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.unscramble.ThreadState;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.xdebugger.AbstractDebuggerSession;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
@@ -70,7 +71,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@@ -109,7 +109,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
|
||||
private final DebuggerContextImpl SESSION_EMPTY_CONTEXT;
|
||||
//Thread, user is currently stepping through
|
||||
private final Set<ThreadReferenceProxyImpl> mySteppingThroughThreads = new HashSet<ThreadReferenceProxyImpl>();
|
||||
private final Set<ThreadReferenceProxyImpl> mySteppingThroughThreads = ContainerUtil.newConcurrentSet();
|
||||
protected final Alarm myUpdateAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
|
||||
|
||||
private boolean myModifiedClassesScanRequired = false;
|
||||
@@ -118,6 +118,10 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
return mySteppingThroughThreads.contains(threadProxy);
|
||||
}
|
||||
|
||||
public boolean setSteppingThrough(ThreadReferenceProxyImpl threadProxy) {
|
||||
return mySteppingThroughThreads.add(threadProxy);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GlobalSearchScope getSearchScope() {
|
||||
//noinspection ConstantConditions
|
||||
@@ -567,10 +571,6 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
}
|
||||
|
||||
private boolean shouldSetAsActiveContext(final SuspendContextImpl suspendContext) {
|
||||
// always switch context if it is not a breakpoint stop
|
||||
if (DebuggerUtilsEx.getEventDescriptors(suspendContext).isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
final ThreadReferenceProxyImpl newThread = suspendContext.getThread();
|
||||
if (newThread == null || suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_ALL || isSteppingThrough(newThread)) {
|
||||
return true;
|
||||
@@ -589,7 +589,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
|
||||
@Override
|
||||
public void resumed(final SuspendContextImpl suspendContext) {
|
||||
final SuspendContextImpl currentContext = getProcess().getSuspendManager().getPausedContext();
|
||||
final SuspendContextImpl currentContext = isSteppingThrough(suspendContext.getThread()) ? null : getProcess().getSuspendManager().getPausedContext();
|
||||
DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
Reference in New Issue
Block a user