

package cz.karry.dop.nbmodule.dbg;

import cz.karry.dop.nbmodule.dbg.actions.StartActionProvider;
import cz.karry.dop.nbmodule.dbg.api.Debugger;
import org.netbeans.api.debugger.DebuggerEngine;
import org.netbeans.api.debugger.DebuggerInfo;
import org.netbeans.api.debugger.DebuggerManager;


public class DebuggerImpl implements Debugger{

    private SessionId myId;

    public void debug(SessionId id) {
        this.myId = id;
        
        DebuggerInfo dInfo = DebuggerInfo.create( ID ,new Object[] {id });
        
        DebuggerEngine[] engines = 
            DebuggerManager.getDebuggerManager().startDebugging(dInfo);
        /*
         * See StartActionProvider interface description about this code. 
         */
        String sessionName = null;
        for (DebuggerEngine engine : engines) {
            StartActionProvider provider = 
                (StartActionProvider)engine.lookupFirst( null , 
                        StartActionProvider.class );
            if ( provider == null ){
                continue;
            }
            provider.start( );
            
        }
        
    }

}
