1 19 20 package org.netbeans.modules.scripting.php.dbginterface.api; 21 22 import org.netbeans.api.debugger.DebuggerEngine; 23 import org.netbeans.api.debugger.DebuggerInfo; 24 import org.netbeans.api.debugger.DebuggerManager; 25 import org.netbeans.modules.scripting.php.dbginterface.DbgDebuggerImpl; 26 import org.openide.util.NbBundle; 27 28 32 public class DbgDebugger { 33 public static final String SESSION_ID = "netbeans-PHP-DBG-Session"; 34 public static final String ENGINE_ID = SESSION_ID + "/PHP-Engine"; 35 36 39 public static String startListening(DbgSourceMap sourceMap) 40 throws DebuggerStartException { 41 DebuggerInfo dInfo = DebuggerInfo.create(DbgDICookie.ID, 42 new Object [] { 43 DbgDICookie.create(), 44 sourceMap 45 }); 46 47 DebuggerEngine[] es = DebuggerManager.getDebuggerManager().startDebugging(dInfo); 48 49 for (int i = 0; i < es.length; i++) { 50 DbgDebuggerImpl d = (DbgDebuggerImpl) es[i].lookupFirst(null, DbgDebuggerImpl.class); 51 52 if (d == null) { 53 continue; 54 } 55 56 d.waitRunning(); 57 58 return d.getHost() + ":" + d.getPort(); 59 } 60 61 throw new DebuggerStartException(NbBundle.getMessage(DbgDebugger.class, "MSG_NO_DEBUGGER")); 62 } 63 } 64 | Popular Tags |