1 19 20 package org.netbeans.modules.debugger.jpda.breakpoints; 21 22 23 import com.sun.jdi.ThreadReference; 24 import com.sun.jdi.VMDisconnectedException; 25 import com.sun.jdi.VirtualMachine; 26 import com.sun.jdi.event.Event; 27 import com.sun.jdi.event.ThreadDeathEvent; 28 import com.sun.jdi.event.ThreadStartEvent; 29 import com.sun.jdi.request.ThreadDeathRequest; 30 import com.sun.jdi.request.ThreadStartRequest; 31 32 import org.netbeans.api.debugger.Session; 33 import org.netbeans.api.debugger.jpda.ThreadBreakpoint; 34 import org.netbeans.modules.debugger.jpda.JPDADebuggerImpl; 35 36 import org.netbeans.modules.debugger.jpda.util.Executor; 37 38 39 44 public class ThreadBreakpointImpl extends BreakpointImpl implements Executor { 45 46 48 private ThreadBreakpoint breakpoint; 49 50 51 53 public ThreadBreakpointImpl (ThreadBreakpoint presenter, JPDADebuggerImpl debugger, Session session) { 54 super (presenter, null, debugger, session); 55 breakpoint = presenter; 56 set (); 57 } 58 59 60 62 protected void setRequests () { 63 try { 64 if ( (breakpoint.getBreakpointType () & 65 breakpoint.TYPE_THREAD_STARTED ) != 0 66 ) { 67 ThreadStartRequest tsr = getEventRequestManager (). 68 createThreadStartRequest (); 69 addEventRequest (tsr); 70 } 71 if ( (breakpoint.getBreakpointType () & 72 breakpoint.TYPE_THREAD_DEATH) != 0 73 ) { 74 VirtualMachine vm = getVirtualMachine(); 75 if (vm != null) { 76 ThreadDeathRequest tdr = vm.eventRequestManager(). 77 createThreadDeathRequest(); 78 addEventRequest (tdr); 79 } 80 } 81 } catch (VMDisconnectedException e) { 82 } 83 } 84 85 public boolean exec (Event event) { 86 ThreadReference thread = null; 87 if (event instanceof ThreadStartEvent) 88 thread = ((ThreadStartEvent) event).thread (); 89 else 90 if (event instanceof ThreadDeathEvent) 91 thread = ((ThreadDeathEvent) event).thread (); 92 93 return perform ( 94 null, 95 thread, 96 null, 97 thread 98 ); 99 } 100 } 101 | Popular Tags |