本文整理匯總了Java中com.intellij.psi.PsiNamedElement.getParent方法的典型用法代碼示例。如果您正苦於以下問題:Java PsiNamedElement.getParent方法的具體用法?Java PsiNamedElement.getParent怎麽用?Java PsiNamedElement.getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.psi.PsiNamedElement
的用法示例。
在下文中一共展示了PsiNamedElement.getParent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: resolve
import com.intellij.psi.PsiNamedElement; //導入方法依賴的package包/類
@Nullable
@Override
public PsiElement resolve(PsiNamedElement element) {
// System.out.println(getClass().getSimpleName()+
// ".resolve("+element.getName()+
// " at "+Integer.toHexString(element.hashCode())+")");
if ( element.getParent() instanceof InstructionSubtree ) {
return SymtabUtils.resolve(this, RexxLanguage.INSTANCE,
element, "/script/function/ID");
}
return SymtabUtils.resolve(this, RexxLanguage.INSTANCE,
element, "/script/vardef/ID");
}
示例2: expandNamedElementBody
import com.intellij.psi.PsiNamedElement; //導入方法依賴的package包/類
/**
* Expands given named element to the closet parent suitable for "Move" refactoring. In particular for target expression
* it returns parental assignment statement if any and element itself for functions and classes.
*
* @see #extractNamedElement(PsiElement)
*/
@Nullable
public static PsiElement expandNamedElementBody(@NotNull PsiNamedElement element) {
if (element instanceof PyClass || element instanceof PyFunction) {
return element;
}
else if (element instanceof PyTargetExpression && element.getParent() instanceof PyAssignmentStatement) {
return element.getParent();
}
return null;
}