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

The following examples show how to use com.intellij.execution.process.ProcessHandler#getUserData() . 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: LaunchState.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Returns the currently running app for the given RunConfig, if any.
 */
@Nullable
public static ProcessHandler getRunningAppProcess(RunConfig config) {
  final Project project = config.getProject();
  final List<RunContentDescriptor> runningProcesses =
    ExecutionManager.getInstance(project).getContentManager().getAllDescriptors();

  for (RunContentDescriptor descriptor : runningProcesses) {
    final ProcessHandler process = descriptor.getProcessHandler();
    if (process != null && !process.isProcessTerminated() && process.getUserData(FLUTTER_RUN_CONFIG_KEY) == config) {
      return process;
    }
  }

  return null;
}
 
Example 2
Source File: LaunchState.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Returns the currently running app for the given RunConfig, if any.
 */
@Nullable
public static ProcessHandler getRunningAppProcess(RunConfig config) {
  final Project project = config.getProject();
  final List<RunContentDescriptor> runningProcesses =
    ExecutionManager.getInstance(project).getContentManager().getAllDescriptors();

  for (RunContentDescriptor descriptor : runningProcesses) {
    final ProcessHandler process = descriptor.getProcessHandler();
    if (process != null && !process.isProcessTerminated() && process.getUserData(FLUTTER_RUN_CONFIG_KEY) == config) {
      return process;
    }
  }

  return null;
}
 
Example 3
Source File: RunDashboardContributor.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * Returns node's status. Subclasses may override this method to provide custom statuses.
 * @param node dashboard node
 * @return node's status. Returned status is used for grouping nodes by status.
 */
public DashboardRunConfigurationStatus getStatus(DashboardRunConfigurationNode node) {
  RunContentDescriptor descriptor = node.getDescriptor();
  if (descriptor == null) {
    return DashboardRunConfigurationStatus.STOPPED;
  }
  ProcessHandler processHandler = descriptor.getProcessHandler();
  if (processHandler == null) {
    return DashboardRunConfigurationStatus.STOPPED;
  }
  Integer exitCode = processHandler.getExitCode();
  if (exitCode == null) {
    return DashboardRunConfigurationStatus.STARTED;
  }
  Boolean terminationRequested = processHandler.getUserData(ProcessHandler.TERMINATION_REQUESTED);
  if (exitCode == 0 || (terminationRequested != null && terminationRequested)) {
    return DashboardRunConfigurationStatus.STOPPED;
  }
  return DashboardRunConfigurationStatus.FAILED;
}
 
Example 4
Source File: FlutterApp.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nullable
public static FlutterApp fromProcess(@NotNull ProcessHandler process) {
  return process.getUserData(FLUTTER_APP_KEY);
}
 
Example 5
Source File: FlutterApp.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Nullable
public static FlutterApp fromProcess(@NotNull ProcessHandler process) {
  return process.getUserData(FLUTTER_APP_KEY);
}