public static void handleExecutionError(
     @NotNull ExecutionEnvironment environment, @NotNull ExecutionException e) {
   handleExecutionError(
       environment.getProject(),
       environment.getExecutor().getToolWindowId(),
       environment.getRunProfile().getName(),
       e);
 }
Exemplo n.º 2
0
 boolean isEnabled() {
   ProcessHandler processHandler = myDescriptor.getProcessHandler();
   boolean isTerminating = processHandler != null && processHandler.isProcessTerminating();
   boolean isStarting =
       ExecutorRegistry.getInstance()
           .isStarting(myEnvironment.getProject(), myExecutor.getId(), myRunner.getRunnerId());
   return !isStarting && !isTerminating;
 }
Exemplo n.º 3
0
  @Override
  public void update(final AnActionEvent event) {
    final Presentation presentation = event.getPresentation();
    String name = myEnvironment.getRunProfile().getName();
    ProcessHandler processHandler = myDescriptor.getProcessHandler();
    final boolean isRunning = processHandler != null && !processHandler.isProcessTerminated();

    presentation.setText(ExecutionBundle.message("rerun.configuration.action.name", name));
    presentation.setIcon(isRunning ? AllIcons.Actions.Restart : myExecutor.getIcon());
    presentation.setEnabled(isEnabled());
  }
Exemplo n.º 4
0
 public void restart() {
   final Project project =
       PlatformDataKeys.PROJECT.getData(
           DataManager.getInstance().getDataContext(myDescriptor.getComponent()));
   if (ExecutorRegistry.getInstance()
       .isStarting(project, myExecutor.getId(), myRunner.getRunnerId())) {
     return;
   }
   try {
     final ExecutionEnvironment old = myEnvironment;
     myRunner.execute(
         myExecutor,
         new ExecutionEnvironment(
             old.getRunProfile(),
             old.getExecutionTarget(),
             project,
             old.getRunnerSettings(),
             old.getConfigurationSettings(),
             myDescriptor,
             old.getRunnerAndConfigurationSettings()));
   } catch (RunCanceledByUserException ignore) {
   } catch (ExecutionException e1) {
     Messages.showErrorDialog(
         project, e1.getMessage(), ExecutionBundle.message("restart.error.message.title"));
   }
 }
Exemplo n.º 5
0
 @Override
 public void actionPerformed(final AnActionEvent e) {
   Project project = myEnvironment.getProject();
   if (project == null) return;
   if (myProcessHandler != null) {
     ExecutionManager.getInstance(project)
         .restartRunProfile(
             project,
             myExecutor,
             myEnvironment.getExecutionTarget(),
             myEnvironment.getRunnerAndConfigurationSettings(),
             myProcessHandler);
   } else {
     ExecutionManager.getInstance(project)
         .restartRunProfile(
             project,
             myExecutor,
             myEnvironment.getExecutionTarget(),
             myEnvironment.getRunnerAndConfigurationSettings(),
             myDescriptor);
   }
 }
 public static void restart(@NotNull ExecutionEnvironment environment) {
   if (!ExecutorRegistry.getInstance().isStarting(environment)) {
     ExecutionManager.getInstance(environment.getProject()).restartRunProfile(environment);
   }
 }