void (@NotNull HierarchyTreeStructure treeStructure, @Nullable HierarchyNodeDescriptor descriptor, @Nullable Comparator<? super NodeDescriptor<?>> comparator, int level, @NotNull StringBuilder b) { if (level > 10) { b.append(" ".repeat(level)); b.append("<Probably infinite part skipped>\n"); return; } if (descriptor == null) descriptor = (HierarchyNodeDescriptor)treeStructure.getRootElement(); b.append(" ".repeat(level)); descriptor.update(); b.append("<node text=\"").append(descriptor.getHighlightedText().getText()).append("\"") .append(treeStructure.getBaseDescriptor() == descriptor ? " base=\"true\"" : ""); Object[] children = getSortedChildren(treeStructure, descriptor, comparator); if (children.length > 0) { b.append(">\n"); for (Object o : children) { HierarchyNodeDescriptor d = (HierarchyNodeDescriptor)o; dump(treeStructure, d, comparator, level + 1, b); } b.append(" ".repeat(level)); b.append("</node>\n"); } else { b.append("/>\n"); } }