public void handleDebugEvents(DebugEvent[] events) { DebugEvent event; for (int i= 0, numEvents= events.length; i < numEvents; i++) { event= events[i]; if ((event.getKind() & DebugEvent.SUSPEND) != 0 && event.getSource() instanceof IJavaThread && event.isEvaluation()) { fTerminated= true; } } DebugPlugin.getDefault(). removeDebugEventListener(this); }
@Override public void handleDebugEvents(DebugEvent[] events) { // open the debugger if this is a suspend event and the debug view is not yet open // and the preferences are set to switch for (int i = 0; i < events.length; i++) { DebugEvent event = events[i]; if (event.getKind() == DebugEvent.SUSPEND && !event.isEvaluation() && event.getDetail() != DebugEvent.STEP_END) { // Don't switch perspective for evaluations or stepping Object source = event.getSource(); if (source instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) source; ILaunch launch = adaptable.getAdapter(ILaunch.class); if (fLaunch.equals(launch)) { // only notify for this launch notifySuspend(event); } } } } }
/** * Dispatches a resume event. By default, if the resume is for an evaluation * or a step, a timer is started to update the event source if the step or * evaluation takes more than 500ms. Otherwise the source is refreshed. * Subclasses may override. * * @param event */ protected void dispatchResume(DebugEventHandler handler, DebugEvent event) { if (event.isEvaluation() || event.isStepStart()) { // start a timer to update if the corresponding suspend does not // come quickly synchronized (this) { if (!isDisposed()) { PendingSuspendTask task = new PendingSuspendTask(handler, event); fTimerTasks.put(event.getSource(), task); fTimer.schedule(task, 500); } } if (!isDisposed()) { handler.handleResumeExpectingSuspend(event); } } else { handler.handleResume(event); } }
@Override protected void handleLateSuspend(DebugEvent suspend, DebugEvent resume) { IThread thread = queueSuspendedThread(suspend); if (suspend.isEvaluation() && suspend.getDetail() == DebugEvent.EVALUATION_IMPLICIT) { // late implicit evaluation - update thread and frame ModelDelta delta = buildRootDelta(); ModelDelta node = addPathToThread(delta, thread); node = node.addNode(thread, IModelDelta.STATE); try { IStackFrame frame = thread.getTopStackFrame(); if (frame != null) { node.addNode(frame, IModelDelta.STATE); fireDelta(delta); } } catch (DebugException e) { } } else { fireDeltaUpdatingSelectedFrame(thread, IModelDelta.STATE | IModelDelta.EXPAND, suspend); } }
case DebugEvent.TERMINATE: case DebugEvent.RESUME: if (!event.isEvaluation()) { Job uijob = new UIJob("clear source selection") { //$NON-NLS-1$ @Override
@Override protected void handleSuspend(DebugEvent event) { IThread thread = (IThread) event.getSource(); if (event.isEvaluation()) { ModelDelta delta = buildRootDelta(); ModelDelta node = addPathToThread(delta, thread);