Java 类com.intellij.psi.impl.source.resolve.VariableResolverProcessor 实例源码

项目:intellij-ce-playground    文件:PsiJavaCodeReferenceElementImpl.java   
@NotNull
@Override
public ResolveResult[] resolve(@NotNull PsiJavaReference ref, @NotNull PsiFile containingFile, boolean incompleteCode) {
  PsiJavaCodeReferenceElementImpl referenceElement = (PsiJavaCodeReferenceElementImpl)ref;
  int kind = referenceElement.getKind(containingFile);
  JavaResolveResult[] result = referenceElement.resolve(kind, containingFile);

  if (incompleteCode && result.length == 0 && kind != CLASS_FQ_NAME_KIND && kind != CLASS_FQ_OR_PACKAGE_NAME_KIND) {
    VariableResolverProcessor processor = new VariableResolverProcessor(referenceElement, containingFile);
    PsiScopesUtil.resolveAndWalk(processor, referenceElement, null, true);
    result = processor.getResult();
    if (result.length == 0 && kind == CLASS_NAME_KIND) {
      result = referenceElement.resolve(PACKAGE_NAME_KIND, containingFile);
    }
  }

  JavaResolveUtil.substituteResults(referenceElement, result);

  return result;
}
项目:tools-idea    文件:PsiJavaCodeReferenceElementImpl.java   
@NotNull
@Override
public JavaResolveResult[] resolve(@NotNull PsiJavaReference ref, boolean incompleteCode) {
  PsiJavaCodeReferenceElementImpl referenceElement = (PsiJavaCodeReferenceElementImpl)ref;
  int kind = referenceElement.getKind();
  PsiFile containingFile = referenceElement.getContainingFile();
  JavaResolveResult[] result = referenceElement.resolve(kind, containingFile);

  if (incompleteCode && result.length == 0 && kind != CLASS_FQ_NAME_KIND && kind != CLASS_FQ_OR_PACKAGE_NAME_KIND) {
    VariableResolverProcessor processor = new VariableResolverProcessor(referenceElement, containingFile);
    PsiScopesUtil.resolveAndWalk(processor, referenceElement, null, incompleteCode);
    result = processor.getResult();
    if (result.length == 0 && kind == CLASS_NAME_KIND) {
      result = referenceElement.resolve(PACKAGE_NAME_KIND, containingFile);
    }
  }

  JavaResolveUtil.substituteResults((PsiJavaCodeReferenceElement)ref, result);

  return result;
}
项目:consulo-java    文件:PsiJavaCodeReferenceElementImpl.java   
@NotNull
@Override
public ResolveResult[] resolve(@NotNull PsiJavaReference ref, @NotNull PsiFile containingFile, boolean incompleteCode)
{
    PsiJavaCodeReferenceElementImpl referenceElement = (PsiJavaCodeReferenceElementImpl) ref;
    int kind = referenceElement.getKind(containingFile);
    JavaResolveResult[] result = referenceElement.resolve(kind, containingFile);

    if(incompleteCode && result.length == 0 && kind != CLASS_FQ_NAME_KIND && kind != CLASS_FQ_OR_PACKAGE_NAME_KIND)
    {
        VariableResolverProcessor processor = new VariableResolverProcessor(referenceElement, containingFile);
        PsiScopesUtil.resolveAndWalk(processor, referenceElement, null, true);
        result = processor.getResult();
        if(result.length == 0 && kind == CLASS_NAME_KIND)
        {
            result = referenceElement.resolve(PACKAGE_NAME_KIND, containingFile);
        }
    }

    JavaResolveUtil.substituteResults(referenceElement, result);

    return result;
}
项目:consulo-java    文件:PsiReferenceExpressionImpl.java   
@NotNull
private JavaResolveResult[] resolveToVariable(@NotNull PsiFile containingFile)
{
    final VariableResolverProcessor processor = new VariableResolverProcessor(this, containingFile);
    PsiScopesUtil.resolveAndWalk(processor, this, null);
    return processor.getResult();
}