Java 类org.eclipse.debug.core.IStatusHandler 实例源码

项目:statecharts    文件:AbstractExecutionFlowSimulationEngine.java   
@Override
public void init() {
    try {
        ListBasedValidationIssueAcceptor acceptor = new ListBasedValidationIssueAcceptor();
        ExecutionFlow flow = sequencer.transform(statechart, acceptor);
        if (acceptor.getTraces(Severity.ERROR).size() > 0) {
            Status errorStatus = new Status(Status.ERROR, SimulationCoreActivator.PLUGIN_ID,
                    ERROR_DURING_SIMULATION, acceptor.getTraces(Severity.ERROR).iterator().next().toString(), null);
            IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(errorStatus);
            try {
                statusHandler.handleStatus(errorStatus, getDebugTarget());
            } catch (CoreException e) {
                e.printStackTrace();
            }
        }

        if (!context.isSnapshot()) {
            contextInitializer.initialize(context, flow);
        }
        interpreter.initialize(flow, context, useInternalEventQueue());
    } catch (Exception ex) {
        handleException(ex);
        throw new InitializationException(ex.getMessage());
    }
}
项目:statecharts    文件:AbstractSimulationEngine.java   
protected void handleException(Throwable t) {
    if (t instanceof WrappedException) {
        t = ((WrappedException) t).getCause();
    }
    String statusMessage = t.getMessage() == null ? ERROR_MSG : t.getMessage();
    Status errorStatus = new Status(Status.ERROR, SimulationCoreActivator.PLUGIN_ID, ERROR_DURING_SIMULATION,
            statusMessage, t);
    SimulationCoreActivator.getDefault().getLog().log(errorStatus);
    IStatusHandler statusHandler = DebugPlugin.getDefault().getStatusHandler(errorStatus);
    try {
        statusHandler.handleStatus(errorStatus, getDebugTarget());
    } catch (CoreException e) {
        e.printStackTrace();
    } finally {
        terminate();
    }
}
项目:eclemma    文件:EclEmmaCorePlugin.java   
/**
 * Issues an user prompt using the status handler registered for the given
 * status.
 *
 * @param status
 *          IStatus object to find prompter for
 * @param info
 *          additional information passed to the handler
 * @return boolean result returned by the status handler
 * @throws CoreException
 *           if the status has severity error and no handler is available
 */
private boolean showPrompt(IStatus status, Object info) throws CoreException {
  IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(
      PROMPT_STATUS);
  if (prompter == null) {
    if (status.getSeverity() == IStatus.ERROR) {
      throw new CoreException(status);
    } else {
      return true;
    }
  } else {
    return ((Boolean) prompter.handleStatus(status, info)).booleanValue();
  }
}
项目:google-cloud-eclipse    文件:LocalAppEngineServerLaunchConfigurationDelegate.java   
@Override
public boolean finalLaunchCheck(ILaunchConfiguration configuration, String mode,
    IProgressMonitor monitor) throws CoreException {
  SubMonitor progress = SubMonitor.convert(monitor, 40);
  if (!super.finalLaunchCheck(configuration, mode, progress.newChild(20))) {
    return false;
  }

  // If we're auto-publishing before launch, check if there may be stale
  // resources not yet published. See
  // https://github.com/GoogleCloudPlatform/google-cloud-eclipse/issues/1832
  if (ServerCore.isAutoPublishing() && ResourcesPlugin.getWorkspace().isAutoBuilding()) {
    // Must wait for any current autobuild to complete so resource changes are triggered
    // and WTP will kick off ResourceChangeJobs. Note that there may be builds
    // pending that are unrelated to our resource changes, so simply checking
    // <code>JobManager.find(FAMILY_AUTO_BUILD).length > 0</code> produces too many
    // false positives.
    try {
      Job.getJobManager().join(ResourcesPlugin.FAMILY_AUTO_BUILD, progress.newChild(20));
    } catch (InterruptedException ex) {
      /* ignore */
    }
    IServer server = ServerUtil.getServer(configuration);
    if (server.shouldPublish() || hasPendingChangesToPublish()) {
      IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
      if (prompter != null) {
        Object continueLaunch = prompter
            .handleStatus(StaleResourcesStatusHandler.CONTINUE_LAUNCH_REQUEST, configuration);
        if (!(Boolean) continueLaunch) {
          // cancel the launch so Server.StartJob won't raise an error dialog, since the
          // server won't have been started
          monitor.setCanceled(true);
          return false;
        }
        return true;
      }
    }
  }
  return true;
}