Java Code Examples for com.intellij.execution.process.ProcessHandler#detachProcess()

The following examples show how to use com.intellij.execution.process.ProcessHandler#detachProcess() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServerConnectionManager.java    From aem-ide-tooling-4-intellij with Apache License 2.0 6 votes vote down vote up
public void stopDebugConnection(@NotNull DataContext dataContext) {
    ProcessHandler processHandler = getHandler(dataContext);
    if(processHandler instanceof KillableProcess && processHandler.isProcessTerminating()) {
        ((KillableProcess) processHandler).killProcess();
        return;
    }

    ServerConfiguration serverConfiguration = selectionHandler.getCurrentConfiguration();
    if(serverConfiguration != null) {
        serverConfiguration.setServerStatus(ServerConfiguration.ServerStatus.disconnecting);
    }
    if(processHandler != null) {
        if(processHandler.detachIsDefault()) {
            processHandler.detachProcess();
        } else {
            processHandler.destroyProcess();
        }
    }
    if(serverConfiguration != null) {
        serverConfiguration.setServerStatus(ServerConfiguration.ServerStatus.disconnected);
    }
}
 
Example 2
Source File: RunContentManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private boolean closeQuery(boolean modal) {
  final RunContentDescriptor descriptor = getRunContentDescriptorByContent(myContent);
  if (descriptor == null) {
    return true;
  }

  final ProcessHandler processHandler = descriptor.getProcessHandler();
  if (processHandler == null || processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) {
    return true;
  }
  GeneralSettings.ProcessCloseConfirmation rc = TerminateRemoteProcessDialog.show(myProject, descriptor.getDisplayName(), processHandler);
  if (rc == null) { // cancel
    return false;
  }
  boolean destroyProcess = rc == GeneralSettings.ProcessCloseConfirmation.TERMINATE;
  if (destroyProcess) {
    processHandler.destroyProcess();
  }
  else {
    processHandler.detachProcess();
  }
  waitForProcess(descriptor, modal);
  return true;
}
 
Example 3
Source File: ExecutionManagerImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
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;
  }

  if (!processHandler.isProcessTerminated()) {
    if (processHandler.detachIsDefault()) {
      processHandler.detachProcess();
    }
    else {
      processHandler.destroyProcess();
    }
  }
}
 
Example 4
Source File: XDebugSessionImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void stop() {
  ProcessHandler processHandler = myDebugProcess == null ? null : myDebugProcess.getProcessHandler();
  if (processHandler == null || processHandler.isProcessTerminated() || processHandler.isProcessTerminating()) return;

  if (processHandler.detachIsDefault()) {
    processHandler.detachProcess();
  }
  else {
    processHandler.destroyProcess();
  }
}
 
Example 5
Source File: StopProcessAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void stopProcess(@Nonnull 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.detachIsDefault()) {
    processHandler.detachProcess();
  }
  else {
    processHandler.destroyProcess();
  }
}