public static void chooseAndOverrideOrImplementMethods(final Project project,
                                                         final Editor editor,
                                                         @NotNull PsiClass aClass,
                                                         final boolean toImplement) {
    NonBlockingReadAction<JavaOverrideImplementMemberChooserContainer> prepareChooserTask = ReadAction.nonBlocking(() -> {
        return prepareChooser(aClass, toImplement);
      })
      .expireWhen(() -> !aClass.isValid());

    if (ApplicationManager.getApplication().isHeadlessEnvironment()) {
      showAndPerform(project, editor, aClass, toImplement, prepareChooserTask.executeSynchronously());
    } else {
      prepareChooserTask.finishOnUiThread(ModalityState.defaultModalityState(), container -> {
        showAndPerform(project, editor, aClass, toImplement, container);
      }).submit(AppExecutorUtil.getAppExecutorService());
    }
  }
public static void chooseAndOverrideOrImplementMethods(final Project project,
                                                         final Editor editor,
                                                         @NotNull PsiClass aClass,
                                                         final boolean toImplement)