|
From: <caw...@us...> - 2007-08-23 19:43:30
|
Revision: 3063
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3063&view=rev
Author: cawilliams
Date: 2007-08-23 12:43:29 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
finish up initial version of #4928
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/plugin.properties
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/EvaluateAction.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ExecuteAction.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.debug.ui/icons/full/dtool16/run_sbook.gif
trunk/org.rubypeople.rdt.debug.ui/icons/full/etool16/run_sbook.gif
Added: trunk/org.rubypeople.rdt.debug.ui/icons/full/dtool16/run_sbook.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.debug.ui/icons/full/dtool16/run_sbook.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/org.rubypeople.rdt.debug.ui/icons/full/etool16/run_sbook.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.debug.ui/icons/full/etool16/run_sbook.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.debug.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/plugin.properties 2007-08-23 19:43:20 UTC (rev 3062)
+++ trunk/org.rubypeople.rdt.debug.ui/plugin.properties 2007-08-23 19:43:29 UTC (rev 3063)
@@ -30,4 +30,4 @@
displayViewName=Display
Execute.label=E&xecute
-Execute.tooltip=Evaluate the Selected Text
\ No newline at end of file
+Execute.tooltip=Evaluate the Selected Text
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/EvaluateAction.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/EvaluateAction.java 2007-08-23 19:43:20 UTC (rev 3062)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/EvaluateAction.java 2007-08-23 19:43:29 UTC (rev 3063)
@@ -225,9 +225,9 @@
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
if (stackFrame.isSuspended()) {
- IRubyElement javaElement= getRubyElement(stackFrame);
- if (javaElement != null) {
- IRubyProject project = javaElement.getRubyProject();
+ IRubyElement rubyElement= getRubyElement(stackFrame);
+ if (rubyElement != null) {
+ IRubyProject project = rubyElement.getRubyProject();
try {
Object selection= getSelectedObject();
if (!(selection instanceof String)) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ExecuteAction.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ExecuteAction.java 2007-08-23 19:43:20 UTC (rev 3062)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/actions/ExecuteAction.java 2007-08-23 19:43:29 UTC (rev 3063)
@@ -11,12 +11,12 @@
package org.rubypeople.rdt.internal.debug.ui.actions;
-import java.text.MessageFormat;
-
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
import org.eclipse.swt.widgets.Display;
import org.rubypeople.rdt.internal.debug.core.model.IEvaluationResult;
+import org.rubypeople.rdt.internal.debug.core.model.RubyValue;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
import org.rubypeople.rdt.internal.debug.ui.display.IDataDisplay;
@@ -38,19 +38,56 @@
}
});
} else {
- IValue value = result.getValue();
- IDataDisplay dataDisplay= getDirectDataDisplay();
- if (dataDisplay != null) {
- try {
- dataDisplay.displayExpressionValue(value.getValueString());
- } catch (DebugException e) {
- RdtDebugUiPlugin.log(e);
- }
+ final Display display = RdtDebugUiPlugin.getStandardDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (display.isDisposed()) {
+ return;
+ }
+ IValue value = result.getValue();
+ IDataDisplay dataDisplay= getDirectDataDisplay();
+ if (dataDisplay != null) {
+ try {
+ dataDisplay.displayExpressionValue(valueToCode(value));
+ } catch (DebugException e) {
+ RdtDebugUiPlugin.log(e);
+ }
+ }
+ evaluationCleanup();
+ }
+ });
+ }
+ }
+
+ protected String valueToCode(IValue value) throws DebugException {
+ String string = value.getValueString();
+ if (value instanceof RubyValue) {
+ RubyValue rubyValue = (RubyValue) value;
+ if (value.getReferenceTypeName().equals("Array")) {
+ StringBuffer buffer = new StringBuffer("[");
+ IVariable[] vars = rubyValue.getVariables();
+ for (int i = 0; i < vars.length; i++) {
+ buffer.append(vars[i].getValue().getValueString());
+ if (i < vars.length - 1)
+ buffer.append(", ");
+ }
+ buffer.append("]");
+ string = buffer.toString();
+ } else if (value.getReferenceTypeName().equals("Hash")) {
+ StringBuffer buffer = new StringBuffer("{");
+ IVariable[] vars = rubyValue.getVariables();
+ for (int i = 0; i < vars.length; i++) {
+ buffer.append(vars[i]);
+ if (i < vars.length - 1)
+ buffer.append(", ");
+ }
+ buffer.append("}");
+ string = buffer.toString();
}
- evaluationCleanup();
}
+ return "=> " + string;
}
-
+
/**
* @see org.eclipse.jdt.internal.debug.ui.actions.EvaluateAction#getDataDisplay()
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|