当前位置: 首页>>代码示例>>Java>>正文


Java ClassResolverProcessor类代码示例

本文整理汇总了Java中com.intellij.psi.impl.source.resolve.ClassResolverProcessor的典型用法代码示例。如果您正苦于以下问题:Java ClassResolverProcessor类的具体用法?Java ClassResolverProcessor怎么用?Java ClassResolverProcessor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClassResolverProcessor类属于com.intellij.psi.impl.source.resolve包,在下文中一共展示了ClassResolverProcessor类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveToClass

import com.intellij.psi.impl.source.resolve.ClassResolverProcessor; //导入依赖的package包/类
@NotNull
private JavaResolveResult[] resolveToClass(@NotNull PsiElement classNameElement, @NotNull PsiFile containingFile)
{
	final String className = classNameElement.getText();

	final ClassResolverProcessor processor = new ClassResolverProcessor(className, this, containingFile);
	PsiScopesUtil.resolveAndWalk(processor, this, null);
	return processor.getResult();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:10,代码来源:PsiReferenceExpressionImpl.java

示例2: advancedResolveInner

import com.intellij.psi.impl.source.resolve.ClassResolverProcessor; //导入依赖的package包/类
private JavaResolveResult advancedResolveInner(@NotNull PsiElement psiElement, @NotNull String qName, @NotNull PsiFile containingFile) {
  final PsiManager manager = containingFile.getManager();
  final GlobalSearchScope scope = getScope(containingFile);
  if (myIndex == myJavaClassReferenceSet.getReferences().length - 1) {
    final PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(qName, scope);
    if (aClass != null) {
      return new ClassCandidateInfo(aClass, PsiSubstitutor.EMPTY, false, psiElement);
    }
    else {
      if (!JavaClassReferenceProvider.ADVANCED_RESOLVE.getBooleanValue(getOptions())) {
        return JavaResolveResult.EMPTY;
      }
    }
  }
  PsiElement resolveResult = JavaPsiFacade.getInstance(manager.getProject()).findPackage(qName);
  if (resolveResult == null) {
    resolveResult = JavaPsiFacade.getInstance(manager.getProject()).findClass(qName, scope);
  }
  if (myInStaticImport && resolveResult == null) {
    resolveResult = resolveMember(qName, manager, getElement().getResolveScope());
  }
  if (resolveResult == null) {
    if (containingFile instanceof PsiJavaFile) {
      if (containingFile instanceof ServerPageFile) {
        containingFile = containingFile.getViewProvider().getPsi(JavaLanguage.INSTANCE);
        if (containingFile == null) return JavaResolveResult.EMPTY;
      }

      final ClassResolverProcessor processor = new ClassResolverProcessor(getCanonicalText(), psiElement, containingFile);
      PsiClass contextClass = myJavaClassReferenceSet.getProvider().getContextClass(psiElement);
      if (contextClass != null) {
        PsiScopesUtil.treeWalkUp(processor, contextClass, null);
      }
      else {
        containingFile.processDeclarations(processor, ResolveState.initial(), null, psiElement);
      }

      if (processor.getResult().length == 1) {
        final JavaResolveResult javaResolveResult = processor.getResult()[0];

        if (javaResolveResult != JavaResolveResult.EMPTY && getOptions() != null) {
          final Boolean value = JavaClassReferenceProvider.RESOLVE_QUALIFIED_CLASS_NAME.getValue(getOptions());
          final PsiClass psiClass = (PsiClass)javaResolveResult.getElement();
          if (value != null && value.booleanValue() && psiClass != null) {
            final String qualifiedName = psiClass.getQualifiedName();

            if (!qName.equals(qualifiedName)) {
              return JavaResolveResult.EMPTY;
            }
          }
        }

        return javaResolveResult;
      }
    }
  }
  return resolveResult != null
         ? new CandidateInfo(resolveResult, PsiSubstitutor.EMPTY, false, false, psiElement)
         : JavaResolveResult.EMPTY;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:JavaClassReference.java

示例3: advancedResolveInner

import com.intellij.psi.impl.source.resolve.ClassResolverProcessor; //导入依赖的package包/类
private JavaResolveResult advancedResolveInner(final PsiElement psiElement, final String qName) {
  final PsiManager manager = psiElement.getManager();
  final GlobalSearchScope scope = getScope();
  if (myIndex == myJavaClassReferenceSet.getReferences().length - 1) {
    final PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(qName, scope);
    if (aClass != null) {
      return new ClassCandidateInfo(aClass, PsiSubstitutor.EMPTY, false, psiElement);
    }
    else {
      if (!JavaClassReferenceProvider.ADVANCED_RESOLVE.getBooleanValue(getOptions())) {
        return JavaResolveResult.EMPTY;
      }
    }
  }
  PsiElement resolveResult = JavaPsiFacade.getInstance(manager.getProject()).findPackage(qName);
  if (resolveResult == null) {
    resolveResult = JavaPsiFacade.getInstance(manager.getProject()).findClass(qName, scope);
  }
  if (myInStaticImport && resolveResult == null) {
    resolveResult = resolveMember(qName, manager, getElement().getResolveScope());
  }
  if (resolveResult == null) {
    PsiFile containingFile = psiElement.getContainingFile();

    if (containingFile instanceof PsiJavaFile) {
      if (containingFile instanceof JspFile) {
        containingFile = containingFile.getViewProvider().getPsi(JavaLanguage.INSTANCE);
        if (containingFile == null) return JavaResolveResult.EMPTY;
      }

      final ClassResolverProcessor processor = new ClassResolverProcessor(getCanonicalText(), psiElement, containingFile);
      containingFile.processDeclarations(processor, ResolveState.initial(), null, psiElement);

      if (processor.getResult().length == 1) {
        final JavaResolveResult javaResolveResult = processor.getResult()[0];

        if (javaResolveResult != JavaResolveResult.EMPTY && getOptions() != null) {
          final Boolean value = JavaClassReferenceProvider.RESOLVE_QUALIFIED_CLASS_NAME.getValue(getOptions());
          final PsiClass psiClass = (PsiClass)javaResolveResult.getElement();
          if (value != null && value.booleanValue() && psiClass != null) {
            final String qualifiedName = psiClass.getQualifiedName();

            if (!qName.equals(qualifiedName)) {
              return JavaResolveResult.EMPTY;
            }
          }
        }

        return javaResolveResult;
      }
    }
  }
  return resolveResult != null
         ? new CandidateInfo(resolveResult, PsiSubstitutor.EMPTY, false, false, psiElement)
         : JavaResolveResult.EMPTY;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:57,代码来源:JavaClassReference.java

示例4: advancedResolveInner

import com.intellij.psi.impl.source.resolve.ClassResolverProcessor; //导入依赖的package包/类
private JavaResolveResult advancedResolveInner(@NotNull PsiElement psiElement, @NotNull String qName, @NotNull PsiFile containingFile)
{
	final PsiManager manager = containingFile.getManager();
	final GlobalSearchScope scope = getScope(containingFile);
	if(myIndex == myJavaClassReferenceSet.getReferences().length - 1)
	{
		final PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(qName, scope);
		if(aClass != null)
		{
			return new ClassCandidateInfo(aClass, PsiSubstitutor.EMPTY, false, psiElement);
		}
		else
		{
			if(!JavaClassReferenceProvider.ADVANCED_RESOLVE.getBooleanValue(getOptions()))
			{
				return JavaResolveResult.EMPTY;
			}
		}
	}
	PsiElement resolveResult = JavaPsiFacade.getInstance(manager.getProject()).findPackage(qName);
	if(resolveResult == null)
	{
		resolveResult = JavaPsiFacade.getInstance(manager.getProject()).findClass(qName, scope);
	}
	if(myInStaticImport && resolveResult == null)
	{
		resolveResult = resolveMember(qName, manager, getElement().getResolveScope());
	}
	if(resolveResult == null)
	{
		if(containingFile instanceof PsiJavaFile)
		{
			if(containingFile instanceof ServerPageFile)
			{
				containingFile = containingFile.getViewProvider().getPsi(JavaLanguage.INSTANCE);
				if(containingFile == null)
				{
					return JavaResolveResult.EMPTY;
				}
			}

			final ClassResolverProcessor processor = new ClassResolverProcessor(getCanonicalText(), psiElement, containingFile);
			PsiClass contextClass = myJavaClassReferenceSet.getProvider().getContextClass(psiElement);
			if(contextClass != null)
			{
				PsiScopesUtil.treeWalkUp(processor, contextClass, null);
			}
			else
			{
				containingFile.processDeclarations(processor, ResolveState.initial(), null, psiElement);
			}

			if(processor.getResult().length == 1)
			{
				final JavaResolveResult javaResolveResult = processor.getResult()[0];

				if(javaResolveResult != JavaResolveResult.EMPTY && getOptions() != null)
				{
					final Boolean value = JavaClassReferenceProvider.RESOLVE_QUALIFIED_CLASS_NAME.getValue(getOptions());
					final PsiClass psiClass = (PsiClass) javaResolveResult.getElement();
					if(value != null && value.booleanValue() && psiClass != null)
					{
						final String qualifiedName = psiClass.getQualifiedName();

						if(!qName.equals(qualifiedName))
						{
							return JavaResolveResult.EMPTY;
						}
					}
				}

				return javaResolveResult;
			}
		}
	}
	return resolveResult != null ? new CandidateInfo(resolveResult, PsiSubstitutor.EMPTY, false, false, psiElement) : JavaResolveResult.EMPTY;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:78,代码来源:JavaClassReference.java


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