use of com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider in project intellij-plugins by JetBrains.
the class ExtendableClassConverterImpl method createReferences.
@NotNull
public PsiReference[] createReferences(final GenericDomValue<PsiClass> psiClassGenericDomValue, final PsiElement element, final ConvertContext context) {
final ExtendClass extendClass = getExtendsAnnotation(psiClassGenericDomValue);
// 1. "normal" JAVA classes
final GlobalSearchScope scope = getResolveScope(psiClassGenericDomValue);
final JavaClassReferenceProvider classReferenceProvider = new JavaClassReferenceProvider() {
@Override
public GlobalSearchScope getScope(final Project project) {
return scope;
}
};
PsiClassConverter.createJavaClassReferenceProvider(psiClassGenericDomValue, extendClass, classReferenceProvider);
PsiReference[] javaClassReferences = classReferenceProvider.getReferencesByElement(element);
final boolean allowInterface = extendClass.allowInterface();
@NonNls String[] referenceTypes = allowInterface ? new String[] { "class", "interface" } : new String[] { "class" };
// 2. additional resolvers
for (final ExtendableClassConverterContributor contributor : Extensions.getExtensions(EP_NAME)) {
if (contributor.isSuitable(context)) {
final PsiReference[] additionalReferences = contributor.getReferences(context, element, extendClass);
javaClassReferences = ArrayUtil.mergeArrays(javaClassReferences, additionalReferences, PsiReference.ARRAY_FACTORY);
referenceTypes = ArrayUtil.append(referenceTypes, contributor.getTypeName(), ArrayUtil.STRING_ARRAY_FACTORY);
}
}
psiClassGenericDomValue.putUserData(REFERENCES_TYPES, referenceTypes);
return javaClassReferences;
}
Aggregations