mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
RuntimeDashboardContributor: distinguish failed and stopped by a user run configurations
This commit is contained in:
+5
-1
@@ -67,7 +67,11 @@ public abstract class RuntimeDashboardContributor {
|
||||
if (exitCode == null) {
|
||||
return DashboardRunConfigurationStatus.STARTED;
|
||||
}
|
||||
return exitCode == 0 ? DashboardRunConfigurationStatus.STOPPED : DashboardRunConfigurationStatus.FAILED;
|
||||
Boolean terminationRequested = processHandler.getUserData(ProcessHandler.TERMINATION_REQUESTED);
|
||||
if (exitCode == 0 || (terminationRequested != null && terminationRequested)) {
|
||||
return DashboardRunConfigurationStatus.STOPPED;
|
||||
}
|
||||
return DashboardRunConfigurationStatus.FAILED;
|
||||
}
|
||||
|
||||
public static RuntimeDashboardContributor getContributor(ConfigurationType type) {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.execution.actions;
|
||||
|
||||
import com.intellij.execution.KillableProcess;
|
||||
import com.intellij.execution.impl.ExecutionManagerImpl;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
@@ -31,7 +32,6 @@ import javax.swing.*;
|
||||
* @author Sergey Simonchik
|
||||
*/
|
||||
public class StopProcessAction extends DumbAwareAction implements AnAction.TransparentUpdate {
|
||||
|
||||
private ProcessHandler myProcessHandler;
|
||||
|
||||
public StopProcessAction(@NotNull String text, @Nullable String description, @Nullable ProcessHandler processHandler) {
|
||||
@@ -70,28 +70,12 @@ public class StopProcessAction extends DumbAwareAction implements AnAction.Trans
|
||||
presentation.setDescription(description);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
stopProcess(myProcessHandler);
|
||||
}
|
||||
|
||||
public static void stopProcess(@Nullable ProcessHandler processHandler) {
|
||||
if (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
|
||||
// process termination was requested, but it's still alive
|
||||
// in this case 'force quit' will be performed
|
||||
((KillableProcess)processHandler).killProcess();
|
||||
return;
|
||||
}
|
||||
|
||||
if (processHandler != null) {
|
||||
if (processHandler.detachIsDefault()) {
|
||||
processHandler.detachProcess();
|
||||
}
|
||||
else {
|
||||
processHandler.destroyProcess();
|
||||
}
|
||||
}
|
||||
ExecutionManagerImpl.stopProcess(processHandler);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -220,12 +220,19 @@ public class ExecutionManagerImpl extends ExecutionManager implements Disposable
|
||||
}
|
||||
|
||||
public static void stopProcess(@Nullable RunContentDescriptor descriptor) {
|
||||
ProcessHandler processHandler = descriptor != null ? descriptor.getProcessHandler() : null;
|
||||
stopProcess(descriptor != null ? descriptor.getProcessHandler() : null);
|
||||
}
|
||||
|
||||
public static void stopProcess(@Nullable ProcessHandler processHandler) {
|
||||
if (processHandler == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
processHandler.putUserData(ProcessHandler.TERMINATION_REQUESTED, Boolean.TRUE);
|
||||
|
||||
if (processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
|
||||
// process termination was requested, but it's still alive
|
||||
// in this case 'force quit' will be performed
|
||||
((KillableProcess)processHandler).killProcess();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public abstract class ProcessHandler extends UserDataHolderBase {
|
||||
* @deprecated
|
||||
*/
|
||||
public static final Key<Boolean> SILENTLY_DESTROY_ON_CLOSE = Key.create("SILENTLY_DESTROY_ON_CLOSE");
|
||||
public static final Key<Boolean> TERMINATION_REQUESTED = Key.create("TERMINATION_REQUESTED");
|
||||
|
||||
private final List<ProcessListener> myListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user