mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Adds latest debugger's features to Eclipse plugin
This commit is contained in:
parent
569d6fa3e8
commit
befde46ca2
|
@ -85,6 +85,8 @@
|
|||
<instructions>
|
||||
<Export-Package>org.teavm.*</Export-Package>
|
||||
<Bundle-SymbolicName>teavm-core</Bundle-SymbolicName>
|
||||
<Import-Package>org.apache.commons.io;version="[1.4,2.5)",org.junit,org.objectweb.asm;version="[4.2,6)",
|
||||
org.objectweb.asm.tree;version="[4.2,6)"</Import-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
@ -5,6 +5,7 @@ Bundle-SymbolicName: teavm-eclipse-plugin;singleton:=true
|
|||
Bundle-Version: 0.2.0.qualifer
|
||||
Bundle-Vendor: Alexey Andreev <konsoletyper@gmail.com>
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||
Bundle-Activator: org.teavm.eclipse.TeaVMEclipsePlugin
|
||||
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.8.0,4.0)",
|
||||
org.eclipse.debug.core;bundle-version="[3.7.0,4.0)",
|
||||
org.eclipse.debug.ui;bundle-version="[3.8.0,4.0)",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
source.. = src/java/
|
||||
source.. = src/main/java/
|
||||
output.. = target/
|
||||
bin.includes = plugin.xml,\
|
||||
META-INF/,\
|
||||
|
|
|
@ -9,6 +9,10 @@ import org.eclipse.core.runtime.Plugin;
|
|||
public class TeaVMEclipsePlugin extends Plugin {
|
||||
private static TeaVMEclipsePlugin defaultInstance;
|
||||
|
||||
static {
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
public TeaVMEclipsePlugin() {
|
||||
defaultInstance = this;
|
||||
}
|
||||
|
|
|
@ -10,12 +10,14 @@ import org.teavm.debugging.CallFrame;
|
|||
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||
*/
|
||||
public class TeaVMStackFrame implements IStackFrame {
|
||||
private TeaVMThread thread;
|
||||
TeaVMThread thread;
|
||||
CallFrame callFrame;
|
||||
private TeaVMVariablesHolder variablesHolder;
|
||||
|
||||
public TeaVMStackFrame(TeaVMThread thread, CallFrame callFrame) {
|
||||
this.thread = thread;
|
||||
this.callFrame = callFrame;
|
||||
this.variablesHolder = new TeaVMVariablesHolder(thread.debugTarget, callFrame.getVariables().values());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -150,7 +152,7 @@ public class TeaVMStackFrame implements IStackFrame {
|
|||
|
||||
@Override
|
||||
public IVariable[] getVariables() throws DebugException {
|
||||
return new IVariable[0];
|
||||
return variablesHolder.getVariables();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,7 +19,7 @@ import org.teavm.debugging.DebuggerListener;
|
|||
*/
|
||||
public class TeaVMThread implements IThread {
|
||||
private Debugger teavmDebugger;
|
||||
private TeaVMDebugTarget debugTarget;
|
||||
TeaVMDebugTarget debugTarget;
|
||||
private volatile TeaVMStackFrame[] stackTrace;
|
||||
|
||||
public TeaVMThread(TeaVMDebugTarget debugTarget) {
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
package org.teavm.eclipse.debugger;
|
||||
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.model.IDebugTarget;
|
||||
import org.eclipse.debug.core.model.IValue;
|
||||
import org.eclipse.debug.core.model.IVariable;
|
||||
import org.teavm.debugging.Value;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class TeaVMValue implements IValue {
|
||||
TeaVMDebugTarget debugTarget;
|
||||
private Value teavmValue;
|
||||
private TeaVMVariablesHolder variablesHolder;
|
||||
|
||||
public TeaVMValue(TeaVMDebugTarget debugTarget, Value teavmValue) {
|
||||
this.debugTarget = debugTarget;
|
||||
this.teavmValue = teavmValue;
|
||||
this.variablesHolder = new TeaVMVariablesHolder(debugTarget, teavmValue.getProperties().values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDebugTarget getDebugTarget() {
|
||||
return debugTarget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILaunch getLaunch() {
|
||||
return debugTarget.getLaunch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelIdentifier() {
|
||||
return "org.teavm.eclipse.debugger.value";
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Object getAdapter(Class arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReferenceTypeName() throws DebugException {
|
||||
return teavmValue.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueString() throws DebugException {
|
||||
return teavmValue.getRepresentation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IVariable[] getVariables() throws DebugException {
|
||||
return variablesHolder.getVariables();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasVariables() throws DebugException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAllocated() throws DebugException {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package org.teavm.eclipse.debugger;
|
||||
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.ILaunch;
|
||||
import org.eclipse.debug.core.model.IDebugTarget;
|
||||
import org.eclipse.debug.core.model.IValue;
|
||||
import org.eclipse.debug.core.model.IVariable;
|
||||
import org.teavm.debugging.Variable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class TeaVMVariable implements IVariable {
|
||||
private TeaVMDebugTarget debugTarget;
|
||||
private Variable var;
|
||||
private TeaVMValue value;
|
||||
|
||||
public TeaVMVariable(TeaVMDebugTarget debugTarget, Variable var) {
|
||||
this.debugTarget = debugTarget;
|
||||
this.var = var;
|
||||
this.value = new TeaVMValue(debugTarget, var.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(IValue arg0) throws DebugException {
|
||||
throw new DebugException(new Status(Status.ERROR, "org.teavm.eclipse", "Can't set value"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValue(String arg0) throws DebugException {
|
||||
throw new DebugException(new Status(Status.ERROR, "org.teavm.eclipse", "Can't set value"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsValueModification() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifyValue(IValue arg0) throws DebugException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifyValue(String arg0) throws DebugException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDebugTarget getDebugTarget() {
|
||||
return debugTarget;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILaunch getLaunch() {
|
||||
return debugTarget.getLaunch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelIdentifier() {
|
||||
return "org.teavm.eclipse.debugger.variable";
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Object getAdapter(Class arg0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() throws DebugException {
|
||||
return var.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReferenceTypeName() throws DebugException {
|
||||
return var.getValue().getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IValue getValue() throws DebugException {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasValueChanged() throws DebugException {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.teavm.eclipse.debugger;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import org.teavm.debugging.Variable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class TeaVMVariablesHolder {
|
||||
private TeaVMDebugTarget debugTarget;
|
||||
private Collection<Variable> teavmVariables;
|
||||
private AtomicReference<TeaVMVariable[]> variables = new AtomicReference<>();
|
||||
|
||||
public TeaVMVariablesHolder(TeaVMDebugTarget debugTarget, Collection<Variable> teavmVariables) {
|
||||
this.debugTarget = debugTarget;
|
||||
this.teavmVariables = teavmVariables;
|
||||
}
|
||||
|
||||
public TeaVMVariable[] getVariables() {
|
||||
if (variables.get() == null) {
|
||||
TeaVMVariable[] newVariables = new TeaVMVariable[teavmVariables.size()];
|
||||
List<Variable> teavmVarList = new ArrayList<>(teavmVariables);
|
||||
Collections.sort(teavmVarList, new Comparator<Variable>() {
|
||||
@Override public int compare(Variable o1, Variable o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
});
|
||||
for (int i = 0; i < teavmVarList.size(); ++i) {
|
||||
newVariables[i] = new TeaVMVariable(debugTarget, teavmVarList.get(i));
|
||||
}
|
||||
variables.compareAndSet(null, newVariables);
|
||||
}
|
||||
return variables.get();
|
||||
}
|
||||
}
|
|
@ -13,6 +13,6 @@ import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
|
|||
public class TeaVMTabGroup extends AbstractLaunchConfigurationTabGroup {
|
||||
@Override
|
||||
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
|
||||
setTabs(new ILaunchConfigurationTab[] { new TeaVMTab(), new SourceLookupTab(), new CommonTab() });
|
||||
setTabs(new ILaunchConfigurationTab[] { new SourceLookupTab(), new CommonTab() });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<description name="TeaVM update site">
|
||||
TeaVM update site
|
||||
</description>
|
||||
<feature url="features/teavm.eclipse.feature_0.2.0.201408032032.jar" id="teavm.eclipse.feature" version="0.2.0.201408032032" os="aix,hpux,linux,macosx,qnx,solaris,win32" ws="carbon,cocoa,gtk,motif,photon,win32,wpf" arch="ia64,ia64_32,PA_RISC,ppc,sparc,x86,x86_64">
|
||||
<feature url="features/teavm.eclipse.feature_0.2.0.201408071508.jar" id="teavm.eclipse.feature" version="0.2.0.201408071508" os="aix,hpux,linux,macosx,qnx,solaris,win32" ws="carbon,cocoa,gtk,motif,photon,win32,wpf" arch="ia64,ia64_32,PA_RISC,ppc,sparc,x86,x86_64">
|
||||
<category name="teavm"/>
|
||||
</feature>
|
||||
<category-def name="teavm" label="TeaVM"/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user