本文整理汇总了Java中com.intellij.psi.util.PsiTreeUtil.getNextSiblingOfType方法的典型用法代码示例。如果您正苦于以下问题:Java PsiTreeUtil.getNextSiblingOfType方法的具体用法?Java PsiTreeUtil.getNextSiblingOfType怎么用?Java PsiTreeUtil.getNextSiblingOfType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.util.PsiTreeUtil
的用法示例。
在下文中一共展示了PsiTreeUtil.getNextSiblingOfType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getFunctionType
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
public static TSFunctionType getFunctionType(TSFnNameStmt element) {
//If we have a double colon that counts as a namespace
ASTNode doubleColon = element.getNode().findChildByType(TSTypes.COLON_DOUBLE);
if (doubleColon == null) {
return TSFunctionType.GLOBAL;
}
//In general, methods have a first arg of %this
TSVarList varList = PsiTreeUtil.getNextSiblingOfType(element, TSVarList.class);
//No var list? Must be global ns then
if (varList == null) {
return TSFunctionType.GLOBAL_NS;
}
//Not %this first? Global ns
TSVarExpr firstVar = PsiTreeUtil.getChildOfType(varList, TSVarExpr.class);
if (firstVar == null) {
//No first var means no %this so global ns
return TSFunctionType.GLOBAL_NS;
}
if (firstVar.getName().equalsIgnoreCase("this")) {
return TSFunctionType.METHOD;
}
//Probably global ns
return TSFunctionType.GLOBAL_NS;
}
示例2: visitElement
import com.intellij.psi.util.PsiTreeUtil; //导入方法依赖的package包/类
@Override
public void visitElement(PsiElement element) {
Variable iconFolder = PsiTreeUtil.findChildOfType(element, Variable.class);
if (iconFolder == null || !iconFolder.getName().equals("iconFolder")) {
// Something changed - dynamic parsing failed.
return;
}
StringLiteralExpression iconFolderValueString = PsiTreeUtil.getNextSiblingOfType(iconFolder, StringLiteralExpression.class);
if (iconFolderValueString == null) {
return;
}
String iconFolderValue = iconFolderValueString.getContents();
Statement parentStatement = PsiTreeUtil.getParentOfType(iconFolder, Statement.class);
Statement iconArrayAssignment = PsiTreeUtil.getNextSiblingOfType(
parentStatement,
Statement.class
);
if (iconArrayAssignment == null) {
return;
}
Variable iconArray = PsiTreeUtil.findChildOfType(iconArrayAssignment, Variable.class);
if (iconArray == null) {
// something changed, meh. dynamic parsing failed.
return;
}
ClassConstantReference iconProvider = PsiTreeUtil.findChildOfType(element, ClassConstantReference.class);
if (iconProvider == null) {
// something changed. - ...
return;
}
ArrayCreationExpression flagsArray = PsiTreeUtil.getNextSiblingOfType(iconArray, ArrayCreationExpression.class);
if (flagsArray == null) {
return;
}
Collection<StringLiteralExpression> flagNames = PsiTreeUtil.findChildrenOfType(flagsArray, StringLiteralExpression.class);
for (StringLiteralExpression flagNameExpression : flagNames) {
String countryAbbreviation = flagNameExpression.getContents();
this.createFlagIcon(iconProvider, iconFolderValue, countryAbbreviation, flagNameExpression);
}
}