Ejemplo n.º 1
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"));
   }
 }
Ejemplo n.º 2
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());
  }
 @Override
 public void update(final AnActionEvent e) {
   final Presentation presentation = e.getPresentation();
   final Project project = e.getData(CommonDataKeys.PROJECT);
   if (project == null) {
     disable(presentation);
     return;
   }
   RunnerAndConfigurationSettings settings = chooseTempSettings(project);
   if (settings == null) {
     disable(presentation);
   } else {
     presentation.setText(
         ExecutionBundle.message(
             "save.temporary.run.configuration.action.name", settings.getName()));
     presentation.setDescription(presentation.getText());
     presentation.setVisible(true);
     presentation.setEnabled(true);
   }
 }
 @Override
 public void update(AnActionEvent e) {
   Presentation presentation = e.getPresentation();
   Project project = e.getData(CommonDataKeys.PROJECT);
   if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace())) {
     presentation.setDescription(
         ExecutionBundle.message("choose.run.configuration.action.description"));
   }
   try {
     if (project == null || project.isDisposed() || !project.isInitialized()) {
       updatePresentation(null, null, null, presentation);
       presentation.setEnabled(false);
     } else {
       updatePresentation(
           ExecutionTargetManager.getActiveTarget(project),
           RunManagerEx.getInstanceEx(project).getSelectedConfiguration(),
           project,
           presentation);
       presentation.setEnabled(true);
     }
   } catch (IndexNotReadyException e1) {
     presentation.setEnabled(false);
   }
 }