(WEB-36682) Take into account 'canPause' in PauseOutputAction

This commit is contained in:
Viktor Shatrov
2019-01-21 15:04:44 +03:00
parent c3a19ec11e
commit 2c8eafb7ab
@@ -42,23 +42,24 @@ public class PauseOutputAction extends ToggleAction implements DumbAware {
public void update(@NotNull AnActionEvent event) {
super.update(event);
final Presentation presentation = event.getPresentation();
RunContentDescriptor descriptor = StopAction.getRecentlyStartedContentDescriptor(event.getDataContext());
ProcessHandler handler = descriptor != null ? descriptor.getProcessHandler() : null;
if (handler != null && !handler.isProcessTerminated()) {
presentation.setEnabled(true);
ConsoleView consoleView = getConsoleView(event);
if (consoleView == null || !consoleView.canPause()) {
presentation.setEnabled(false);
return;
}
if (!consoleView.hasDeferredOutput()) {
presentation.setEnabled(false);
}
else {
ConsoleView consoleView = getConsoleView(event);
if (consoleView == null || !consoleView.canPause()) {
presentation.setEnabled(false);
return;
}
if (!consoleView.hasDeferredOutput()) {
presentation.setEnabled(false);
}
else {
RunContentDescriptor descriptor = StopAction.getRecentlyStartedContentDescriptor(event.getDataContext());
ProcessHandler handler = descriptor != null ? descriptor.getProcessHandler() : null;
if (handler != null && !handler.isProcessTerminated()) {
presentation.setEnabled(true);
}
else {
presentation.setEnabled(false);
}
}
}
}