use of com.google.idea.blaze.base.projectview.section.SectionParser in project intellij by bazelbuild.
the class ProjectViewParser method projectViewToString.
public static String projectViewToString(ProjectView projectView) {
StringBuilder sb = new StringBuilder();
List<SectionParser> sectionParsers = Sections.getParsers();
for (Section<?> section : projectView.getSections()) {
SectionParser sectionParser = sectionParsers.stream().filter(parser -> section.isSectionType(parser.getSectionKey())).findFirst().orElse(null);
if (sectionParser != null) {
sectionParser.print(sb, section);
}
}
// Because we split lines we'll always have an extra newline at the end
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
Aggregations