Search in sources :

Example 1 with StructureViewFactoryEx

use of com.intellij.ide.structureView.StructureViewFactoryEx in project intellij-community by JetBrains.

the class PsiTreeElementBase method getChildren.

@NotNull
@Override
public final StructureViewTreeElement[] getChildren() {
    final T element = getElement();
    if (element == null)
        return EMPTY_ARRAY;
    List<StructureViewTreeElement> result = new ArrayList<>();
    Collection<StructureViewTreeElement> baseChildren = getChildrenBase();
    result.addAll(CustomRegionStructureUtil.groupByCustomRegions(element, baseChildren));
    StructureViewFactoryEx structureViewFactory = StructureViewFactoryEx.getInstanceEx(element.getProject());
    Class<? extends PsiElement> aClass = element.getClass();
    for (StructureViewExtension extension : structureViewFactory.getAllExtensions(aClass)) {
        StructureViewTreeElement[] children = extension.getChildren(element);
        if (children != null) {
            ContainerUtil.addAll(result, children);
        }
    }
    return result.toArray(new StructureViewTreeElement[result.size()]);
}
Also used : StructureViewFactoryEx(com.intellij.ide.structureView.StructureViewFactoryEx) ArrayList(java.util.ArrayList) StructureViewTreeElement(com.intellij.ide.structureView.StructureViewTreeElement) StructureViewExtension(com.intellij.ide.structureView.StructureViewExtension) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

StructureViewExtension (com.intellij.ide.structureView.StructureViewExtension)1 StructureViewFactoryEx (com.intellij.ide.structureView.StructureViewFactoryEx)1 StructureViewTreeElement (com.intellij.ide.structureView.StructureViewTreeElement)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1