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