[jboss-svn-commits] JBL Code SVN: r14502 - in labs/jbossrules/trunk: drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Aug 23 17:12:49 EDT 2007


Author: ahtik
Date: 2007-08-23 17:12:48 -0400 (Thu, 23 Aug 2007)
New Revision: 14502

Modified:
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
   labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
   labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModel.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModelPresentation.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugTarget.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpoint.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsVMDebugger.java
   labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/editors/RuleEditor.java
Log:
JBRULES-1120: Step Over for MVEL Debugger

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilder.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -79,6 +79,8 @@
                                                        null,
                                                        context );
 
+            String s = org.mvel.debug.DebugTools.decompile(expr);
+
             context.getRule().setConsequence( new MVELConsequence( expr,
                                                                    factory ) );
         } catch ( final Exception e ) {

Modified: labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-compiler/src/main/java/org/drools/rule/builder/dialect/mvel/MVELDialect.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -14,6 +14,7 @@
 import org.drools.base.TypeResolver;
 import org.drools.base.mvel.DroolsMVELFactory;
 import org.drools.base.mvel.DroolsMVELKnowledgeHelper;
+import org.drools.base.mvel.MVELDebugHandler;
 import org.drools.commons.jci.readers.MemoryResourceReader;
 import org.drools.compiler.Dialect;
 import org.drools.compiler.ImportError;
@@ -373,8 +374,9 @@
 
         ExpressionCompiler compiler = new ExpressionCompiler( text );
 
-        //MVEL Debugging support
-        compiler.setDebugSymbols( true );
+        if (MVELDebugHandler.isDebugMode()) {
+            compiler.setDebugSymbols( true );
+        }
 
         Serializable expr = compiler.compile( parserContext );
         return expr;

Modified: labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java
===================================================================
--- labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-compiler/src/test/java/org/drools/rule/builder/dialect/mvel/MVELConsequenceBuilderTest.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -1,6 +1,7 @@
 package org.drools.rule.builder.dialect.mvel;
 
 import java.io.InputStreamReader;
+import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
@@ -35,6 +36,8 @@
 import org.drools.rule.builder.RuleBuilder;
 import org.drools.spi.ObjectType;
 import org.drools.spi.PatternExtractor;
+import org.mvel.ExpressionCompiler;
+import org.mvel.ParserContext;
 
 public class MVELConsequenceBuilderTest extends TestCase {
 
@@ -243,5 +246,36 @@
         assertEquals(4, count);
 
     }
-    
+
+    public void testX() {
+        String expr = "System.out.println( \"a1\" );\n" + 
+                      "System.out.println( \"a2\" );\n" + 
+                      "System.out.println( \"a3\" );\n" + 
+                      "System.out.println( \"a4\" );\n";
+   
+        ExpressionCompiler compiler = new ExpressionCompiler(expr);
+   
+        ParserContext context = new ParserContext();
+        context.addImport("System", System.class);
+        context.setStrictTypeEnforcement(true);
+        //context.setDebugSymbols( true );
+        context.setSourceFile( "mysource" );
+   
+        compiler.setDebugSymbols( true );
+        
+        Serializable compiledExpression = compiler.compile(context);           
+   
+        String s = org.mvel.debug.DebugTools.decompile( compiledExpression );
+   
+        System.out.println("s "+s);
+        
+        int fromIndex=0;
+        int count = 0;
+        while ((fromIndex = s.indexOf( "DEBUG_SYMBOL", fromIndex+1 )) > -1) {
+            count++;
+        }
+        assertEquals(4, count);      
+   
+      }
 }
+

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELConsequence.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -7,8 +7,6 @@
 import org.drools.spi.KnowledgeHelper;
 import org.mvel.CompiledExpression;
 import org.mvel.MVEL;
-import org.mvel.MVELRuntime;
-import org.mvel.debug.DebugTools;
 
 public class MVELConsequence
     implements
@@ -34,18 +32,15 @@
                                  null );
         CompiledExpression compexpr = (CompiledExpression)this.expr;
 
-        //MVEL:for testing, we can have at least one breakpoint
-        //MVELRuntime.registerBreakpoint( compexpr.getSourceName(), 1 );
-
         //Receive breakpoints from debugger
         MVELDebugHandler.prepare();
         
-		//we are always debugging for now, but we should either debug or run
-        MVEL.executeDebugger( compexpr, null, this.factory);
+        if (MVELDebugHandler.isDebugMode()) {       
+            MVEL.executeDebugger( compexpr, null, this.factory);
+        } else {
+            MVEL.executeExpression( compexpr, null, this.factory);
+        }
 
