private static GrExpression genRefForGetter(GrMethodCall call, String accessorName) {
    String name = GroovyPropertyUtils.getPropertyNameByGetterName(accessorName, true);
    GrReferenceExpression refExpr = (GrReferenceExpression) call.getInvokedExpression();
    String oldNameStr = refExpr.getReferenceNameElement().getText();
    String newRefExpr = StringUtil.trimEnd(refExpr.getText(), oldNameStr) + name;

    final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(call.getProject());
    return factory.createExpressionFromText(newRefExpr, call);
  }
  private static boolean findClassByText(GrReferenceExpression ref) {
    final String text = ref.getText();
    final int i = text.indexOf('<');
    String className = i == -1 ? text : text.substring(0, i);

    PsiClass[] names =
        PsiShortNamesCache.getInstance(ref.getProject())
            .getClassesByName(className, ref.getResolveScope());
    if (names.length > 0) return true;

    PsiFile file = ref.getContainingFile();
    if (file instanceof GroovyFile) {
      GrImportStatement[] imports = ((GroovyFile) file).getImportStatements();
      for (GrImportStatement anImport : imports) {
        if (className.equals(anImport.getImportedName())) return true;
      }
    }

    return false;
  }
 private static String getMethodCandidateInfo(GrReferenceExpression expr) {
   final GroovyResolveResult[] candidates = expr.multiResolve(false);
   final String text = expr.getText();
   if (candidates.length > 0) {
     @NonNls final StringBuilder sb = new StringBuilder();
     for (final GroovyResolveResult candidate : candidates) {
       final PsiElement element = candidate.getElement();
       if (!(element instanceof PsiMethod)) {
         continue;
       }
       final String str =
           PsiFormatUtil.formatMethod(
               (PsiMethod) element,
               candidate.getSubstitutor(),
               PsiFormatUtilBase.SHOW_NAME
                   | PsiFormatUtilBase.SHOW_TYPE
                   | PsiFormatUtilBase.SHOW_PARAMETERS,
               PsiFormatUtilBase.SHOW_TYPE);
       createElementLink(sb, element, str);
     }
     return CodeInsightBundle.message("javadoc.candidates", text, sb);
   }
   return CodeInsightBundle.message("javadoc.candidates.not.found", text);
 }