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


Java ASTNode.getFirstChildNode方法代碼示例

本文整理匯總了Java中com.intellij.lang.ASTNode.getFirstChildNode方法的典型用法代碼示例。如果您正苦於以下問題:Java ASTNode.getFirstChildNode方法的具體用法?Java ASTNode.getFirstChildNode怎麽用?Java ASTNode.getFirstChildNode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.ASTNode的用法示例。


在下文中一共展示了ASTNode.getFirstChildNode方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: appendDescriptors

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
private void appendDescriptors(final ASTNode node, final Document document, final List<FoldingDescriptor> descriptors) {
    if (node.getElementType() == GCMTypes.CLASS_DECLARATION || node.getElementType() == GCMTypes.CUSTOM_TYPE_DECLARATION) {
        TextRange fullRange = node.getTextRange();
        if (fullRange.getEndOffset() - fullRange.getStartOffset() > 0) {

            try {
                int startOffset = fullRange.getStartOffset() + document.getText(fullRange).indexOf("{") + 1;
                int endOffset = fullRange.getEndOffset() - 1;
                if (startOffset < endOffset) {
                    TextRange shortRange = new TextRange(startOffset, fullRange.getEndOffset() - 1);
                    if (shortRange.getEndOffset() - shortRange.getStartOffset() > 1) {
                        descriptors.add(new FoldingDescriptor(node, shortRange));
                    }
                }
            } catch (Throwable e) {

            }
        }
    }
    ASTNode child = node.getFirstChildNode();
    while (child != null) {
        appendDescriptors(child, document, descriptors);
        child = child.getTreeNext();
    }
}
 
開發者ID:datathings,項目名稱:greycat-idea-plugin,代碼行數:26,代碼來源:GCMFoldingBuilder.java

示例2: createColumnInfoMap

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static Map<Integer, CsvColumnInfo<ASTNode>> createColumnInfoMap(ASTNode root, CodeStyleSettings settings) {
    Map<Integer, CsvColumnInfo<ASTNode>> columnInfoMap = new HashMap<>();
    ASTNode child = root.getFirstChildNode();
    while (child != null) {
        if (child.getElementType() == CsvTypes.RECORD) {
            Integer column = 0;
            ASTNode subChild = child.getFirstChildNode();
            while (subChild != null) {
                if (subChild.getElementType() == CsvTypes.FIELD) {
                    int length = getTextLength(subChild, settings);
                    if (!columnInfoMap.containsKey(column)) {
                        columnInfoMap.put(column, new CsvColumnInfo(column, length));
                    } else if (columnInfoMap.get(column).getMaxLength() < length) {
                        columnInfoMap.get(column).setMaxLength(length);
                    }
                    columnInfoMap.get(column).addElement(subChild);
                    ++column;
                }
                subChild = subChild.getTreeNext();
            }
        }
        child = child.getTreeNext();
    }
    return columnInfoMap;
}
 
開發者ID:SeeSharpSoft,項目名稱:intellij-csv-validator,代碼行數:26,代碼來源:CsvFormatHelper.java

示例3: getName

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static String getName(TSVarExpr variable) {
    ASTNode node = variable.getNode();
    if (node == null) {
        return null;
    }
    node = node.getFirstChildNode();
    if (node == null) {
        return null;
    }
    return node.getText().substring(1);
}
 
開發者ID:CouleeApps,項目名稱:TS-IJ,代碼行數:12,代碼來源:TSPsiImplUtil.java

示例4: isLocal

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
public static boolean isLocal(TSVarExpr variable) {
    ASTNode node = variable.getNode();
    if (node == null) {
        return false;
    }
    node = node.getFirstChildNode();
    if (node == null) {
        return false;
    }
    return (node.getElementType().equals(TSTypes.LOCALVAR));
}
 
開發者ID:CouleeApps,項目名稱:TS-IJ,代碼行數:12,代碼來源:TSPsiImplUtil.java

示例5: buildChildren

import com.intellij.lang.ASTNode; //導入方法依賴的package包/類
@Override
protected List<Block> buildChildren() {
    final List<Block> blocks = new ArrayList<Block>();

    final AlignmentStrategy alignmentStrategy = getAlignmentStrategy();
    alignmentStrategy.processNode(myNode);

    ASTNode currentNode = myNode.getFirstChildNode();

    while (null != currentNode) {

        // Unpack 'Value Line' as columns will not be aligned if they do not share the same parent
        if (ImpexTypes.VALUE_LINE == currentNode.getElementType()) {
            currentNode = currentNode.getFirstChildNode();
        }

        alignmentStrategy.processNode(currentNode);

        if (isNotWhitespaceOrNewLine(currentNode)
            && !isCurrentNodeHasParentValue(currentNode)) {

            final Block block = new ImpexBlock(
                currentNode,
                null,
                alignmentStrategy.getAlignment(currentNode),
                spacingBuilder
            );

            blocks.add(block);
        }

        // Unpack Value Line
        if (isEndOfValueLine(currentNode)) {
            currentNode = currentNode.getTreeParent().getTreeNext();
        } else {
            currentNode = currentNode.getTreeNext();
        }
    }

    return blocks;
}
 
開發者ID:AlexanderBartash,項目名稱:hybris-integration-intellij-idea-plugin,代碼行數:42,代碼來源:ImpexBlock.java


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