Search in sources :

Example 1 with MarkdownFile

use of org.intellij.plugins.markdown.lang.psi.impl.MarkdownFile in project intellij-plugins by JetBrains.

the class MarkdownStructureElement method getChildrenBase.

@NotNull
@Override
public Collection<StructureViewTreeElement> getChildrenBase() {
    final List<StructureViewTreeElement> childrenElements = new ArrayList<>();
    final PsiElement myElement = getElement();
    if (myElement == null)
        return childrenElements;
    final PsiElement structureContainer = myElement instanceof MarkdownFile ? myElement.getFirstChild() : getParentOfType(myElement, TRANSPARENT_CONTAINERS);
    if (structureContainer == null) {
        return Collections.emptyList();
    }
    final MarkdownPsiElement currentHeader = myElement instanceof MarkdownHeaderImpl ? ((MarkdownHeaderImpl) myElement) : null;
    processContainer(structureContainer, currentHeader, currentHeader, element -> childrenElements.add(new MarkdownStructureElement(element)));
    return childrenElements;
}
Also used : MarkdownHeaderImpl(org.intellij.plugins.markdown.lang.psi.impl.MarkdownHeaderImpl) MarkdownFile(org.intellij.plugins.markdown.lang.psi.impl.MarkdownFile) StructureViewTreeElement(com.intellij.ide.structureView.StructureViewTreeElement) MarkdownPsiElement(org.intellij.plugins.markdown.lang.psi.MarkdownPsiElement) PsiElement(com.intellij.psi.PsiElement) MarkdownPsiElement(org.intellij.plugins.markdown.lang.psi.MarkdownPsiElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

StructureViewTreeElement (com.intellij.ide.structureView.StructureViewTreeElement)1 PsiElement (com.intellij.psi.PsiElement)1 MarkdownPsiElement (org.intellij.plugins.markdown.lang.psi.MarkdownPsiElement)1 MarkdownFile (org.intellij.plugins.markdown.lang.psi.impl.MarkdownFile)1 MarkdownHeaderImpl (org.intellij.plugins.markdown.lang.psi.impl.MarkdownHeaderImpl)1 NotNull (org.jetbrains.annotations.NotNull)1