本文整理汇总了Java中com.intellij.psi.PsiReference.resolve方法的典型用法代码示例。如果您正苦于以下问题:Java PsiReference.resolve方法的具体用法?Java PsiReference.resolve怎么用?Java PsiReference.resolve使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.PsiReference
的用法示例。
在下文中一共展示了PsiReference.resolve方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findUsages
import com.intellij.psi.PsiReference; //导入方法依赖的package包/类
private static List<UsageInfo> findUsages( PsiElement element, PsiElement ctx )
{
// Module mod = ModuleUtilCore.findModuleForPsiElement( element );
// if( mod == null )
// {
// return Collections.emptyList();
// }
Query<PsiReference> search = ReferencesSearch.search( element, GlobalSearchScope.moduleScope( ModuleUtilCore.findModuleForPsiElement( ctx ) ) );
List<UsageInfo> usages = new ArrayList<>();
for( PsiReference ref : search.findAll() )
{
MoveRenameUsageInfo usageInfo = new MoveRenameUsageInfo( ref.getElement(), ref, ref.getRangeInElement().getStartOffset(),
ref.getRangeInElement().getEndOffset(), element,
ref.resolve() == null && !(ref instanceof PsiPolyVariantReference && ((PsiPolyVariantReference)ref).multiResolve( true ).length > 0) );
usages.add( usageInfo );
}
return usages;
}
示例2: getOriginalDeclaration
import com.intellij.psi.PsiReference; //导入方法依赖的package包/类
@Nullable
@Override
public PsiElement getOriginalDeclaration() {
//todo (re)move this to targetReference
PsiReference myReference = getReference();
if (myReference != null) {
return myReference.resolve();
}
return null;
}
示例3: getPhpClassOfServiceMethod
import com.intellij.psi.PsiReference; //导入方法依赖的package包/类
@Nullable
public static PhpClass getPhpClassOfServiceMethod(XmlElement psiMethodValueElement) {
XmlTag serviceTag = PsiTreeUtil.getParentOfType(psiMethodValueElement, XmlTag.class);
if (serviceTag == null) {
return null;
}
XmlAttribute attribute = serviceTag.getAttribute("class");
if (attribute == null) {
return null;
}
XmlAttributeValue valueElement = attribute.getValueElement();
if (valueElement == null) {
return null;
}
for (PsiReference reference : valueElement.getReferences()) {
if (reference != null) {
PsiElement element = reference.resolve();
if (element instanceof PhpClass) {
return (PhpClass) element;
}
}
}
return null;
}
示例4: getGotoDeclarationTarget
import com.intellij.psi.PsiReference; //导入方法依赖的package包/类
@Override
public PsiElement getGotoDeclarationTarget( PsiElement sourceElement, Editor editor )
{
if( sourceElement == null )
{
return null;
}
PsiElement parent = sourceElement.getParent();
if( parent != null )
{
PsiReference ref = parent.getReference();
if( ref != null )
{
PsiElement resolve = ref.resolve();
if( resolve != null )
{
PsiElement target = find( resolve );
if( target != null )
{
return target;
}
}
}
}
return null;
}
示例5: resolve
import com.intellij.psi.PsiReference; //导入方法依赖的package包/类
private PsiElement resolve() throws Exception {
String filename = getTestName(false) + ".soy";
PsiReference ref = myFixture.getReferenceAtCaretPosition(filename);
assertNotNull(ref);
return ref.resolve();
}