-        /*MVEL.executeExpression( this.expr,
-                                null,
-                                this.factory );*/
     }
 
     public Serializable getCompExpr() {

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/mvel/MVELDebugHandler.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -4,8 +4,23 @@
 import org.mvel.debug.Debugger;
 import org.mvel.debug.Frame;
 
+/**
+ * Debug Handler for MVEL dialect.
+ * 
+ * Takes care of registering breakpoints and calling required methods
+ * to trigger eclipse debugger to keep breakpoints in sync etc. 
+ * 
+ * @author Ahti Kitsik
+ *
+ */
 public final class MVELDebugHandler {
 
+    private static int onBreakReturn = Debugger.CONTINUE;
+    
+    public final static String DEBUG_LAUNCH_KEY="mvel.debugger";
+    
+    private static Boolean debugMode = null;
+    
 	static {
 		MVELRuntime.setThreadDebugger(new MVELDebugger());
 	}
@@ -23,18 +38,26 @@
 	 *
 	 * @param frame
 	 */
-	private final static void onBreak(Frame frame) {
+	private final static int onBreak(Frame frame) {
+        // We always fall back to Debugger.CONTINUE after each onBreak to avoid eternal step-over flag
+        //int oldReturn = onBreakReturn;
+        //onBreakReturn = Debugger.CONTINUE;
+        //return oldReturn;
+        return onBreakReturn;
 	}
 
     protected final static void registerBreakpoint(String sourceName, int lineNumber) {
+        //System.out.println("Registering breakpoint for "+sourceName+":"+lineNumber);
         MVELRuntime.registerBreakpoint( sourceName, lineNumber );
     }
     
     protected final static void clearAllBreakpoints() {
+        //System.out.println("Clearing all breakpoints");
         MVELRuntime.clearAllBreakpoints();
     }
     
     protected final static void removeBreakpoint(String sourceName, int lineNumber) {
+        //System.out.println("Removing breakpoint from "+sourceName+":"+lineNumber);
         MVELRuntime.removeBreakpoint( sourceName, lineNumber );
     }
     
@@ -44,18 +67,28 @@
         }
         
 		public int onBreak(Frame frame) {
-			MVELDebugHandler.onBreak(frame);
+			return MVELDebugHandler.onBreak(frame);
 			// This call is supposed to be catched by the remote debugger
-			return 0;
 		}
 
 	}
 
+    protected final static void setOnBreakReturn(int value) {
+        onBreakReturn = value;
+    }
+    
     /**
-     * Do nothing. ensures that class is loaded prior debug handler
+     * Do nothing for now. ensures that class is loaded prior debug handler
      */
     public static void prepare() {
     	//do nothing
     }
+
+    public static boolean isDebugMode() {
+        if (debugMode==null) {
+            debugMode = Boolean.valueOf(System.getProperty("mvel.debugger"));
+        }
+        return debugMode.booleanValue();
+    }
         
 }

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModel.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModel.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModel.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -35,4 +35,5 @@
 		}
 		return target[0];
 	}
+        
 }

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModelPresentation.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModelPresentation.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModelPresentation.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -20,5 +20,5 @@
 		}
 		return super.getBreakpointText(breakpoint);
 	}
-	
+	    
 }

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugTarget.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugTarget.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugTarget.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -746,8 +746,22 @@
 
     }
 
-    public Object getDroolsBreakpoint(String source,
+    /**
+     * Tries to find a match for the provided breakpoint information from the list of registered breakpoints.
+     * For stepping and possibly other purposes it returns also a breakpoint for cases where exactly the same line was not found.
+     * 
+     * If breakpoint is not found for <code>line</code> at <code>source</code> then it takes the first line that is above the
+     * specified line at the same file.
+     * 
+     * @param source
+     * @param line
+     * @return
+     */
+    public DroolsLineBreakpoint getDroolsBreakpoint(String source,
                                       int line) {
+        
+        DroolsLineBreakpoint backupBreakpoint = null;
+        
         Iterator iterator = getBreakpoints().iterator();
         while ( iterator.hasNext() ) {
             IJavaBreakpoint element = (IJavaBreakpoint) iterator.next();
@@ -758,15 +772,30 @@
                     if ( l == null || source == null ) {
                         return null;
                     }
-                    if ( l.getLineNumber() == line && source.equals( l.getRuleName() ) ) {
+                    
+                    int matchLine = l.getLineNumber();
+                    String matchSource = l.getRuleName();
+                    if ( matchLine == line && source.equals( matchSource ) ) {
                         return l;
                     }
+                    
+                    // Prepare for a backup breakpoint
+                    if (source.equals( matchSource )) {
+                        
+                        if (l.getLineNumber()<line &&
+                                ((backupBreakpoint==null) ||        
+                                (backupBreakpoint!=null && l.getLineNumber()<backupBreakpoint.getLineNumber()))) {
+                            backupBreakpoint = l;
+                        }
+                    }
+                    
                 } catch ( CoreException e ) {
                     logError( e );
                 }
             }
         }
-        return null;
+        
+        return backupBreakpoint;
     }
 
     private void addRemoteBreakpoint(DroolsLineBreakpoint d) {

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpoint.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpoint.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpoint.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -133,7 +133,7 @@
                 try {
                     return (String) marker.getAttribute( TYPE_NAME);
                 } catch ( CoreException e ) {
-                    e.printStackTrace();
+                    DroolsEclipsePlugin.log( e );
                 }
         }
         return null;

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -6,6 +6,7 @@
 import java.util.Iterator;
 import java.util.List;
 
+import org.drools.eclipse.DroolsEclipsePlugin;
 import org.eclipse.debug.core.DebugEvent;
 import org.eclipse.debug.core.DebugException;
 import org.eclipse.debug.core.model.IBreakpoint;
@@ -13,203 +14,295 @@
 import org.eclipse.jdt.debug.core.IJavaThread;
 import org.eclipse.jdt.internal.debug.core.model.JDIDebugModelMessages;
 import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
+import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
 import org.eclipse.jdt.internal.debug.core.model.JDIThread;
+import org.mvel.debug.Debugger;
 
 import com.sun.jdi.ClassType;
 import com.sun.jdi.IncompatibleThreadStateException;
