AsyncResult<Boolean> () { if (isModal()) { throw new IllegalStateException("The showAndGetOk() method is for modeless dialogs only"); } AsyncResult<Boolean> result = new AsyncResult<>(); Disposer.register(myDisposable, () -> result.setDone(isOK())); doShow(); return result; }