public void handleDebugEvents(DebugEvent[] events) {
      if (events != null && project != null) {
        int size = events.length;
        for (int i = 0; i < size; i++) {
          for (IProcess process : processes) {
            if (process != null
                && process.equals(events[i].getSource())
                && events[i].getKind() == DebugEvent.TERMINATE) {

              DebugPlugin.getDefault().removeDebugEventListener(this);
              terminateForked();
              Job job =
                  new Job("refresh project") {

                    @Override
                    protected IStatus run(IProgressMonitor monitor) {
                      try {
                        project.refreshLocal(IResource.DEPTH_INFINITE, monitor);
                      } catch (CoreException e) {
                      }
                      GrailsCoreActivator.getDefault().notifyCommandFinish(project);
                      return Status.OK_STATUS;
                    }
                  };
              job.setSystem(true);
              job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
              job.setPriority(Job.INTERACTIVE);
              job.schedule();
            }
          }
        }
      }
    }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener
  * #contextEvent
  * (org.eclipse.debug.internal.ui.contexts.provisional.DebugContextEvent)
  */
 public void debugContextChanged(final DebugContextEvent event) {
   if ((event.getFlags() & DebugContextEvent.ACTIVATED) > 0) {
     IProcess process = getProcess();
     if (fView != null && process != null && process.equals(DebugUITools.getCurrentProcess())) {
       fView.display(fConsole);
     }
   }
 }