當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。