+import com.sun.jdi.IntegerValue;
 import com.sun.jdi.InvalidStackFrameException;
 import com.sun.jdi.Location;
 import com.sun.jdi.Method;
 import com.sun.jdi.ObjectCollectedException;
 import com.sun.jdi.ObjectReference;
+import com.sun.jdi.ReferenceType;
 import com.sun.jdi.StackFrame;
 import com.sun.jdi.ThreadReference;
 
+/**
+ * Drools Thread supporting MVEL and Java dialect stackframes
+ *
+ */
 public class DroolsThread extends JDIThread {
 
-	private List fStackFrames;
-	private boolean fRefreshChildren = true;
+    private List    fStackFrames;
+    private boolean fRefreshChildren = true;
 
-	public DroolsThread(JDIDebugTarget target, ThreadReference thread) throws ObjectCollectedException {
-		super(target, thread);
-	}
+    public DroolsThread(JDIDebugTarget target,
+                        ThreadReference thread) throws ObjectCollectedException {
+        super( target,
+               thread );
+    }
 
-	protected void initialize() throws ObjectCollectedException {
-		super.initialize();
-		fStackFrames = new ArrayList();
-	}
+    protected void initialize() throws ObjectCollectedException {
+        super.initialize();
+        fStackFrames = new ArrayList();
+    }
 
-	public synchronized List computeStackFrames() throws DebugException {
-		return computeStackFrames(fRefreshChildren);
-	}
+    public synchronized List computeStackFrames() throws DebugException {
+        return computeStackFrames( fRefreshChildren );
+    }
 
-	protected synchronized List computeStackFrames(boolean refreshChildren) throws DebugException {
-		if (isSuspended()) {
-			if (isTerminated()) {
-				fStackFrames.clear();
-			} else if (refreshChildren) {
-				List frames = getUnderlyingFrames();
-				int oldSize = fStackFrames.size();
-				int newSize = frames.size();
-				int discard = oldSize - newSize; // number of old frames to discard, if any
-				for (int i = 0; i < discard; i++) {
-					DroolsStackFrame invalid = (DroolsStackFrame) fStackFrames.remove(0);
-					invalid.bind(null, -1);
-				}
-				int newFrames = newSize - oldSize; // number of frames to create, if any
-				int depth = oldSize;
-				for (int i = newFrames - 1; i >= 0; i--) {
-                    StackFrame currentFrame = (StackFrame) frames.get(i);
+    protected synchronized List computeStackFrames(boolean refreshChildren) throws DebugException {
+        if ( isSuspended() ) {
+            if ( isTerminated() ) {
+                fStackFrames.clear();
+            } else if ( refreshChildren ) {
+                List frames = getUnderlyingFrames();
+                int oldSize = fStackFrames.size();
+                int newSize = frames.size();
+                int discard = oldSize - newSize; // number of old frames to discard, if any
+                for ( int i = 0; i < discard; i++ ) {
+                    DroolsStackFrame invalid = (DroolsStackFrame) fStackFrames.remove( 0 );
+                    invalid.bind( null,
+                                  -1 );
+                }
+                int newFrames = newSize - oldSize; // number of frames to create, if any
+                int depth = oldSize;
+                for ( int i = newFrames - 1; i >= 0; i-- ) {
+                    StackFrame currentFrame = (StackFrame) frames.get( i );
                     //MVEL: create an mvel stack frame when the declaring type is our debugger?
-                    
-                    DroolsStackFrame customFrame;                    
 
-                    customFrame = createCustomFrame( this, depth,
+                    DroolsStackFrame customFrame;
+
+                    customFrame = createCustomFrame( this,
+                                                     depth,
                                                      currentFrame );
 
-                    fStackFrames.add( 0, customFrame );
+                    fStackFrames.add( 0,
+                                      customFrame );
 
-					depth++;
-				}
-				int numToRebind = Math.min(newSize, oldSize); // number of frames to attempt to rebind
-				int offset = newSize - 1;
-				for (depth = 0; depth < numToRebind; depth++) {
-					DroolsStackFrame oldFrame = (DroolsStackFrame) fStackFrames.get(offset);
-					StackFrame frame = (StackFrame) frames.get(offset);
-					DroolsStackFrame newFrame = (DroolsStackFrame) oldFrame.bind(frame, depth);
-					if (newFrame != oldFrame) {
-						fStackFrames.set(offset, newFrame);
-					}
-					offset--;
-				}
+                    depth++;
+                }
+                int numToRebind = Math.min( newSize,
+                                            oldSize ); // number of frames to attempt to rebind
+                int offset = newSize - 1;
+                for ( depth = 0; depth < numToRebind; depth++ ) {
+                    DroolsStackFrame oldFrame = (DroolsStackFrame) fStackFrames.get( offset );
+                    StackFrame frame = (StackFrame) frames.get( offset );
+                    DroolsStackFrame newFrame = (DroolsStackFrame) oldFrame.bind( frame,
+                                                                                  depth );
+                    if ( newFrame != oldFrame ) {
+                        fStackFrames.set( offset,
+                                          newFrame );
+                    }
+                    offset--;
+                }
 
+            }
+            fRefreshChildren = false;
+        } else {
+            return Collections.EMPTY_LIST;
+        }
+        return fStackFrames;
+    }
 
-			}
-			fRefreshChildren = false;
-		} else {
-			return Collections.EMPTY_LIST;
-		}
-		return fStackFrames;
-	}
-
-    public final static DroolsStackFrame createCustomFrame(DroolsThread thread, int depth,
-                                               StackFrame currentFrame) {
+    public final static DroolsStackFrame createCustomFrame(DroolsThread thread,
+                                                           int depth,
+                                                           StackFrame currentFrame) {
         DroolsStackFrame customFrame;
         Location loc = currentFrame.location();
-        if ( loc.declaringType().name().equals( "org.drools.base.mvel.MVELDebugHandler" )
-        		&& loc.method().name().equals( "onBreak" ) ) {
-            customFrame = new MVELStackFrame( thread, currentFrame, depth );
+        if ( loc.declaringType().name().equals( "org.drools.base.mvel.MVELDebugHandler" ) && loc.method().name().equals( "onBreak" ) ) {
+            customFrame = new MVELStackFrame( thread,
+                                              currentFrame,
+                                              depth );
         } else {
-            customFrame = new DroolsStackFrame( thread, currentFrame, depth );
+            customFrame = new DroolsStackFrame( thread,
+                                                currentFrame,
+                                                depth );
         }
         return customFrame;
     }
 
-	private List getUnderlyingFrames() throws DebugException {
-		if (!isSuspended()) {
-			// Checking isSuspended here eliminates a race condition in resume
-			// between the time stack frames are preserved and the time the
-			// underlying thread is actually resumed.
-			requestFailed(JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1, null, IJavaThread.ERR_THREAD_NOT_SUSPENDED);
-		}
-		try {
-			return getUnderlyingThread().frames();
-		} catch (IncompatibleThreadStateException e) {
-			requestFailed(JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1, e, IJavaThread.ERR_THREAD_NOT_SUSPENDED);
-		} catch (RuntimeException e) {
-			targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2, new String[] {e.toString()}), e);
-		} catch (InternalError e) {
-			targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2, new String[] {e.toString()}), e);
-		}
-		// execution will not reach this line, as
-		// #targetRequestFailed will thrown an exception
-		return null;
-	}
+    private List getUnderlyingFrames() throws DebugException {
+        if ( !isSuspended() ) {
+            // Checking isSuspended here eliminates a race condition in resume
+            // between the time stack frames are preserved and the time the
+            // underlying thread is actually resumed.
+            requestFailed( JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1,
+                           null,
+                           IJavaThread.ERR_THREAD_NOT_SUSPENDED );
+        }
+        try {
+            return getUnderlyingThread().frames();
+        } catch ( IncompatibleThreadStateException e ) {
+            requestFailed( JDIDebugModelMessages.JDIThread_Unable_to_retrieve_stack_frame___thread_not_suspended__1,
+                           e,
+                           IJavaThread.ERR_THREAD_NOT_SUSPENDED );
+        } catch ( RuntimeException e ) {
+            targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2,
+                                                       new String[]{e.toString()} ),
+                                 e );
+        } catch ( InternalError e ) {
+            targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_retrieving_stack_frames_2,
+                                                       new String[]{e.toString()} ),
+                                 e );
+        }
+        // execution will not reach this line, as
+        // #targetRequestFailed will thrown an exception
+        return null;
+    }
 
