List<AnAction> (Runnable restartWork, ProgressIndicator indicator) { List<AnAction> restartActions = new SmartList<>(); if (restartWork != null) { AnAction restartAction = new DumbAwareAction( ExecutionBundle.messagePointer("rerun.configuration.action.name", escapeMnemonics(myContentName)), Presentation.NULL_STRING, AllIcons.Actions.Compile) { @Override public void actionPerformed(@NotNull AnActionEvent e) { restartWork.run(); } @Override public void update(@NotNull AnActionEvent e) { e.getPresentation().setEnabled(!indicator.isRunning()); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.BGT; } }; restartActions.add(restartAction); } AnAction stopAction = new DumbAwareAction(IdeBundle.messagePointer("action.stop"), AllIcons.Actions.Suspend) { @Override public void actionPerformed(@NotNull AnActionEvent e) { indicator.cancel(); } @Override public void update(@NotNull AnActionEvent event) { event.getPresentation().setEnabled(indicator.isRunning()); } @Override public @NotNull ActionUpdateThread getActionUpdateThread() { return ActionUpdateThread.BGT; } }; restartActions.add(stopAction); return restartActions; }