diff --git a/teavm-core/pom.xml b/teavm-core/pom.xml
index 7729733b0..70d4e0d2b 100644
--- a/teavm-core/pom.xml
+++ b/teavm-core/pom.xml
@@ -85,6 +85,8 @@
org.teavm.*
teavm-core
+ 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)"
diff --git a/teavm-eclipse-plugin/META-INF/MANIFEST.MF b/teavm-eclipse-plugin/META-INF/MANIFEST.MF
index ac305ad8c..94276f4f3 100644
--- a/teavm-eclipse-plugin/META-INF/MANIFEST.MF
+++ b/teavm-eclipse-plugin/META-INF/MANIFEST.MF
@@ -5,6 +5,7 @@ Bundle-SymbolicName: teavm-eclipse-plugin;singleton:=true
Bundle-Version: 0.2.0.qualifer
Bundle-Vendor: Alexey Andreev
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)",
diff --git a/teavm-eclipse-plugin/build.properties b/teavm-eclipse-plugin/build.properties
index 800e02d9a..c73e6cfde 100644
--- a/teavm-eclipse-plugin/build.properties
+++ b/teavm-eclipse-plugin/build.properties
@@ -1,4 +1,4 @@
-source.. = src/java/
+source.. = src/main/java/
output.. = target/
bin.includes = plugin.xml,\
META-INF/,\
diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java
index 0b6d5d4d5..c9ba97c59 100644
--- a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java
+++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/TeaVMEclipsePlugin.java
@@ -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;
}
diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMStackFrame.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMStackFrame.java
index 0568a7dc5..cf3ebd9e9 100644
--- a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMStackFrame.java
+++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMStackFrame.java
@@ -10,12 +10,14 @@ import org.teavm.debugging.CallFrame;
* @author Alexey Andreev
*/
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
diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMThread.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMThread.java
index 20717373e..a2afa3b17 100644
--- a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMThread.java
+++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMThread.java
@@ -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) {
diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMValue.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMValue.java
new file mode 100644
index 000000000..3c0770572
--- /dev/null
+++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMValue.java
@@ -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;
+ }
+}
diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMVariable.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMVariable.java
new file mode 100644
index 000000000..3fdc9aa61
--- /dev/null
+++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMVariable.java
@@ -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;
+ }
+}
diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMVariablesHolder.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMVariablesHolder.java
new file mode 100644
index 000000000..898348c35
--- /dev/null
+++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/TeaVMVariablesHolder.java
@@ -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 teavmVariables;
+ private AtomicReference variables = new AtomicReference<>();
+
+ public TeaVMVariablesHolder(TeaVMDebugTarget debugTarget, Collection teavmVariables) {
+ this.debugTarget = debugTarget;
+ this.teavmVariables = teavmVariables;
+ }
+
+ public TeaVMVariable[] getVariables() {
+ if (variables.get() == null) {
+ TeaVMVariable[] newVariables = new TeaVMVariable[teavmVariables.size()];
+ List teavmVarList = new ArrayList<>(teavmVariables);
+ Collections.sort(teavmVarList, new Comparator() {
+ @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();
+ }
+}
diff --git a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/ui/TeaVMTabGroup.java b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/ui/TeaVMTabGroup.java
index 1e67f7abe..a64bf090e 100644
--- a/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/ui/TeaVMTabGroup.java
+++ b/teavm-eclipse-plugin/src/main/java/org/teavm/eclipse/debugger/ui/TeaVMTabGroup.java
@@ -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() });
}
}
diff --git a/teavm-eclipse-updatesite/site.xml b/teavm-eclipse-updatesite/site.xml
index 917f35a2d..c68822863 100644
--- a/teavm-eclipse-updatesite/site.xml
+++ b/teavm-eclipse-updatesite/site.xml
@@ -3,7 +3,7 @@
TeaVM update site
-
+