-	protected synchronized void preserveStackFrames() {
-		fRefreshChildren = true;
-		Iterator frames = fStackFrames.iterator();
-		while (frames.hasNext()) {
-			((DroolsStackFrame) frames.next()).setUnderlyingStackFrame(null);
-		}
-	}
+    protected synchronized void preserveStackFrames() {
+        fRefreshChildren = true;
+        Iterator frames = fStackFrames.iterator();
+        while ( frames.hasNext() ) {
+            ((DroolsStackFrame) frames.next()).setUnderlyingStackFrame( null );
+        }
+    }
 
-	protected synchronized void disposeStackFrames() {
-		fStackFrames.clear();
-		fRefreshChildren = true;
-	}
+    protected synchronized void disposeStackFrames() {
+        fStackFrames.clear();
+        fRefreshChildren = true;
+    }
 
-	protected void popFrame(IStackFrame frame) throws DebugException {
-		JDIDebugTarget target= (JDIDebugTarget)getDebugTarget();
-		if (target.canPopFrames()) {
-			// JDK 1.4 support
-			try {
-				// Pop the frame and all frames above it
-				StackFrame jdiFrame= null;
-				int desiredSize= fStackFrames.size() - fStackFrames.indexOf(frame) - 1;
-				int lastSize= fStackFrames.size() + 1; // Set up to pass the first test
-				int size= fStackFrames.size();
-				while (size < lastSize && size > desiredSize) {
-					// Keep popping frames until the stack stops getting smaller
-					// or popFrame is gone.
-					// see Bug 8054
-					jdiFrame = ((DroolsStackFrame) frame).getUnderlyingStackFrame();
-					preserveStackFrames();
-					getUnderlyingThread().popFrames(jdiFrame);
-					lastSize= size;
-					size= computeStackFrames().size();
-				}
-			} catch (IncompatibleThreadStateException exception) {
-				targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_popping, new String[] {exception.toString()}),exception);
-			} catch (InvalidStackFrameException exception) {
-				// InvalidStackFrameException can be thrown when all but the
-				// deepest frame were popped. Fire a changed notification
-				// in case this has occured.
-				fireChangeEvent(DebugEvent.CONTENT);
-				targetRequestFailed(exception.toString(),exception);
-			} catch (RuntimeException exception) {
-				targetRequestFailed(MessageFormat.format(JDIDebugModelMessages.JDIThread_exception_popping, new String[] {exception.toString()}),exception);
-			}
-		}
-	}
+    protected void popFrame(IStackFrame frame) throws DebugException {
+        JDIDebugTarget target = (JDIDebugTarget) getDebugTarget();
+        if ( target.canPopFrames() ) {
+            // JDK 1.4 support
+            try {
+                // Pop the frame and all frames above it
+                StackFrame jdiFrame = null;
+                int desiredSize = fStackFrames.size() - fStackFrames.indexOf( frame ) - 1;
+                int lastSize = fStackFrames.size() + 1; // Set up to pass the first test
+                int size = fStackFrames.size();
+                while ( size < lastSize && size > desiredSize ) {
+                    // Keep popping frames until the stack stops getting smaller
+                    // or popFrame is gone.
+                    // see Bug 8054
+                    jdiFrame = ((DroolsStackFrame) frame).getUnderlyingStackFrame();
+                    preserveStackFrames();
+                    getUnderlyingThread().popFrames( jdiFrame );
+                    lastSize = size;
+                    size = computeStackFrames().size();
+                }
+            } catch ( IncompatibleThreadStateException exception ) {
+                targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_popping,
+                                                           new String[]{exception.toString()} ),
+                                     exception );
+            } catch ( InvalidStackFrameException exception ) {
+                // InvalidStackFrameException can be thrown when all but the
+                // deepest frame were popped. Fire a changed notification
+                // in case this has occured.
+                fireChangeEvent( DebugEvent.CONTENT );
+                targetRequestFailed( exception.toString(),
+                                     exception );
+            } catch ( RuntimeException exception ) {
+                targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_popping,
+                                                           new String[]{exception.toString()} ),
+                                     exception );
+            }
+        }
+    }
 
