本文整理汇总了Java中com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider类的典型用法代码示例。如果您正苦于以下问题:Java JavaClassReferenceProvider类的具体用法?Java JavaClassReferenceProvider怎么用?Java JavaClassReferenceProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JavaClassReferenceProvider类属于com.intellij.psi.impl.source.resolve.reference.impl.providers包,在下文中一共展示了JavaClassReferenceProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createReferences
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
@NotNull
public PsiReference[] createReferences(GenericDomValue<PsiClass> genericDomValue, PsiElement element, ConvertContext context) {
ExtendClass extendClass = genericDomValue.getAnnotation(ExtendClass.class);
final JavaClassReferenceProvider provider = createClassReferenceProvider(genericDomValue, context, extendClass);
return provider.getReferencesByElement(element);
}
示例2: createClassReferenceProvider
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
protected JavaClassReferenceProvider createClassReferenceProvider(final GenericDomValue<PsiClass> genericDomValue,
final ConvertContext context,
ExtendClass extendClass) {
return createJavaClassReferenceProvider(genericDomValue, extendClass, new JavaClassReferenceProvider() {
@Override
public GlobalSearchScope getScope(Project project) {
return PsiClassConverter.this.getScope(context);
}
});
}
示例3: createJavaClassReferenceProvider
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public static JavaClassReferenceProvider createJavaClassReferenceProvider(final GenericDomValue genericDomValue,
ExtendClass extendClass,
final JavaClassReferenceProvider provider) {
if (extendClass != null) {
if (StringUtil.isNotEmpty(extendClass.value())) {
provider.setOption(JavaClassReferenceProvider.EXTEND_CLASS_NAMES, new String[]{extendClass.value()});
}
if (extendClass.instantiatable()) {
provider.setOption(JavaClassReferenceProvider.INSTANTIATABLE, Boolean.TRUE);
}
if (!extendClass.allowAbstract()) {
provider.setOption(JavaClassReferenceProvider.CONCRETE, Boolean.TRUE);
}
if (!extendClass.allowInterface()) {
provider.setOption(JavaClassReferenceProvider.NOT_INTERFACE, Boolean.TRUE);
}
if (!extendClass.allowEnum()) {
provider.setOption(JavaClassReferenceProvider.NOT_ENUM, Boolean.TRUE);
}
if (extendClass.jvmFormat()) {
provider.setOption(JavaClassReferenceProvider.JVM_FORMAT, Boolean.TRUE);
}
provider.setAllowEmpty(extendClass.allowEmpty());
}
ClassTemplate template = genericDomValue.getAnnotation(ClassTemplate.class);
if (template != null) {
if (StringUtil.isNotEmpty(template.value())) {
provider.setOption(JavaClassReferenceProvider.CLASS_TEMPLATE, template.value());
}
provider.setOption(JavaClassReferenceProvider.CLASS_KIND, template.kind());
}
provider.setSoft(true);
return provider;
}
示例4: checkExtendsClassInReferences
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public static List<DomElementProblemDescriptor> checkExtendsClassInReferences(final GenericDomValue element, final DomElementAnnotationHolder holder) {
if (!isPsiClassType(element)) {
return Collections.emptyList();
}
final Object valueObject = element.getValue();
if (!(valueObject instanceof PsiClass)) return Collections.emptyList();
final XmlElement valueElement = DomUtil.getValueElement(element);
if (valueElement == null) return Collections.emptyList();
final PsiReference[] references = ourProvider.getReferencesByElement(valueElement, new ProcessingContext());
for (PsiReference reference : references) {
if (reference instanceof JavaClassReference) {
final PsiReferenceProvider psiReferenceProvider = ((JavaClassReference)reference).getProvider();
final String[] value = psiReferenceProvider instanceof JavaClassReferenceProvider ? JavaClassReferenceProvider.EXTEND_CLASS_NAMES
.getValue(((JavaClassReferenceProvider)psiReferenceProvider).getOptions()) : null;
if (value != null && value.length != 0) {
for (String className : value) {
final List<DomElementProblemDescriptor> problemDescriptors =
checkExtendClass(element, ((PsiClass)valueObject), className, false, false, true, false, true, true, holder);
if (!problemDescriptors.isEmpty()) {
return problemDescriptors;
}
}
}
}
}
return Collections.emptyList();
}
示例5: registerReferenceProviders
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(ourTestClassPattern, new JavaClassReferenceProvider());
registrar.registerReferenceProvider(ourListenerClassPattern, new JavaClassReferenceProvider());
final JavaClassReferenceProvider methodSelectorProvider = new JavaClassReferenceProvider();
methodSelectorProvider.setOption(JavaClassReferenceProvider.EXTEND_CLASS_NAMES, new String[]{"org.testng.IMethodSelector"});
registrar.registerReferenceProvider(ourMethodSelectorPattern, methodSelectorProvider);
registrar.registerReferenceProvider(ourSuiteFilePattern, new PathListReferenceProvider(){
@Override
protected boolean disableNonSlashedPaths() {
return false;
}
});
}
示例6: createClassReferenceProvider
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
@Override
protected JavaClassReferenceProvider createClassReferenceProvider(GenericDomValue<PsiClass> genericDomValue,
ConvertContext context,
ExtendClass extendClass) {
final JavaClassReferenceProvider provider = super.createClassReferenceProvider(genericDomValue, context, extendClass);
provider.setOption(JavaClassReferenceProvider.JVM_FORMAT, Boolean.TRUE);
provider.setOption(JavaClassReferenceProvider.ALLOW_DOLLAR_NAMES, Boolean.TRUE);
return provider;
}
示例7: registerReferenceProviders
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
JavaClassReferenceProvider provider = new JavaClassReferenceProvider();
provider.setOption(JavaClassReferenceProvider.CLASS_KIND, ClassKind.CLASS);
registrar.registerReferenceProvider(
JavaClassQualifiedNameReference.PATTERN, new JavaClassReferenceProvider());
}
示例8: checkExtendsClassInReferences
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public static List<DomElementProblemDescriptor> checkExtendsClassInReferences(final GenericDomValue element, final DomElementAnnotationHolder holder) {
if (!isPsiClassType(element)) {
return Collections.emptyList();
}
final Object valueObject = element.getValue();
if (!(valueObject instanceof PsiClass)) return Collections.emptyList();
final PsiReference[] references = ourProvider.getReferencesByElement(DomUtil.getValueElement(element), new ProcessingContext());
for (PsiReference reference : references) {
if (reference instanceof JavaClassReference) {
final PsiReferenceProvider psiReferenceProvider = ((JavaClassReference)reference).getProvider();
final String[] value = psiReferenceProvider instanceof JavaClassReferenceProvider ? JavaClassReferenceProvider.EXTEND_CLASS_NAMES
.getValue(((JavaClassReferenceProvider)psiReferenceProvider).getOptions()) : null;
if (value != null && value.length != 0) {
for (String className : value) {
final List<DomElementProblemDescriptor> problemDescriptors =
checkExtendClass(element, ((PsiClass)valueObject), className, false, false, true, false, true, true, holder);
if (!problemDescriptors.isEmpty()) {
return problemDescriptors;
}
}
}
}
}
return Collections.emptyList();
}
示例9: registerReferenceProviders
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(ourTestClassPattern, new JavaClassReferenceProvider());
registrar.registerReferenceProvider(ourListenerClassPattern, new JavaClassReferenceProvider());
final JavaClassReferenceProvider methodSelectorProvider = new JavaClassReferenceProvider();
methodSelectorProvider.setOption(JavaClassReferenceProvider.EXTEND_CLASS_NAMES, new String[]{"org.testng.IMethodSelector"});
registrar.registerReferenceProvider(ourMethodSelectorPattern, methodSelectorProvider);
registrar.registerReferenceProvider(ourSuiteFilePattern, new PathListReferenceProvider(){
@Override
protected boolean disableNonSlashedPaths() {
return false;
}
});
}
示例10: getReferencesToJavaTypes
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public static PsiReference[] getReferencesToJavaTypes(PsiElement element) {
final String text = element.getText();
TextRange range = findTypeNameRange(text);
if (range == null) {
return PsiReference.EMPTY_ARRAY;
}
final JavaClassReferenceProvider provider = new JavaClassReferenceProvider();
return provider.getReferencesByString(range.substring(text), element, range.getStartOffset());
}
示例11: CommonReferenceProviderTypesImpl
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public CommonReferenceProviderTypesImpl() {
myProvider = new JavaClassReferenceProvider();
}
示例12: processReferences
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
private static void processReferences(final PsiPlainTextFile file, final PsiReferenceProcessor processor) {
final Project project = file.getProject();
final XmlTag rootTag = ApplicationManager.getApplication().runReadAction(new Computable<XmlTag>() {
public XmlTag compute() {
final XmlFile xmlFile = (XmlFile) PsiFileFactory.getInstance(project).createFileFromText("a.xml", XmlFileType.INSTANCE, file.getViewProvider().getContents());
return xmlFile.getRootTag();
}
});
if (rootTag == null || !Utils.FORM_NAMESPACE.equals(rootTag.getNamespace())) {
return;
}
@NonNls final String name = rootTag.getName();
if (!"form".equals(name)){
return;
}
PsiReference classReference = null;
final XmlAttribute classToBind = rootTag.getAttribute("bind-to-class", null);
if (classToBind != null) {
// reference to class
final XmlAttributeValue valueElement = classToBind.getValueElement();
if (valueElement == null) {
return;
}
final String className = valueElement.getValue().replace('$','.');
final PsiReference[] referencesByString = new JavaClassReferenceProvider().getReferencesByString(className, file, valueElement.getTextRange().getStartOffset() + 1);
if(referencesByString.length < 1){
// There are no references there
return;
}
for (PsiReference aReferencesByString : referencesByString) {
processor.execute(aReferencesByString);
}
classReference = referencesByString[referencesByString.length - 1];
}
final PsiReference finalClassReference = classReference;
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
processReferences(rootTag, finalClassReference, file, processor);
}
});
}
示例13: processReferences
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
private static void processReferences(final PsiPlainTextFile file, final PsiReferenceProcessor processor) {
final Project project = file.getProject();
final XmlTag rootTag = ApplicationManager.getApplication().runReadAction(new Computable<XmlTag>() {
public XmlTag compute() {
final XmlFile xmlFile = (XmlFile) PsiFileFactory.getInstance(project).createFileFromText("a.xml", XmlFileType.INSTANCE, file.getText());
return xmlFile.getRootTag();
}
});
if (rootTag == null || !Utils.FORM_NAMESPACE.equals(rootTag.getNamespace())) {
return;
}
@NonNls final String name = rootTag.getName();
if (!"form".equals(name)){
return;
}
PsiReference classReference = null;
final XmlAttribute classToBind = rootTag.getAttribute("bind-to-class", null);
if (classToBind != null) {
// reference to class
final XmlAttributeValue valueElement = classToBind.getValueElement();
if (valueElement == null) {
return;
}
final String className = valueElement.getValue().replace('$','.');
final PsiReference[] referencesByString = new JavaClassReferenceProvider().getReferencesByString(className, file, valueElement.getTextRange().getStartOffset() + 1);
if(referencesByString.length < 1){
// There are no references there
return;
}
for (PsiReference aReferencesByString : referencesByString) {
processor.execute(aReferencesByString);
}
classReference = referencesByString[referencesByString.length - 1];
}
final PsiReference finalClassReference = classReference;
ApplicationManager.getApplication().runReadAction(new Runnable() {
public void run() {
processReferences(rootTag, finalClassReference, file, processor);
}
});
}
示例14: IbatisClassShortcutsReferenceProvider
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public IbatisClassShortcutsReferenceProvider(Project project) {
super(new JavaClassReferenceProvider(project));
}
示例15: TypeHandlerReferenceProvider
import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public TypeHandlerReferenceProvider(Project project) {
super(new JavaClassReferenceProvider(project));
}