private void filterRecursively(IParseNode[] nodes, List<CommonOutlineItem> list) { IPHPParseNode element; for (IParseNode node : nodes) { if (node instanceof IPHPParseNode) { element = (IPHPParseNode) node; // filters out any item that should not be in the outline if (!element.isFilteredFromOutline()) { list.add(getOutlineItem(element)); } else { // the node may have children that we don't want to filter (like a function within an 'if' // statement). filterRecursively(node.getChildren(), list); } } else if (!(node instanceof HTMLTextNode)) { list.add(getOutlineItem(node)); } } }
/** * @param parseResult * @param document * @return */ public IFormatterContainerNode build(IParseNode parseResult, FormatterDocument document) { this.document = document; final IFormatterContainerNode rootNode = new FormatterCSSRootNode(document); start(rootNode); IParseNode[] children = parseResult.getChildren(); addNodes(children); checkedPop(rootNode, document.getLength()); // Collect Off/On tags if (parseResult instanceof IParseRootNode) { setOffOnRegions( resolveOffOnRegions( (IParseRootNode) parseResult, document, CSSFormatterConstants.FORMATTER_OFF_ON_ENABLED, CSSFormatterConstants.FORMATTER_OFF, CSSFormatterConstants.FORMATTER_ON)); } return rootNode; }