-	protected void terminated() {
-		super.terminated();
-	}
+    protected void terminated() {
+        super.terminated();
+    }
 
-	protected void removeCurrentBreakpoint(IBreakpoint bp) {
-		super.removeCurrentBreakpoint(bp);
-	}
+    protected void removeCurrentBreakpoint(IBreakpoint bp) {
+        super.removeCurrentBreakpoint( bp );
+    }
 
-	protected synchronized void suspendedByVM() {
-		super.suspendedByVM();
-	}
+    protected synchronized void suspendedByVM() {
+        super.suspendedByVM();
+    }
 
-	protected synchronized void resumedByVM() throws DebugException {
-		super.resumedByVM();
-	}
+    protected synchronized void resumedByVM() throws DebugException {
+        super.resumedByVM();
+    }
 
-	protected void setRunning(boolean running) {
-		super.setRunning(running);
-	}
+    protected void setRunning(boolean running) {
+        super.setRunning( running );
+    }
 
-	protected void dropToFrame(IStackFrame frame) throws DebugException {
-		super.dropToFrame(frame);
-	}
+    protected void dropToFrame(IStackFrame frame) throws DebugException {
+        super.dropToFrame( frame );
+    }
 
-	protected synchronized void stepToFrame(IStackFrame frame) throws DebugException {
-		super.stepToFrame(frame);
-	}
+    protected synchronized void stepToFrame(IStackFrame frame) throws DebugException {
+        super.stepToFrame( frame );
+    }
 
     /* (non-Javadoc)
      * @see org.eclipse.jdt.internal.debug.core.model.JDIThread#newInstance(com.sun.jdi.ClassType, com.sun.jdi.Method, java.util.List)
      */
     public ObjectReference newInstance(ClassType receiverClass,
-                                          Method constructor,
-                                          List args) throws DebugException {
+                                       Method constructor,
+                                       List args) throws DebugException {
         return super.newInstance( receiverClass,
                                   constructor,
                                   args );
     }
-    
+
+    public synchronized void stepOver() throws DebugException {
+        if ( !canStepOver() ) {
+            return;
+        }
+        if ( !setRemoteOnBreakReturn( Debugger.STEP ) ) {
+            return;
+        }
+
+        setRunning( true );
+        preserveStackFrames();
+
+        try {
+            getUnderlyingThread().resume();
+        } catch ( RuntimeException e ) {
+            //stepEnd();
+            targetRequestFailed( MessageFormat.format( JDIDebugModelMessages.JDIThread_exception_stepping,
+                                                       new String[]{e.toString()} ),
+                                 e );
+        }
+
+    }
+
+    private boolean setRemoteOnBreakReturn(int step_over) throws DebugException {
+
+        JDIStackFrame top = (JDIStackFrame) getTopStackFrame();
+        if ( top == null || (!(top instanceof MVELStackFrame)) ) {
+            return false;
+        }
+
+        Iterator handleriter = getVM().classesByName( "org.drools.base.mvel.MVELDebugHandler" ).iterator();
+        Object debugHandlerClass = handleriter.next();
+
+        int line = step_over;
+
+        ReferenceType refType = (ReferenceType) debugHandlerClass;
+        Method m = (Method) refType.methodsByName( "setOnBreakReturn" ).iterator().next();
+        List args = new ArrayList();
+        IntegerValue lineVal = getVM().mirrorOf( line );
+        //ObjectReference realVal = val.getUnderlyingObject();
+        args.add( lineVal );
+
+        try {
+            ClassType tt = (ClassType) debugHandlerClass;
+            tt.invokeMethod( getUnderlyingThread(),
+                             m,
+                             args,
+                             ObjectReference.INVOKE_SINGLE_THREADED );
+
+        } catch ( Exception e ) {
+            DroolsEclipsePlugin.log( e );
+            return false;
+        }
+        return true;
+    }
+
+    public synchronized void resume() throws DebugException {
+        // clear up the step over flag. step over button never calls this method.
+        setRemoteOnBreakReturn( Debugger.CONTINUE );
+        super.resume();
+    }
 }

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/MVELStackFrame.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -10,10 +10,17 @@
 import org.drools.eclipse.DRLInfo.RuleInfo;
 import org.drools.eclipse.debug.DebugUtil;
 import org.drools.eclipse.debug.VariableWrapper;
