當前位置: 首頁>>代碼示例>>Java>>正文


Java PsiTreeUtil.getNextSiblingOfType方法代碼示例

本文整理匯總了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;
}
 
開發者ID:CouleeApps,項目名稱:TS-IJ,代碼行數:29,代碼來源:TSPsiImplUtil.java

示例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);
    }
}
 
開發者ID:cedricziel,項目名稱:idea-php-typo3-plugin,代碼行數:49,代碼來源:CoreFlagParserVisitor.java


注:本文中的com.intellij.psi.util.PsiTreeUtil.getNextSiblingOfType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。