Search in sources :

Example 1 with PsiPodSection

use of com.perl5.lang.pod.psi.PsiPodSection in project Perl5-IDEA by Camelcade.

the class PodStructureViewElement method getChildren.

@NotNull
@Override
public TreeElement[] getChildren() {
    List<PodStructureViewElement> result = new ArrayList<>();
    PsiElement container = null;
    if (myElement instanceof PodSection) {
        container = ((PodSection) myElement).getContentBlock();
    }
    if (container == null) {
        container = myElement;
    }
    for (PsiElement element : container.getChildren()) {
        if (element instanceof PodStructureElement) {
            if (!(element instanceof PsiCutSection || element instanceof PsiPodSection)) {
                result.add(new PodStructureViewElement(element));
            }
        }
    }
    if (result.size() == 1 && result.get(0).getValue() instanceof PodSectionOver) {
        // expanding over
        return result.get(0).getChildren();
    }
    return result.toArray(new TreeElement[result.size()]);
}
Also used : PsiCutSection(com.perl5.lang.pod.psi.PsiCutSection) ArrayList(java.util.ArrayList) PsiPodSection(com.perl5.lang.pod.psi.PsiPodSection) PsiElement(com.intellij.psi.PsiElement) PsiPodSection(com.perl5.lang.pod.psi.PsiPodSection) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PsiElement (com.intellij.psi.PsiElement)1 PsiCutSection (com.perl5.lang.pod.psi.PsiCutSection)1 PsiPodSection (com.perl5.lang.pod.psi.PsiPodSection)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1