|
From: <caw...@us...> - 2007-08-15 17:18:57
|
Revision: 2982
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=2982&view=rev
Author: cawilliams
Date: 2007-08-15 10:18:56 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
first try at #5210 - Allow "change value" in debugger
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
Modified: trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF 2007-08-15 15:49:37 UTC (rev 2981)
+++ trunk/org.rubypeople.rdt.debug.core/META-INF/MANIFEST.MF 2007-08-15 17:18:56 UTC (rev 2982)
@@ -14,6 +14,7 @@
org.rubypeople.rdt.internal.debug.core.parsing
Require-Bundle: org.eclipse.core.resources,
org.eclipse.debug.core,
+ org.jruby,
org.rubypeople.rdt.core,
org.kxml2,
org.eclipse.core.runtime
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 15:49:37 UTC (rev 2981)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyVariable.java 2007-08-15 17:18:56 UTC (rev 2982)
@@ -1,11 +1,16 @@
package org.rubypeople.rdt.internal.debug.core.model;
import org.eclipse.core.runtime.PlatformObject;
+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.jruby.lexer.yacc.SyntaxException;
+import org.rubypeople.rdt.internal.core.parser.RubyParser;
+import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
+import org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy;
//see RubyDebugTarget for the reason why PlatformObject is being extended
public class RubyVariable extends PlatformObject implements IVariable {
@@ -17,7 +22,7 @@
private RubyStackFrame stackFrame;
private String name;
private String objectId;
- private RubyValue value;
+ private IValue value;
private RubyVariable parent;
public RubyVariable(RubyStackFrame stackFrame, String name, String scope) {
@@ -92,26 +97,43 @@
* @see org.eclipse.debug.core.model.IValueModification#setValue(String)
*/
public void setValue(String expression) throws DebugException {
+ try {
+ RubyVariable var = getRubyDebuggerProxy().readInspectExpression(stackFrame, getName() + " = " + expression);
+ this.value = var.getValue();
+ } catch (RubyProcessingException e) {
+ throw new DebugException(new Status(Status.ERROR, RdtDebugCorePlugin.PLUGIN_ID, -1, e.getMessage(), e));
+ }
}
+
+ public RubyDebuggerProxy getRubyDebuggerProxy() {
+ return ((RubyDebugTarget) this.getDebugTarget()).getRubyDebuggerProxy();
+ }
/**
* @see org.eclipse.debug.core.model.IValueModification#setValue(IValue)
*/
public void setValue(IValue value) throws DebugException {
+ value.getValueString();
}
/**
* @see org.eclipse.debug.core.model.IValueModification#supportsValueModification()
*/
public boolean supportsValueModification() {
- return false;
+ return true;
}
/**
* @see org.eclipse.debug.core.model.IValueModification#verifyValue(String)
*/
public boolean verifyValue(String expression) throws DebugException {
- return false;
+ try {
+ RubyParser parser = new RubyParser();
+ parser.parse(expression);
+ } catch (SyntaxException e) {
+ return false;
+ }
+ return true;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|