本文整理匯總了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();
}