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