void (@NotNull CompletableFuture<? extends PsiElement> elementFuture, boolean requestFocus, @NotNull PopupUpdateProcessor updateProcessor, PsiElement originalElement, @Nullable Runnable closeCallback, @Nullable @Nls String documentation, boolean useStoredPopupSize, boolean onAutoUpdate) { if (!myProject.isOpen()) return; PsiElement targetElement = null; try { //try to get target element if possible (in case when element can be resolved fast) targetElement = elementFuture.get(50, TimeUnit.MILLISECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { LOG.debug("Failed to calculate targetElement in 50ms", e); } if (targetElement != null) { doShowJavaDocInfo(targetElement, requestFocus, updateProcessor, originalElement, closeCallback, documentation, useStoredPopupSize, onAutoUpdate); } else { ActionCallback actionCallback = createActionCallback(); elementFuture.thenAccept(element -> { if (element != null) { AppUIUtil.invokeOnEdt(() -> { doShowJavaDocInfo(element, requestFocus, updateProcessor, originalElement, closeCallback, actionCallback, documentation, useStoredPopupSize, onAutoUpdate); }); } }); } }