mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Change thread icon when stopped at breakpoint (PY-2431)
This commit is contained in:
@@ -18,7 +18,9 @@ package com.jetbrains.python.debugger;
|
||||
import com.intellij.xdebugger.frame.XExecutionStack;
|
||||
import com.intellij.xdebugger.frame.XStackFrame;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@@ -36,6 +38,12 @@ public class PyExecutionStack extends XExecutionStack {
|
||||
myThreadInfo = threadInfo;
|
||||
}
|
||||
|
||||
public PyExecutionStack(@NotNull final PyDebugProcess debugProcess, @NotNull final PyThreadInfo threadInfo, final @Nullable Icon icon) {
|
||||
super(threadInfo.getName(), icon);
|
||||
myDebugProcess = debugProcess;
|
||||
myThreadInfo = threadInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PyStackFrame getTopFrame() {
|
||||
if (myTopFrame == null) {
|
||||
|
||||
@@ -15,10 +15,13 @@
|
||||
*/
|
||||
package com.jetbrains.python.debugger;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.xdebugger.frame.XExecutionStack;
|
||||
import com.intellij.xdebugger.frame.XSuspendContext;
|
||||
import com.jetbrains.python.debugger.pydev.AbstractCommand;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collection;
|
||||
|
||||
|
||||
@@ -29,7 +32,7 @@ public class PySuspendContext extends XSuspendContext {
|
||||
|
||||
public PySuspendContext(@NotNull final PyDebugProcess debugProcess, @NotNull final PyThreadInfo threadInfo) {
|
||||
myDebugProcess = debugProcess;
|
||||
myActiveStack = new PyExecutionStack(debugProcess, threadInfo);
|
||||
myActiveStack = new PyExecutionStack(debugProcess, threadInfo, getThreadIcon(threadInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,6 +41,16 @@ public class PySuspendContext extends XSuspendContext {
|
||||
return myActiveStack;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Icon getThreadIcon(@NotNull PyThreadInfo threadInfo) {
|
||||
if ((threadInfo.getState() == PyThreadInfo.State.SUSPENDED) && (threadInfo.getStopReason() == AbstractCommand.SET_BREAKPOINT)) {
|
||||
return AllIcons.Debugger.ThreadAtBreakpoint;
|
||||
}
|
||||
else {
|
||||
return AllIcons.Debugger.ThreadSuspended;
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XExecutionStack[] getExecutionStacks() {
|
||||
@@ -49,7 +62,7 @@ public class PySuspendContext extends XSuspendContext {
|
||||
XExecutionStack[] stacks = new XExecutionStack[threads.size()];
|
||||
int i = 0;
|
||||
for (PyThreadInfo thread : threads) {
|
||||
stacks[i++] = new PyExecutionStack(myDebugProcess, thread);
|
||||
stacks[i++] = new PyExecutionStack(myDebugProcess, thread, getThreadIcon(thread));
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user