private Future<?> getSlowCheck(FacetEditorValidator validator) {
      assert validator instanceof SlowFacetEditorValidator;

      Ref<Future<?>> ref = new Ref<>();
      Future<?> result;
      CompletableFuture<ValidationResult> check = ((SlowFacetEditorValidator)validator).checkAsync();

      // Current modality state could not be used,
      // because validate() may be called on facet editor init
      // before dialog's show() changes modality state from non-modal.
      if (check != null) {
        result = check.thenAccept(validationResult -> {
          AppUIExecutor.onUiThread(ModalityState.any()).expireWith(myParentDisposable).submit(() -> {
            validationCompleted(ref, validationResult);
          });
        });
      }
      else {
        result = ReadAction
          .nonBlocking(() -> validator.check())
          .expireWith(myParentDisposable)
          .finishOnUiThread(ModalityState.any(), validationResult -> {
            validationCompleted(ref, validationResult);
          })
          .submit(NonUrgentExecutor.getInstance());
      }

      ref.set(result);
      return result;
    }
private Future<?> getSlowCheck(FacetEditorValidator validator)