mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Display breakpoint status in IDEA
This commit is contained in:
parent
1581345e17
commit
c84dcd366e
|
@ -16,6 +16,7 @@
|
||||||
package org.teavm.idea.debug;
|
package org.teavm.idea.debug;
|
||||||
|
|
||||||
import com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType;
|
import com.intellij.debugger.ui.breakpoints.JavaLineBreakpointType;
|
||||||
|
import com.intellij.icons.AllIcons;
|
||||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||||
import com.intellij.openapi.extensions.Extensions;
|
import com.intellij.openapi.extensions.Extensions;
|
||||||
import com.intellij.openapi.util.Key;
|
import com.intellij.openapi.util.Key;
|
||||||
|
@ -24,6 +25,7 @@ import com.intellij.xdebugger.XDebugSession;
|
||||||
import com.intellij.xdebugger.XSourcePosition;
|
import com.intellij.xdebugger.XSourcePosition;
|
||||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||||
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
|
import com.intellij.xdebugger.breakpoints.XBreakpointHandler;
|
||||||
|
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider;
|
||||||
import com.intellij.xdebugger.frame.XSuspendContext;
|
import com.intellij.xdebugger.frame.XSuspendContext;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -70,14 +72,17 @@ public class TeaVMDebugProcess extends XDebugProcess {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakpointStatusChanged(Breakpoint breakpoint) {
|
public void breakpointStatusChanged(Breakpoint breakpoint) {
|
||||||
|
updateBreakpointStatus(breakpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attached() {
|
public void attached() {
|
||||||
|
updateAllBreakpoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detached() {
|
public void detached() {
|
||||||
|
updateAllBreakpoints();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -145,6 +150,39 @@ public class TeaVMDebugProcess extends XDebugProcess {
|
||||||
getSession().positionReached(new TeaVMSuspendContext(innerDebugger, getSession().getProject()));
|
getSession().positionReached(new TeaVMSuspendContext(innerDebugger, getSession().getProject()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkCanPerformCommands() {
|
||||||
|
return innerDebugger.isSuspended() && innerDebugger.isAttached();
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateBreakpointStatus(Breakpoint breakpoint) {
|
||||||
|
XBreakpoint<?> xBreakpoint = breakpointMap.get(breakpoint);
|
||||||
|
if (xBreakpoint instanceof XLineBreakpoint) {
|
||||||
|
XLineBreakpoint<?> xLineBreakpoint = (XLineBreakpoint<?>) xBreakpoint;
|
||||||
|
if (!innerDebugger.isAttached()) {
|
||||||
|
getSession().updateBreakpointPresentation(xLineBreakpoint, null,
|
||||||
|
null);
|
||||||
|
} else if (breakpoint.isValid()) {
|
||||||
|
getSession().updateBreakpointPresentation(xLineBreakpoint, AllIcons.Debugger.Db_verified_breakpoint,
|
||||||
|
null);
|
||||||
|
} else {
|
||||||
|
getSession().updateBreakpointPresentation(xLineBreakpoint, AllIcons.Debugger.Db_invalid_breakpoint,
|
||||||
|
"Could not set breakpoint in remote process");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCurrentStateMessage() {
|
||||||
|
return !innerDebugger.isAttached() ? "Detached" : super.getCurrentStateMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAllBreakpoints() {
|
||||||
|
for (Breakpoint breakpoint : breakpointMap.keySet().toArray(new Breakpoint[0])) {
|
||||||
|
updateBreakpointStatus(breakpoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public XBreakpointHandler<?>[] getBreakpointHandlers() {
|
public XBreakpointHandler<?>[] getBreakpointHandlers() {
|
||||||
|
|
|
@ -66,6 +66,7 @@ public class TeaVMLineBreakpointHandler<B extends XLineBreakpoint<?>> extends XB
|
||||||
Breakpoint innerBreakpoint = innerDebugger.createBreakpoint(path, breakpoint.getLine() + 1);
|
Breakpoint innerBreakpoint = innerDebugger.createBreakpoint(path, breakpoint.getLine() + 1);
|
||||||
breakpoint.putUserData(TeaVMDebugProcess.INNER_BREAKPOINT_KEY, innerBreakpoint);
|
breakpoint.putUserData(TeaVMDebugProcess.INNER_BREAKPOINT_KEY, innerBreakpoint);
|
||||||
debugProcess.breakpointMap.put(innerBreakpoint, breakpoint);
|
debugProcess.breakpointMap.put(innerBreakpoint, breakpoint);
|
||||||
|
debugProcess.updateBreakpointStatus(innerBreakpoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
Loading…
Reference in New Issue
Block a user