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"));
   }
 }
 @Override
 public void actionPerformed(AnActionEvent e) {
   final Project project = e.getProject();
   LOG.assertTrue(project != null);
   final VirtualFile file = getFile(project);
   if (file != null) {
     try {
       final ImportRunProfile profile = new ImportRunProfile(file, project);
       SMTRunnerConsoleProperties properties = profile.getProperties();
       if (properties == null) {
         properties = myProperties;
         LOG.info(
             "Failed to detect test framework in "
                 + file.getPath()
                 + "; use "
                 + (properties != null
                     ? properties.getTestFrameworkName() + " from toolbar"
                     : "no properties"));
       }
       final Executor executor =
           properties != null
               ? properties.getExecutor()
               : ExecutorRegistry.getInstance().getExecutorById(DefaultRunExecutor.EXECUTOR_ID);
       ExecutionEnvironmentBuilder builder =
           ExecutionEnvironmentBuilder.create(project, executor, profile);
       final RunConfiguration initialConfiguration = profile.getInitialConfiguration();
       final ProgramRunner runner =
           initialConfiguration != null
               ? RunnerRegistry.getInstance().getRunner(executor.getId(), initialConfiguration)
               : null;
       if (runner != null) {
         builder = builder.runner(runner);
       }
       builder.buildAndExecute();
     } catch (ExecutionException e1) {
       Messages.showErrorDialog(project, e1.getMessage(), "Import Failed");
     }
   }
 }
  public static void handleExecutionError(
      @NotNull final Project project,
      @NotNull final String toolWindowId,
      @NotNull String taskName,
      @NotNull ExecutionException e) {
    if (e instanceof RunCanceledByUserException) {
      return;
    }

    LOG.debug(e);

    String description = e.getMessage();
    if (description == null) {
      LOG.warn("Execution error without description", e);
      description = "Unknown error";
    }

    HyperlinkListener listener = null;
    if ((description.contains("87") || description.contains("111") || description.contains("206"))
        && e instanceof ProcessNotCreatedException
        && !PropertiesComponent.getInstance(project).isTrueValue("dynamic.classpath")) {
      final String commandLineString =
          ((ProcessNotCreatedException) e).getCommandLine().getCommandLineString();
      if (commandLineString.length() > 1024 * 32) {
        description =
            "Command line is too long. In order to reduce its length classpath file can be used.<br>"
                + "Would you like to enable classpath file mode for all run configurations of your project?<br>"
                + "<a href=\"\">Enable</a>";

        listener =
            new HyperlinkListener() {
              @Override
              public void hyperlinkUpdate(HyperlinkEvent event) {
                PropertiesComponent.getInstance(project).setValue("dynamic.classpath", "true");
              }
            };
      }
    }
    final String title = ExecutionBundle.message("error.running.configuration.message", taskName);
    final String fullMessage = title + ":<br>" + description;

    if (ApplicationManager.getApplication().isUnitTestMode()) {
      LOG.error(fullMessage, e);
    }

    if (listener == null && e instanceof HyperlinkListener) {
      listener = (HyperlinkListener) e;
    }

    final HyperlinkListener finalListener = listener;
    final String finalDescription = description;
    UIUtil.invokeLaterIfNeeded(
        new Runnable() {
          @Override
          public void run() {
            if (project.isDisposed()) {
              return;
            }

            ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(project);
            if (toolWindowManager.canShowNotification(toolWindowId)) {
              //noinspection SSBasedInspection
              toolWindowManager.notifyByBalloon(
                  toolWindowId, MessageType.ERROR, fullMessage, null, finalListener);
            } else {
              Messages.showErrorDialog(project, UIUtil.toHtml(fullMessage), "");
            }
            NotificationListener notificationListener =
                finalListener == null
                    ? null
                    : new NotificationListener() {
                      @Override
                      public void hyperlinkUpdate(
                          @NotNull Notification notification, @NotNull HyperlinkEvent event) {
                        finalListener.hyperlinkUpdate(event);
                      }
                    };
            ourNotificationGroup
                .createNotification(
                    title, finalDescription, NotificationType.ERROR, notificationListener)
                .notify(project);
          }
        });
  }