void (@NotNull ActionCallback callback) { AsyncPromise<?> promise = new AsyncPromise<>(); callback.doWhenDone(() -> promise.setResult(null)).doWhenRejected((@NotNull Runnable)promise::cancel); waitForPromise(promise); }