/** @return the status text for the thread */ private String statusText() { if (thread.status() == ThreadReference.THREAD_STATUS_ZOMBIE) { return ZOMBIE_STATUS; } else if (state == SUSPENDED) { if (breakpoints.size() > 0) { try { JSDIBreakpoint breakpoint = (JSDIBreakpoint) breakpoints.get(0); if (breakpoint instanceof JSDIScriptLoadBreakpoint) { return NLS.bind( ModelMessages.JSDIThread_suspended_loading_script, breakpoint.getScriptPath()); } } catch (CoreException ce) { // TODO log this ce.printStackTrace(); } } return SUSPENDED_STATUS; } return RUNNING_STATUS; }
/* * (non-Javadoc) * * @see org.eclipse.e4.languages.javascript.debug.model.IJSDIEventListener#eventSetComplete(org.eclipse.e4.languages.javascript.jsdi.event.Event, org.eclipse.e4.languages.javascript.debug.model.JSDIDebugTarget, boolean, org.eclipse.e4.languages.javascript.jsdi.event.EventSet) */ public void eventSetComplete( Event event, JSDIDebugTarget target, boolean suspend, EventSet eventSet) { if (event instanceof SuspendEvent) { SuspendEvent suspendEvent = (SuspendEvent) event; ThreadReference threadReference = suspendEvent.thread(); if (threadReference == this.thread) { fireSuspendEvent(DebugEvent.CLIENT_REQUEST); } EventRequestManager requestManager = thread.virtualMachine().eventRequestManager(); requestManager.deleteEventRequest(event.request()); getJSDITarget().removeJSDIEventListener(this, event.request()); } if (event instanceof StepEvent) { StepEvent stepEvent = (StepEvent) event; ThreadReference threadReference = stepEvent.thread(); if (threadReference == this.thread) { fireSuspendEvent(DebugEvent.STEP_END); } EventRequestManager requestManager = this.thread.virtualMachine().eventRequestManager(); requestManager.deleteEventRequest(event.request()); getJSDITarget().addJSDIEventListener(this, event.request()); } }
/** * Constructor * * @param target the target the thread belongs to * @param thread the underlying {@link ThreadReference} */ public JSDIThread(JSDIDebugTarget target, ThreadReference thread) { super(target); this.thread = thread; this.state = thread.isSuspended() ? SUSPENDED : RUNNING; }
/* * (non-Javadoc) * * @see org.eclipse.debug.core.model.IThread#getName() */ public String getName() throws DebugException { // TODO NLS this return NLS.bind( "Thread [{0}] ({1})", new String[] {thread.name(), statusText()}); // $NON-NLS-1$ }