Java 类com.intellij.psi.impl.source.SourceJavaCodeReference 实例源码

项目:lombok-intellij-plugin    文件:PsiAnnotationSearchUtil.java   
@Nullable
private static PsiAnnotation findAnnotationQuick(@Nullable PsiAnnotationOwner annotationOwner, @NotNull String qualifiedName) {
  if (annotationOwner == null) {
    return null;
  }

  PsiAnnotation[] annotations = annotationOwner.getAnnotations();
  if (annotations.length == 0) {
    return null;
  }

  final String shortName = StringUtil.getShortName(qualifiedName);

  for (PsiAnnotation annotation : annotations) {
    PsiJavaCodeReferenceElement referenceElement = annotation.getNameReferenceElement();
    if (null != referenceElement) {
      final String referenceName = referenceElement.getReferenceName();
      if (shortName.equals(referenceName)) {

        if (referenceElement.isQualified() && referenceElement instanceof SourceJavaCodeReference) {
          String possibleFullQualifiedName = ((SourceJavaCodeReference) referenceElement).getClassNameText();
          if (qualifiedName.equals(possibleFullQualifiedName)) {
            return annotation;
          }
        }

        final String annotationQualifiedName = getAndCacheFQN(annotation, referenceName);
        if (qualifiedName.equals(annotationQualifiedName)) {
          return annotation;
        }
      }
    }
  }

  return null;
}
项目:lombok-intellij-plugin    文件:PsiAnnotationSearchUtil.java   
@Nullable
private static PsiAnnotation findAnnotationQuick(@Nullable PsiAnnotationOwner annotationOwner, @NotNull String... qualifiedNames) {
  if (annotationOwner == null || qualifiedNames.length == 0) {
    return null;
  }

  PsiAnnotation[] annotations = annotationOwner.getAnnotations();
  if (annotations.length == 0) {
    return null;
  }

  final String[] shortNames = new String[qualifiedNames.length];
  for (int i = 0; i < qualifiedNames.length; i++) {
    shortNames[i] = StringUtil.getShortName(qualifiedNames[i]);
  }

  for (PsiAnnotation annotation : annotations) {
    final PsiJavaCodeReferenceElement referenceElement = annotation.getNameReferenceElement();
    if (null != referenceElement) {
      final String referenceName = referenceElement.getReferenceName();
      if (ArrayUtil.find(shortNames, referenceName) > -1) {

        if (referenceElement.isQualified() && referenceElement instanceof SourceJavaCodeReference) {
          final String possibleFullQualifiedName = ((SourceJavaCodeReference) referenceElement).getClassNameText();

          if (ArrayUtil.find(qualifiedNames, possibleFullQualifiedName) > -1) {
            return annotation;
          }
        }

        final String annotationQualifiedName = getAndCacheFQN(annotation, referenceName);
        if (ArrayUtil.find(qualifiedNames, annotationQualifiedName) > -1) {
          return annotation;
        }
      }
    }
  }

  return null;
}
项目:intellij-ce-playground    文件:JavaReferenceAdjuster.java   
private static ASTNode replaceReferenceWithFQ(ASTNode reference, PsiClass refClass) {
  ((SourceJavaCodeReference)reference).fullyQualify(refClass);
  return reference;
}
项目:tools-idea    文件:JavaReferenceAdjuster.java   
private static ASTNode replaceReferenceWithFQ(ASTNode reference, PsiClass refClass) {
  ((SourceJavaCodeReference)reference).fullyQualify(refClass);
  return reference;
}
项目:consulo-java    文件:JavaReferenceAdjuster.java   
private static ASTNode replaceReferenceWithFQ(ASTNode reference, PsiClass refClass)
{
    ((SourceJavaCodeReference) reference).fullyQualify(refClass);
    return reference;
}