Search in sources :

Example 1 with PodSectionStub

use of com.perl5.lang.pod.parser.psi.stubs.PodSectionStub in project Perl5-IDEA by Camelcade.

the class PodStubBasedSectionMixin method getTitleText.

@Override
@Nullable
public String getTitleText() {
    PodSectionStub stub = getStub();
    if (stub != null) {
        return stub.getTitleText();
    }
    StringBuilder builder = new StringBuilder();
    renderElementTitleAsText(builder, new PodRenderingContext());
    return builder.toString();
}
Also used : PodSectionStub(com.perl5.lang.pod.parser.psi.stubs.PodSectionStub) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with PodSectionStub

use of com.perl5.lang.pod.parser.psi.stubs.PodSectionStub in project Perl5-IDEA by Camelcade.

the class PodFormatterX method getIndexTarget.

/**
 * @return a real target of this index. Outer item, heading or file.
 */
@Nullable
public PsiElement getIndexTarget() {
    PodSectionStub stub = getStub();
    if (stub != null) {
        StubElement<?> parentStub = stub.getParentStub();
        return parentStub == null ? null : parentStub.getPsi();
    }
    PsiElement parent = getParent();
    if (parent instanceof PodSectionTitle || parent instanceof PodSectionContent) {
        return parent.getParent();
    }
    return parent;
}
Also used : PodSectionStub(com.perl5.lang.pod.parser.psi.stubs.PodSectionStub) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with PodSectionStub

use of com.perl5.lang.pod.parser.psi.stubs.PodSectionStub in project Perl5-IDEA by Camelcade.

the class PodSectionItem method getPresentableText.

@Override
@Nullable
public String getPresentableText() {
    PodSectionStub greenStub = getGreenStub();
    if (greenStub != null) {
        String content = greenStub.getContent();
        return content.isEmpty() ? "" : content.substring(1);
    }
    if (isTargetable()) {
        return super.getPresentableText();
    }
    PsiElement contentBlock = getContentBlock();
    if (contentBlock == null) {
        return null;
    }
    return PodLinkCompletionProvider.trimItemText(PodRenderUtil.renderPsiElementAsText(contentBlock));
}
Also used : PodSectionStub(com.perl5.lang.pod.parser.psi.stubs.PodSectionStub) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

PodSectionStub (com.perl5.lang.pod.parser.psi.stubs.PodSectionStub)3 Nullable (org.jetbrains.annotations.Nullable)3 PsiElement (com.intellij.psi.PsiElement)2