• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java JavaClassReferenceProvider类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PsiClassConverter.java


示例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);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:PsiClassConverter.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:PsiClassConverter.java


示例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();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:ExtendsClassChecker.java


示例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;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:TestNGSuiteReferenceContributor.java


示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:PluginPsiClassConverter.java


示例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());
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:8,代码来源:JavaClassReferenceContributor.java


示例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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:ExtendsClassChecker.java


示例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;
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:TestNGSuiteReferenceContributor.java


示例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());
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:10,代码来源:VtlReferenceContributor.java


示例11: CommonReferenceProviderTypesImpl

import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public CommonReferenceProviderTypesImpl() {
  myProvider = new JavaClassReferenceProvider();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:CommonReferenceProviderTypesImpl.java


示例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);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:FormReferenceProvider.java


示例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);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:47,代码来源:FormReferenceProvider.java


示例14: IbatisClassShortcutsReferenceProvider

import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public IbatisClassShortcutsReferenceProvider(Project project) {
    super(new JavaClassReferenceProvider(project));
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:4,代码来源:IbatisClassShortcutsReferenceProvider.java


示例15: TypeHandlerReferenceProvider

import com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider; //导入依赖的package包/类
public TypeHandlerReferenceProvider(Project project) {
    super(new JavaClassReferenceProvider(project));
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:4,代码来源:TypeHandlerReferenceProvider.java



注:本文中的com.intellij.psi.impl.source.resolve.reference.impl.providers.JavaClassReferenceProvider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimScorer类代码示例发布时间:2022-05-22
下一篇:
Java ResourceEnvRef类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap