void (@NotNull PsiElement element) { var elementDeclarations = Declarations.allDeclarationsInElement(element); if (elementDeclarations.isEmpty()) { ProgressIndicatorProvider.checkCanceled(); element.acceptChildren(this); } else { elementDeclarations.forEach(it -> { if (shouldCreateNode(it)) { result.add(new PsiSymbolTreeElement(it) { @Override public @NotNull Collection<StructureViewTreeElement> getChildrenBase() { final PsiElement element = getElement(); return element != null ? collectClosestChildrenSymbols(element) : Collections.emptyList(); } }); } }); } }