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


Java JavaResolveUtil.substituteResults方法代码示例

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


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

示例1: resolve

import com.intellij.psi.impl.source.resolve.JavaResolveUtil; //导入方法依赖的package包/类
@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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PsiJavaCodeReferenceElementImpl.java

示例2: resolve

import com.intellij.psi.impl.source.resolve.JavaResolveUtil; //导入方法依赖的package包/类
@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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:PsiJavaCodeReferenceElementImpl.java

示例3: resolve

import com.intellij.psi.impl.source.resolve.JavaResolveUtil; //导入方法依赖的package包/类
@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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:PsiJavaCodeReferenceElementImpl.java

示例4: resolve

import com.intellij.psi.impl.source.resolve.JavaResolveUtil; //导入方法依赖的package包/类
@NotNull
@Override
public ResolveResult[] resolve(@NotNull PsiJavaReference ref, @NotNull PsiFile containingFile, boolean incompleteCode)
{
	PsiReferenceExpressionImpl expression = (PsiReferenceExpressionImpl) ref;
	CompositeElement treeParent = expression.getTreeParent();
	IElementType parentType = treeParent == null ? null : treeParent.getElementType();

	List<ResolveResult[]> qualifiers = resolveAllQualifiers(expression, containingFile);
	JavaResolveResult[] result = expression.resolve(parentType, containingFile);

	if(result.length == 0 && incompleteCode && parentType != JavaElementType.REFERENCE_EXPRESSION)
	{
		result = expression.resolve(JavaElementType.REFERENCE_EXPRESSION, containingFile);
	}

	JavaResolveUtil.substituteResults(expression, result);

	qualifiers.clear(); // hold qualifier target list until this moment to avoid psi elements inside to GC

	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:PsiReferenceExpressionImpl.java


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