String (@NotNull Editor editor, @NotNull Function<? super DocumentationComponent, String> componentEvaluator) { Project project = editor.getProject(); PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); DocumentationManager documentationManager = DocumentationManager.getInstance(project); MockDocumentationComponent documentationComponent = new MockDocumentationComponent(documentationManager); try { documentationManager.setDocumentationComponent(documentationComponent); documentationManager.showJavaDocInfo(editor, psiFile, false); try { waitTillDone(documentationManager.getLastAction()); } catch (InterruptedException e) { throw new RuntimeException(e); } return componentEvaluator.fun(documentationComponent); } finally { JBPopup hint = documentationComponent.getHint(); if (hint != null) Disposer.dispose(hint); Disposer.dispose(documentationComponent); } }