@Override public void actionPerformed(AnActionEvent e) { final Project project = e.getProject(); if (project == null) { return; } DocumentationManager documentationManager = DocumentationManager.getInstance(project); final DocumentationComponent component = new DocumentationComponent(documentationManager); final Property property = myTable.getSelectionProperty(); if (property == null) { return; } PsiElement javadocElement = property.getJavadocElement(); ActionCallback callback; if (javadocElement == null) { callback = new ActionCallback(); component.setText(property.getJavadocText(), null, true); } else { callback = documentationManager.queueFetchDocInfo(javadocElement, component); } callback.doWhenProcessed(new Runnable() { public void run() { JBPopup hint = JBPopupFactory.getInstance().createComponentPopupBuilder(component, component) .setRequestFocusCondition(project, NotLookupOrSearchCondition.INSTANCE) .setProject(project) .setDimensionServiceKey(project, DocumentationManager.JAVADOC_LOCATION_AND_SIZE, false) .setResizable(true) .setMovable(true) .setRequestFocus(true) .setTitle(DesignerBundle.message("designer.properties.javadoc.title", property.getName())) .setCancelCallback(new Computable<Boolean>() { @Override public Boolean compute() { Disposer.dispose(component); return Boolean.TRUE; } }) .createPopup(); component.setHint(hint); Disposer.register(hint, component); hint.show(new RelativePoint(myTable.getParent(), new Point(0, 0))); } }); if (javadocElement == null) { callback.setDone(); } }
@Override public void actionPerformed(AnActionEvent e) { final Project project = e.getProject(); if (project == null) { return; } DocumentationManager documentationManager = DocumentationManager.getInstance(project); final DocumentationComponent component = new DocumentationComponent(documentationManager); final Property property = myTable.getSelectionProperty(); if (property == null) { return; } PsiElement javadocElement = property.getJavadocElement(); ActionCallback callback; if (javadocElement == null) { callback = new ActionCallback(); component.setText(property.getJavadocText(), null, true); } else { callback = documentationManager.queueFetchDocInfo(javadocElement, component); } callback.doWhenProcessed(new Runnable() { public void run() { JBPopup hint = JBPopupFactory.getInstance().createComponentPopupBuilder(component, component) .setRequestFocusCondition(project, NotLookupOrSearchCondition.INSTANCE) .setProject(project) .setDimensionServiceKey(project, DocumentationManager.JAVADOC_LOCATION_AND_SIZE, false) .setResizable(true) .setMovable(true) .setRequestFocus(true) .setTitle(CordovaDesignerBundle.message("designer.properties.javadoc.title", property.getName())) .setCancelCallback(new Computable<Boolean>() { @Override public Boolean compute() { Disposer.dispose(component); return Boolean.TRUE; } }) .createPopup(); component.setHint(hint); Disposer.register(hint, component); hint.show(new RelativePoint(myTable.getParent(), new Point(0, 0))); } }); if (javadocElement == null) { callback.setDone(); } }