+import org.eclipse.core.runtime.CoreException;
 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.eclipse.jdi.internal.StackFrameImpl;
+import org.eclipse.jdt.debug.core.IJavaClassObject;
+import org.eclipse.jdt.debug.core.IJavaFieldVariable;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaReferenceType;
 import org.eclipse.jdt.debug.core.IJavaValue;
 import org.eclipse.jdt.internal.debug.core.model.JDILocalVariable;
 import org.eclipse.jdt.internal.debug.core.model.JDINullValue;
@@ -38,150 +45,210 @@
 import com.sun.jdi.ThreadReference;
 import com.sun.jdi.Value;
 
+/**
+ * Stack Frame for MVEL Dialect
+ * 
+ * @author Ahti Kitsik
+ *
+ */
 public class MVELStackFrame extends DroolsStackFrame {
 
+    /**
+     * Dummy type with changed stratum to force debugger's LaunchView to show proper stackframe name
+     */
+    private static final IJavaReferenceType REF_TYPE = new IJavaReferenceType() {
+
+                                                         public String[] getAllFieldNames() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String[] getAvailableStrata() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public IJavaObject getClassLoaderObject() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public IJavaClassObject getClassObject() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String[] getDeclaredFieldNames() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String getDefaultStratum() throws DebugException {
+                                                             return "MVEL";
+                                                         }
+
+                                                         public IJavaFieldVariable getField(String name) throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String getGenericSignature() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String getSourceName() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String[] getSourceNames(String stratum) throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String[] getSourcePaths(String stratum) throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String getName() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public String getSignature() throws DebugException {
+                                                             return null;
+                                                         }
+
+                                                         public IDebugTarget getDebugTarget() {
+                                                             return null;
+                                                         }
+
+                                                         public ILaunch getLaunch() {
+                                                             return null;
+                                                         }
+
+                                                         public String getModelIdentifier() {
+                                                             return null;
+                                                         }
+
+                                                         public Object getAdapter(Class adapter) {
+                                                             return null;
+                                                         }
+
+                                                     }; ;
+
     public MVELStackFrame(DroolsThread thread,
                           StackFrame frame,
                           int depth) {
         super( thread,
                frame,
                depth );
-        //MVEL:Logging
-       try {
-        Iterator i = thread.getUnderlyingThread().frames().iterator();
-        while ( i.hasNext() ) {
-            StackFrameImpl o = (StackFrameImpl) i.next();
+
+        try {
+            Iterator i = thread.getUnderlyingThread().frames().iterator();
+            while ( i.hasNext() ) {
+                StackFrameImpl o = (StackFrameImpl) i.next();
+            }
+        } catch ( IncompatibleThreadStateException e ) {
+            DroolsEclipsePlugin.log( e );
         }
-    } catch ( IncompatibleThreadStateException e ) {
-        // TODO Auto-generated catch block
-        e.printStackTrace();
-    }
 
     }
 
     public IVariable[] getVariables() throws DebugException {
-        /*        IVariable[] variables = super.getVariables();
-         List result = new ArrayList((variables.length - 1)/2);
-         for (int i = 0; i < variables.length; i++) {
-         String name = variables[i].getName();
-         if (!(name.equals("drools")) && !(name.endsWith("__Handle__"))) {
-         result.add(variables[i]);
-         }
-         }
-         */
 
         List result = new ArrayList( 0 );
 
         Method method = getUnderlyingMethod(); // onBreak
         ReferenceType declaringType = method.declaringType(); // org.drools.base.mvel.MVELDebugHandler
 
-        //ReferenceType declaringType = .location().declaringType();
         try {
 
             Object var = method.variables().get( 0 );
             LocalVariable v2 = (LocalVariable) var;
             DroolsLocalVariable frameLocal = new DroolsLocalVariable( this,
                                                                       v2 );
-            // result.add( frameLocal );
 
-            IValue knownVars = DebugUtil.getValueByExpression( "return getFactory().getKnownVariables().toArray(new String[0]);", frameLocal.getValue());
-            
-            IValue factory = DebugUtil.getValueByExpression( "return getFactory();", frameLocal.getValue());
+            IValue knownVars = DebugUtil.getValueByExpression( "return getFactory().getKnownVariables().toArray(new String[0]);",
+                                                               frameLocal.getValue() );
 
+            IValue factory = DebugUtil.getValueByExpression( "return getFactory();",
+                                                             frameLocal.getValue() );
+
             JDIObjectValue vvv = (JDIObjectValue) knownVars;
 
-            if (vvv!=null) {
-            ArrayReference arr = (ArrayReference) vvv.getUnderlyingObject();
-            Iterator varIter = arr.getValues().iterator();
-            
-            while ( varIter.hasNext() ) {
+            if ( vvv != null ) {
+                ArrayReference arr = (ArrayReference) vvv.getUnderlyingObject();
+                Iterator varIter = arr.getValues().iterator();
+
+                while ( varIter.hasNext() ) {
                     final String varName = ((StringReference) varIter.next()).value();
                     IJavaValue val = (IJavaValue) DebugUtil.getValueByExpression( "return getVariableResolver(\"" + varName + "\").getValue();",
                                                                                   factory );
                     if ( val != null ) {
                         final ObjectReference valRef = ((JDIObjectValue) val).getUnderlyingObject();
-                        //MVELThisVariable t2 = new MVELThisVariable((JDIDebugTarget) getDebugTarget(),valRef,varName);
-
                         VariableWrapper local = new VariableWrapper( varName,
                                                                      val );
 
-                        //IValue isLocal = DebugUtil.getValueByExpression( "return getParserContext().getVariables();",
-                        //                                                 frameLocal.getValue() );
                         local.setPublic( true );
-                        //local.setLocal( true );
                         result.add( local );
                     } else {
-                        DroolsEclipsePlugin.log( new Exception("Unable to get value for variable named '"+varName+"'") );
+                        DroolsEclipsePlugin.log( new Exception( "Unable to get value for variable named '" + varName + "'" ) );
                     }
                 }
-            
-            //IValue localVars = DebugUtil.getValueByExpression( "return getParserContext().getVariables();", frameLocal.getValue());
-            //IValue globalVars = DebugUtil.getValueByExpression( "return getParserContext().getInputs();", frameLocal.getValue());
-            
-            //result.add(new VariableWrapper("LocalVariables", (IJavaValue) localVars));
-            //result.add(new VariableWrapper("GlobalVariables", (IJavaValue) globalVars));
-            
-            
-            
-            //now iterate over localVars and add all that have getValue() non-null
-            
-            //MVELThisVariable t2 = new MVELThisVariable((JDIDebugTarget) getDebugTarget(),((JDIObjectValue)variables).getUnderlyingObject(),"parserContext variables");
-            //result.add(t2);
+
             }
-            
+
             IVariable[] vararr = (IVariable[]) result.toArray( new IVariable[result.size()] );
             return vararr;
 
         } catch ( Throwable t ) {
-            t.printStackTrace();
+            DroolsEclipsePlugin.log( t );
         }
-        
-        
+
         IVariable[] vararr = (IVariable[]) result.toArray( new IVariable[result.size()] );
-        
+
         Arrays.sort( vararr,
-                              new Comparator() {
+                     new Comparator() {
 
-                                  public int compare(Object var1,
-                                                     Object var2) {
-                                      try {
-                                        return ((IVariable) var1).getName().compareTo( ((IVariable) var2).getName() );
-                                    } catch ( DebugException e ) {
-                                        return 0;
-                                    }
-                                  }
+                         public int compare(Object var1,
+                                            Object var2) {
+                             try {
+                                 return ((IVariable) var1).getName().compareTo( ((IVariable) var2).getName() );
+                             } catch ( DebugException e ) {
+                                 return 0;
+                             }
+                         }
 
-                              } );
+                     } );
         return vararr;
     }
 
-    private boolean internalHasNext(Value iter) throws InvalidTypeException, ClassNotLoadedException, IncompatibleThreadStateException, InvocationException, DebugException {
+    private boolean internalHasNext(Value iter) throws InvalidTypeException,
+                                               ClassNotLoadedException,
+                                               IncompatibleThreadStateException,
+                                               InvocationException,
+                                               DebugException {
         BooleanValue hasNext = (BooleanValue) runMethod( iter,
-                                "hasNext" );
+                                                         "hasNext" );
         return hasNext.booleanValue();
     }
 
     private Value fetchField(Value factoryVar,
-                             String fieldName) throws ClassNotLoadedException, DebugException {
-        return fetchField((ObjectReference)factoryVar, fieldName );
+                             String fieldName) throws ClassNotLoadedException,
+                                              DebugException {
+        return fetchField( (ObjectReference) factoryVar,
+                           fieldName );
     }
 
     private Value runMethod(Value val,
                             String methodName) throws InvalidTypeException,
                                               ClassNotLoadedException,
                                               IncompatibleThreadStateException,
-                                              InvocationException, DebugException {
-        
+                                              InvocationException,
+                                              DebugException {
+
         ObjectReference refObj = (ObjectReference) val;
         ReferenceType t = refObj.referenceType();
         Method m2 = (Method) t.methodsByName( methodName ).iterator().next();
         ThreadReference thread = ((DroolsThread) getThread()).getUnderlyingThread();
 
         Value res = refObj.invokeMethod( thread,
-                                            m2,
-                                            new ArrayList(),
-                                            0 );
-        
+                                         m2,
+                                         new ArrayList(),
+                                         0 );
+
         return res;
     }
 
@@ -194,7 +261,8 @@
     }
 
     private Value fetchField(ObjectReference ref,
-                             String fieldName) throws ClassNotLoadedException, DebugException {
+                             String fieldName) throws ClassNotLoadedException,
+                                              DebugException {
         ClassType varType = (ClassType) ref.type();
         Field field = varType.fieldByName( fieldName );
         Value res = ref.getValue( field );
@@ -208,23 +276,8 @@
                                    depth );
     }
 
-    public String getReceivingTypeName() throws DebugException {
-        return "getReceivingTypeName";
-    }
-
-    public String getMethodName() throws DebugException {
-        return "getMethodName";
-    }
-
-    /*    public String getDeclaringTypeName() throws DebugException {
-     return "MVELRunner";
-     }
-     */
     public int getLineNumber() throws DebugException {
-        /*        DRLInfo drlInfo = DroolsEclipsePlugin.getDefault().parseResource( marker.getResource(),
-         true );*/
 
-        //RuleInfo ruleINF = getExecutingRuleInfo();
         DroolsDebugTarget t = (DroolsDebugTarget) getDebugTarget();
 
         int lineNr = getBreakpointLineNumber();
@@ -236,16 +289,23 @@
         if ( bpoint == null ) {
             return -1;
         }
+
         int line;
         line = bpoint.getDRLLineNumber();
-        return line;
-        //return getUnderlyingStackFrame().location().lineNumber();
+
+        int fragmentLine = getBreakpointLineNumber(); // 4->5 for step over
+
+        int delta = 0;
+        try {
+            delta = fragmentLine - bpoint.getLineNumber();
+        } catch ( CoreException e ) {
+            DroolsEclipsePlugin.log( e );
+        }
+        return line + delta;
     }
 
     public RuleInfo getExecutingRuleInfo() {
         try {
-            String methodName = getMethodName();
-            String signature = getSignature();
             String type = getDeclaringTypeName();
 
             return DroolsEclipsePlugin.getDefault().getRuleInfoByClass( type );
@@ -262,12 +322,10 @@
             if ( o == null ) {
                 return -1;
             }
-            //getLineNumber
             IntegerValue val = (IntegerValue) o;
             return val.value();
         } catch ( Throwable e ) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            DroolsEclipsePlugin.log( e );
         }
         return -1;
     }
