mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Minor improvements of Eclipse debugger UI
This commit is contained in:
parent
45181bece7
commit
351d14e275
|
@ -450,15 +450,15 @@ public class ChromeRDPDebugger implements JavaScriptDebugger, ChromeRDPExchangeC
|
|||
RDPValue value;
|
||||
switch (remoteValue.getType()) {
|
||||
case "undefined":
|
||||
value = new RDPValue(this, "undefined", "undefined", null);
|
||||
value = new RDPValue(this, "undefined", "undefined", null, false);
|
||||
break;
|
||||
case "object":
|
||||
case "function":
|
||||
value = new RDPValue(this, null, remoteValue.getType(), remoteValue.getObjectId());
|
||||
value = new RDPValue(this, null, remoteValue.getType(), remoteValue.getObjectId(), true);
|
||||
break;
|
||||
default:
|
||||
value = new RDPValue(this, remoteValue.getValue().asText(), remoteValue.getType(),
|
||||
remoteValue.getObjectId());
|
||||
remoteValue.getObjectId(), false);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,15 @@ public class RDPValue implements JavaScriptValue {
|
|||
private ChromeRDPDebugger debugger;
|
||||
private String objectId;
|
||||
private Map<String, ? extends JavaScriptVariable> properties;
|
||||
private boolean innerStructure;
|
||||
|
||||
public RDPValue(ChromeRDPDebugger debugger, String representation, String typeName, String objectId) {
|
||||
public RDPValue(ChromeRDPDebugger debugger, String representation, String typeName, String objectId,
|
||||
boolean innerStructure) {
|
||||
this.representation.set(representation == null && objectId == null ? "" : representation);
|
||||
this.typeName = typeName;
|
||||
this.debugger = debugger;
|
||||
this.objectId = objectId;
|
||||
this.innerStructure = innerStructure;
|
||||
properties = objectId != null ? new RDPScope(debugger, objectId) :
|
||||
Collections.<String, RDPLocalVariable>emptyMap();
|
||||
}
|
||||
|
@ -68,4 +71,9 @@ public class RDPValue implements JavaScriptValue {
|
|||
public Map<String, JavaScriptVariable> getProperties() {
|
||||
return (Map<String, JavaScriptVariable>)properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasInnerStructure() {
|
||||
return innerStructure;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,6 +119,7 @@ public class Debugger {
|
|||
if (!exits) {
|
||||
break;
|
||||
}
|
||||
enterMethod = true;
|
||||
}
|
||||
for (JavaScriptLocation successor : successors) {
|
||||
temporaryBreakpoints.add(javaScriptDebugger.createBreakpoint(successor));
|
||||
|
|
|
@ -47,4 +47,8 @@ public class Value {
|
|||
}
|
||||
return properties.get();
|
||||
}
|
||||
|
||||
public boolean hasInnerStructure() {
|
||||
return jsValue.hasInnerStructure();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,6 @@ public interface JavaScriptValue {
|
|||
String getClassName();
|
||||
|
||||
Map<String, JavaScriptVariable> getProperties();
|
||||
|
||||
boolean hasInnerStructure();
|
||||
}
|
||||
|
|
|
@ -16,9 +16,11 @@ public class TeaVMDebugProcess implements IProcess {
|
|||
private Map<String, String> attributes = new HashMap<>();
|
||||
private ILaunch launch;
|
||||
private TeaVMStreamsProxy streamsProxy = new TeaVMStreamsProxy();
|
||||
private TeaVMDebugTarget debugTarget;
|
||||
|
||||
public TeaVMDebugProcess(ILaunch launch) {
|
||||
public TeaVMDebugProcess(ILaunch launch, TeaVMDebugTarget debugTarget) {
|
||||
this.launch = launch;
|
||||
this.debugTarget = debugTarget;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -28,16 +30,17 @@ public class TeaVMDebugProcess implements IProcess {
|
|||
|
||||
@Override
|
||||
public boolean canTerminate() {
|
||||
return false;
|
||||
return debugTarget.canTerminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerminated() {
|
||||
return false;
|
||||
return debugTarget.isTerminated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() throws DebugException {
|
||||
debugTarget.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.teavm.eclipse.debugger;
|
||||
|
||||
import static org.teavm.eclipse.debugger.TeaVMDebugConstants.DEBUG_TARGET_ID;
|
||||
import static org.teavm.eclipse.debugger.TeaVMDebugConstants.JAVA_BREAKPOINT_INSTALL_COUNT;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import org.eclipse.core.resources.IMarkerDelta;
|
||||
|
@ -14,8 +16,7 @@ import org.teavm.chromerdp.ChromeRDPServer;
|
|||
import org.teavm.debugging.Breakpoint;
|
||||
import org.teavm.debugging.Debugger;
|
||||
import org.teavm.debugging.DebuggerListener;
|
||||
import org.teavm.debugging.JavaScriptDebugger;
|
||||
import static org.teavm.eclipse.debugger.TeaVMDebugConstants.*;
|
||||
import org.teavm.debugging.javascript.JavaScriptDebugger;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,7 +39,7 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep {
|
|||
this.launch = launch;
|
||||
this.teavmDebugger = teavmDebugger;
|
||||
this.server = server;
|
||||
this.process = new TeaVMDebugProcess(launch);
|
||||
this.process = new TeaVMDebugProcess(launch, this);
|
||||
this.thread = new TeaVMThread(this);
|
||||
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
|
||||
for (IBreakpoint breakpoint : DebugPlugin.getDefault().getBreakpointManager().getBreakpoints()) {
|
||||
|
@ -101,7 +102,7 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep {
|
|||
|
||||
@Override
|
||||
public boolean canTerminate() {
|
||||
return true;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -113,13 +114,10 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep {
|
|||
public void terminate() throws DebugException {
|
||||
terminated = true;
|
||||
server.stop();
|
||||
fireEvent(new DebugEvent(this, DebugEvent.RESUME));
|
||||
fireEvent(new DebugEvent(thread, DebugEvent.RESUME));
|
||||
fireEvent(new DebugEvent(process, DebugEvent.RESUME));
|
||||
fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
|
||||
fireEvent(new DebugEvent(thread, DebugEvent.TERMINATE));
|
||||
fireEvent(new DebugEvent(thread, DebugEvent.CHANGE));
|
||||
fireEvent(new DebugEvent(process, DebugEvent.TERMINATE));
|
||||
launch.removeProcess(process);
|
||||
fireEvent(new DebugEvent(this, DebugEvent.TERMINATE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,12 +153,12 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep {
|
|||
|
||||
@Override
|
||||
public boolean canResume() {
|
||||
return true;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSuspend() {
|
||||
return true;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -205,7 +203,7 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep {
|
|||
|
||||
@Override
|
||||
public boolean canDisconnect() {
|
||||
return true;
|
||||
return !terminated && !isDisconnected();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -230,12 +228,12 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep {
|
|||
|
||||
@Override
|
||||
public IThread[] getThreads() throws DebugException {
|
||||
return new IThread[] { thread };
|
||||
return !terminated ? new IThread[] { thread } : new IThread[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasThreads() throws DebugException {
|
||||
return true;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -245,22 +243,22 @@ public class TeaVMDebugTarget implements IDebugTarget, IStep {
|
|||
|
||||
@Override
|
||||
public boolean canStepInto() {
|
||||
return true;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStepOver() {
|
||||
return true;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStepReturn() {
|
||||
return true;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStepping() {
|
||||
return false;
|
||||
return !terminated;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,7 +9,7 @@ import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
|
|||
import org.teavm.chromerdp.ChromeRDPDebugger;
|
||||
import org.teavm.chromerdp.ChromeRDPServer;
|
||||
import org.teavm.debugging.Debugger;
|
||||
import org.teavm.debugging.URLDebugInformationProvider;
|
||||
import org.teavm.debugging.information.URLDebugInformationProvider;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.teavm.eclipse.debugger;
|
|||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupParticipant;
|
||||
import org.teavm.debugging.SourceLocation;
|
||||
import org.teavm.debugging.information.SourceLocation;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -22,16 +22,17 @@ public class TeaVMStackFrame implements IStackFrame {
|
|||
|
||||
@Override
|
||||
public boolean canTerminate() {
|
||||
return false;
|
||||
return thread.canTerminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerminated() {
|
||||
return false;
|
||||
return thread.isTerminated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void terminate() throws DebugException {
|
||||
thread.terminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -73,7 +73,7 @@ public class TeaVMThread implements IThread {
|
|||
|
||||
@Override
|
||||
public boolean canTerminate() {
|
||||
return true;
|
||||
return debugTarget.canTerminate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,12 +94,12 @@ public class TeaVMThread implements IThread {
|
|||
|
||||
@Override
|
||||
public boolean canResume() {
|
||||
return true;
|
||||
return debugTarget.canResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSuspend() {
|
||||
return true;
|
||||
return debugTarget.canSuspend();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -119,22 +119,22 @@ public class TeaVMThread implements IThread {
|
|||
|
||||
@Override
|
||||
public boolean canStepInto() {
|
||||
return true;
|
||||
return debugTarget.canStepInto();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStepOver() {
|
||||
return true;
|
||||
return debugTarget.canStepOver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canStepReturn() {
|
||||
return true;
|
||||
return debugTarget.canStepReturn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStepping() {
|
||||
return false;
|
||||
return debugTarget.isStepping();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,18 +184,24 @@ public class TeaVMThread implements IThread {
|
|||
|
||||
@Override
|
||||
public IStackFrame[] getStackFrames() throws DebugException {
|
||||
if (isTerminated()) {
|
||||
return new IStackFrame[0];
|
||||
}
|
||||
TeaVMStackFrame[] stackTrace = this.stackTrace;
|
||||
return stackTrace != null ? stackTrace.clone() : new IStackFrame[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStackFrame getTopStackFrame() {
|
||||
if (isTerminated()) {
|
||||
return null;
|
||||
}
|
||||
TeaVMStackFrame[] stackTrace = this.stackTrace;
|
||||
return stackTrace != null && stackTrace.length > 0 ? stackTrace[0] : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasStackFrames() throws DebugException {
|
||||
return stackTrace != null;
|
||||
return !isTerminated() && stackTrace != null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,12 @@ public class TeaVMValue implements IValue {
|
|||
TeaVMDebugTarget debugTarget;
|
||||
private Value teavmValue;
|
||||
private TeaVMVariablesHolder variablesHolder;
|
||||
private boolean innerStructure;
|
||||
|
||||
public TeaVMValue(TeaVMDebugTarget debugTarget, Value teavmValue) {
|
||||
this.debugTarget = debugTarget;
|
||||
this.teavmValue = teavmValue;
|
||||
this.innerStructure = teavmValue.hasInnerStructure();
|
||||
this.variablesHolder = new TeaVMVariablesHolder(debugTarget, teavmValue.getProperties().values());
|
||||
}
|
||||
|
||||
|
@ -60,7 +62,7 @@ public class TeaVMValue implements IValue {
|
|||
|
||||
@Override
|
||||
public boolean hasVariables() throws DebugException {
|
||||
return true;
|
||||
return innerStructure;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user