private static void generateVariableInfo(
      PsiElement originalElement, StringBuilder buffer, PsiVariable variable) {
    if (variable instanceof PsiField) {
      final PsiClass parentClass = ((PsiField) variable).getContainingClass();
      if (parentClass != null) {
        buffer.append(JavaDocUtil.getShortestClassName(parentClass, variable));
        newLine(buffer);
      }
      generateModifiers(buffer, variable);
    }
    final PsiType type =
        variable instanceof GrVariable
            ? ((GrVariable) variable).getDeclaredType()
            : variable.getType();
    PsiImplUtil.appendTypeString(
        buffer, calcSubstitutor(originalElement).substitute(type), originalElement);
    buffer.append(" ");
    buffer.append(variable.getName());

    if (variable instanceof GrVariable) {
      newLine(buffer);

      while (originalElement != null) {
        PsiReference ref = originalElement.getReference();
        if (ref != null && ref.resolve() != null) break;

        originalElement = originalElement.getParent();
      }

      if (originalElement != null) {
        appendInferredType(originalElement, (GrVariable) variable, buffer);
      }
    }
  }
 private static void createElementLink(
     @NonNls final StringBuilder sb, final PsiElement element, final String str) {
   sb.append("&nbsp;&nbsp;<a href=\"psi_element://");
   sb.append(JavaDocUtil.getReferenceText(element.getProject(), element));
   sb.append("\">");
   sb.append(str);
   sb.append("</a>");
   sb.append("<br>");
 }
 @Override
 @Nullable
 public PsiElement getDocumentationElementForLink(
     PsiManager psiManager, String link, PsiElement context) {
   return JavaDocUtil.findReferenceTarget(psiManager, link, context);
 }