/** * Possibly compute the hover. Might return null * * @param hoverRegion * @param elements * @return */ private Object computeHover(IRegion hoverRegion, IJavaElement[] elements) { Object hover; hover = ReflectionUtils.executePrivateMethod( JavadocHover.class, "getHoverInfo", new Class[] { IJavaElement[].class, ITypeRoot.class, IRegion.class, JavadocBrowserInformationControlInput.class }, this, new Object[] {elements, getEditorInputJavaElement(), hoverRegion, null}); if (hover instanceof JavadocBrowserInformationControlInput && elements[0] instanceof IGroovyResolvedElement) { JavadocBrowserInformationControlInput input = (JavadocBrowserInformationControlInput) hover; hover = new JavadocBrowserInformationControlInput( (JavadocBrowserInformationControlInput) input.getPrevious(), input.getElement(), wrapHTML(input, (IGroovyResolvedElement) elements[0]), input.getLeadingImageWidth()); } return hover; }
protected String wrapHTML( JavadocBrowserInformationControlInput input, IGroovyResolvedElement elt) { // only use a preamble if the name of the inferred element is not the // same as the resolved element. String preamble; if (!elt.getElementName().equals(elt.getInferredElementName())) { preamble = createLabel(elt.getInferredElement()); } else { preamble = ""; } if (elt.getExtraDoc() != null) { return preamble + elt.getExtraDoc() + "\n<br><hr/><br>\n" + input.getHtml(); } else { return preamble + input.getHtml(); } }