本文整理汇总了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;
}