void (@Nullable ASTNode node, Document document, ArrayList<? super FoldingDescriptor> regions) { if (node == null) { return; } final ASTNode[] braces = node.getChildren(RncTokenTypes.BRACES); if (braces.length == 2) { final ASTNode lbrace = braces[0]; final ASTNode rbrace = braces[1]; if (shouldFold(lbrace, rbrace, document)) { final TextRange range = new TextRange(lbrace.getStartOffset(), rbrace.getTextRange().getEndOffset()); regions.add(new FoldingDescriptor(lbrace, range)); } } else if (isAnnotation(node.getElementType())) { if (isOnDifferentLine(node.getFirstChildNode(), node.getLastChildNode(), document)) { regions.add(new FoldingDescriptor(node, node.getTextRange())); } } node = node.getFirstChildNode(); while (node != null) { node = checkNodeAndSiblings(node, RncTokenTypes.DOC_TOKENS, regions, document); node = checkNodeAndSiblings(node, RncTokenTypes.COMMENTS, regions, document); process(node, document, regions); if (node != null) { node = node.getTreeNext(); } } }