10c10
<  * Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
---
>  * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
14a15
> import com.sun.jdi.IncompatibleThreadStateException;
27a29
> import org.netbeans.api.debugger.DebuggerManager;
54c56
<     private static final boolean ssverbose =
---
>     private static boolean ssverbose =
59c61,62
<     private String position;
---
>     private ThreadReference tr;
>     //private String position;
96,100d98
<             JPDAThread t = getDebuggerImpl ().getCurrentThread ();
<             if (t == null || !t.isSuspended()) {
<                 // Can not step when it's not suspended.
<                 return ;
<             }
102,104d99
<             position = t.getClassName () + '.' +
<                        t.getMethodName () + ':' +
<                        t.getLineNumber (null);
153,158c148,150
<             JPDAThreadImpl jtr = (JPDAThreadImpl) getDebuggerImpl ().
<                 getCurrentThread ();
<             if (jtr != null) {
<                 ThreadReference tr = jtr.getThreadReference ();
<                 removeStepRequests (tr);
<             }
---
>             ThreadReference tr = (JPDAThreadImpl) getDebuggerImpl ().
>                 getCurrentThread ().getThreadReference ();
>             removeStepRequests (tr);
173,175c165
<         if (stepRequest != null) {
<             stepRequest.disable ();
<         }
---
>         stepRequest.disable ();
176a167,168
>         //String np = le.location ().declaringType ().name () + ":" + 
>         //            le.location ().lineNumber (null);
180,189c172,173
<         
<         try {
<             if (tr.frame(0).location().method().isSynthetic()) {
<                 //S ystem.out.println("In synthetic method -> STEP INTO again");
<                 setStepRequest (StepRequest.STEP_INTO);
<                 return true;
<             }
<         } catch (Exception e) {e.printStackTrace();}
<         
<         boolean stop = getCompoundSmartSteppingListener ().stopHere 
---
>         boolean stop = //(!np.equals (position)) &&    ? position is never set ?
>                        getCompoundSmartSteppingListener ().stopHere 
192,202d175
<             String stopPosition = t.getClassName () + '.' +
<                                   t.getMethodName () + ':' +
<                                   t.getLineNumber (null);
<             if (position.equals(stopPosition)) {
<                 // We are where we started!
<                 stop = false;
<                 setStepRequest (StepRequest.STEP_INTO);
<                 return true;
<             }
<         }
<         if (stop) {
209c182,186
<                 setStepRequest (StepRequest.STEP_OUT);
---
>                 //TODO following line of code is wrong !
>                 // step out implementation calls getDebuggerImpl ().resume ();
>                 // such code should not be called from operator!
>                 //getStepActionProvider().doAction(ActionsManager.ACTION_STEP_OUT);
>                 setStepRequest ();
249,267c226,248
<     private void setStepRequest (int step) {
<         ThreadReference tr = ((JPDAThreadImpl) getDebuggerImpl ().
<             getCurrentThread ()).getThreadReference ();
<         removeStepRequests (tr);
<         stepRequest = getDebuggerImpl ().getVirtualMachine ().
<         eventRequestManager ().createStepRequest (
<             tr,
<             StepRequest.STEP_LINE,
<             step
<         );
<         getDebuggerImpl ().getOperator ().register (stepRequest, this);
<         stepRequest.setSuspendPolicy (getDebuggerImpl ().getSuspend ());
<         
<         if (ssverbose)
<             System.out.println("SS:    set patterns:");
<         addPatternsToRequest (
<             getSmartSteppingFilterImpl ().getExclusionPatterns ()
<         );
<         stepRequest.enable ();
---
>     private void setStepRequest () {
>         JPDAThreadImpl jt = (JPDAThreadImpl) getDebuggerImpl ().
>             getCurrentThread ();
>         synchronized (jt) {
>             if (!jt.isSuspended()) {}  // TODO Handle the condition or what?
>             ThreadReference tr = jt.getThreadReference ();
>             removeStepRequests (tr);
>             stepRequest = getDebuggerImpl ().getVirtualMachine ().
>             eventRequestManager ().createStepRequest (
>                 tr,
>                 StepRequest.STEP_LINE,
>                 StepRequest.STEP_INTO
>             );
>             getDebuggerImpl ().getOperator ().register (stepRequest, this);
>             stepRequest.setSuspendPolicy (getDebuggerImpl ().getSuspend ());
> 
>             if (ssverbose)
>                 System.out.println("SS:    set patterns:");
>             addPatternsToRequest (
>                 getSmartSteppingFilterImpl ().getExclusionPatterns ()
>             );
>             stepRequest.enable ();
>         }