@@ -278,15 +336,13 @@
             if ( rem == null ) {
                 return null;
             }
-            //getSourceName
             StringReference res = (StringReference) rem;
             return res.value();
         } catch ( Throwable e ) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            DroolsEclipsePlugin.log( e );
         }
 
-        return null;
+        return "Unavailable";
     }
 
     private Object getRemoteVar(String methodName) throws AbsentInformationException,
@@ -301,17 +357,18 @@
         ReferenceType declaringType = method.declaringType(); // org.drools.base.mvel.MVELDebugHandler
 
         LocalVariable var = (LocalVariable) method.variables().get( 0 );//frame
-        
-        JDILocalVariable jdivar = new JDILocalVariable(this, (LocalVariable) var);
 
+        JDILocalVariable jdivar = new JDILocalVariable( this,
+                                                        (LocalVariable) var );
+
         ClassType frameType = (ClassType) var.type();
 
         IValue value = jdivar.getValue();
-        if (value instanceof JDINullValue) {
+        if ( value instanceof JDINullValue ) {
             return null;
         }
-        ObjectReference o = (ObjectReference) ((JDIObjectValue)value).getUnderlyingObject();
-        
+        ObjectReference o = (ObjectReference) ((JDIObjectValue) value).getUnderlyingObject();
+
         if ( o == null ) {
             return null;
         }
@@ -321,32 +378,32 @@
         return val;
     }
 
