private @Nullable RunContentDescriptor executeJavaState(@NotNull RunProfileState state,
                                                          @NotNull ExecutionEnvironment env,
                                                          @Nullable ProcessProxy proxy) throws ExecutionException {
    ExecutionResult executionResult = state.execute(env.getExecutor(), this);
    if (proxy != null) {
      ProcessHandler handler = executionResult != null ? executionResult.getProcessHandler() : null;
      if (handler != null) {
        proxy.attach(handler);
        handler.addProcessListener(new ProcessAdapter() {
          @Override
          public void processTerminated(@NotNull ProcessEvent event) {
            proxy.destroy();
            handler.removeProcessListener(this);
          }
        });
      }
      else {
        proxy.destroy();
      }
    }

    if (executionResult == null) {
      return null;
    }

    AtomicReference<RunContentDescriptor> result = new AtomicReference<>();
    ApplicationManager.getApplication().invokeAndWait(() -> {
      RunContentBuilder contentBuilder = new RunContentBuilder(executionResult, env);
      if (!(state instanceof JavaCommandLineState) || ((JavaCommandLineState)state).shouldAddJavaProgramRunnerActions()) {
        addDefaultActions(contentBuilder, executionResult, state instanceof JavaCommandLine);
      }
      result.set(contentBuilder.showRunContent(env.getContentToReuse()));
    });
    return result.get();
  }
private @Nullable RunContentDescriptor executeJavaState(@NotNull RunProfileState state,
                                                          @NotNull ExecutionEnvironment env,
                                                          @Nullable ProcessProxy proxy)