void (@NotNull Result result) { ModalityUiUtil.invokeLaterIfNeeded(ModalityState.defaultModalityState(), () -> { if (!myProject.isDisposed()) { myEventPublisher.finished(result); } myPromise.setResult(result); }); }