com.jetbrains.php.blade.psi.BladePsiDirective

Here are the examples of the java api com.jetbrains.php.blade.psi.BladePsiDirective taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : BladeFoldingBuilder.java
with MIT License
from rentalhost

private static void processDirectives(@Nullable final BladePsiDirective baseDirective, @NotNull final Queue<BladePsiDirective> directives, @NotNull final Collection<FoldingDescriptor> foldingDescriptors, @NotNull final Doreplacedent doreplacedent) {
    while (true) {
        final BladePsiDirective directive = directives.peek();
        if (directive == null) {
            break;
        }
        if (IGNORED_DIRECTIVES.contains(directive.getName())) {
            directives.poll();
            continue;
        }
        if (baseDirective == null) {
            if (!directive.isToBeClosed()) {
                directives.poll();
                continue;
            }
            processDirectives(directives.poll(), directives, foldingDescriptors, doreplacedent);
            continue;
        }
        // Eg. @endif or @elseif closes @if.
        // Or that @elseif continues @if.
        if (directive.closes(baseDirective) || directive.continues(baseDirective)) {
            // Eg. @endif closes definitively an @if, @else or @elseif.
            // But @elseif or @else don't have the same effect.
            final boolean isDefinitivelyClosing = directive.isClosing() && !directive.isContinued();
            final TextRange foldingRange = new TextRange(baseDirective.getTextRange().getEndOffset(), directive.getTextRange().getStartOffset() - calculateEndOffsetReductor(directive, isDefinitivelyClosing));
            if ((foldingRange.getLength() > 0) && !StringUtils.strip(doreplacedent.getText(foldingRange), " ").isEmpty()) {
                foldingDescriptors.add(new FoldingDescriptor(baseDirective.getNode(), foldingRange, FoldingGroup.newGroup("Blade")));
            }
            if (isDefinitivelyClosing) {
                directives.poll();
                break;
            }
            processDirectives(directives.poll(), directives, foldingDescriptors, doreplacedent);
            break;
        }
        // Eg. @if or @elseif (but it will be catched on previous condition).
        if (directive.isContinued()) {
            processDirectives(directives.poll(), directives, foldingDescriptors, doreplacedent);
            continue;
        }
        directives.poll();
    }
}