Promise<DataContext> () { AsyncPromise<DataContext> result = new AsyncPromise<>(); IdeFocusManager.getGlobalInstance() .doWhenFocusSettlesDown(() -> result.setResult(getDataContext()), ModalityState.defaultModalityState()); return result; }