-    public String getSourceName() throws DebugException {
+    public String getSourcePath() throws DebugException {
         return getMVELName();
     }
 
-    public String getSourcePath() throws DebugException {
-        return "";
+    public boolean canStepInto() {
+        return false;
     }
 
-    public boolean canStepInto() {
-    	return false;
-    }
-    
     public boolean canStepOver() {
-    	return false;
+        return true;
     }
-    
+
     public boolean canDropToFrame() {
-    	return false;
+        return false;
     }
-    
+
     public boolean canStepReturn() {
-    	return false;
+        return false;
     }
-    
+
     public boolean canStepWithFilters() {
-    	return false;
+        return false;
     }
-    
+
+    public IJavaReferenceType getReferenceType() throws DebugException {
+        return REF_TYPE;
+    }
+
 }

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsVMDebugger.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsVMDebugger.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsVMDebugger.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -7,6 +7,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.drools.base.mvel.MVELDebugHandler;
 import org.drools.eclipse.debug.core.DroolsDebugModel;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -106,6 +107,8 @@
 		// options like '-client' & '-server' which are required to be the first options
 		String[] allVMArgs = combineVmArgs(config, fVMInstance);
 		addArguments(allVMArgs, arguments);
+        arguments.add("-D"+MVELDebugHandler.DEBUG_LAUNCH_KEY+"=true");
+        
 		addBootClassPathArguments(arguments, config);
 		
 		String[] cp= config.getClassPath();
@@ -131,6 +134,7 @@
 
 		arguments.add(config.getClassToLaunch());
 		addArguments(config.getProgramArguments(), arguments);
+        
 		String[] cmdLine= new String[arguments.size()];
 		arguments.toArray(cmdLine);
 		

Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/editors/RuleEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/editors/RuleEditor.java	2007-08-23 20:40:56 UTC (rev 14501)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/rulebuilder/editors/RuleEditor.java	2007-08-23 21:12:48 UTC (rev 14502)
@@ -141,8 +141,7 @@
                                  true,
                                  null );
                 } catch ( CoreException e ) {
-                    // TODO Handle
-                    e.printStackTrace();
+                    DroolsEclipsePlugin.log( e );
                 }
             }
 
@@ -159,7 +158,7 @@
             updateName( false );
 
         } catch ( PartInitException e ) {
-            e.printStackTrace();
+            DroolsEclipsePlugin.log( e );
         }
     }
 
@@ -216,8 +215,7 @@
                                                      dslList );
 
         } catch ( Exception e ) {
-            // TODO Handle problem with the completion engine reloading
-            e.printStackTrace();
+            DroolsEclipsePlugin.log( e );
         }
     }
 




More information about the jboss-svn-commits mailing list