当前位置: 首页>>代码示例>>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;未经允许,请勿转载。