Examples of HbOpenBlockMustache


Examples of com.dmarcotte.handlebars.psi.HbOpenBlockMustache

public class HbBlockMismatchInspection implements Annotator {
  @Override
  public void annotate(@NotNull PsiElement element, @NotNull AnnotationHolder holder) {
    if (element instanceof HbOpenBlockMustache) {
      HbOpenBlockMustache openBlockMustache = (HbOpenBlockMustache)element;
      HbMustacheName openBlockMustacheName = openBlockMustache.getBlockMustacheName();

      HbCloseBlockMustache closeBlockMustache = openBlockMustache.getPairedElement();
      if (closeBlockMustache != null) {
        HbMustacheName closeBlockMustacheName = closeBlockMustache.getBlockMustacheName();

        if (openBlockMustacheName == null || closeBlockMustacheName == null) {
          return;
        }

        String openBlockName = openBlockMustacheName.getName();
        String closeBlockName = closeBlockMustacheName.getName();
        if (!openBlockName.equals(closeBlockName)) {
          Annotation openBlockAnnotation
            = holder.createErrorAnnotation(openBlockMustacheName,
                                           HbBundle.message("hb.block.mismatch.inspection.open.block", openBlockName, closeBlockName));
          openBlockAnnotation.registerFix(new HbBlockMismatchFix(closeBlockName, openBlockName, true));
          openBlockAnnotation.registerFix(new HbBlockMismatchFix(openBlockName, closeBlockName, false));

          Annotation closeBlockAnnotation
            = holder.createErrorAnnotation(closeBlockMustacheName,
                                           HbBundle.message("hb.block.mismatch.inspection.close.block", openBlockName, closeBlockName));
          closeBlockAnnotation.registerFix(new HbBlockMismatchFix(openBlockName, closeBlockName, false));
          closeBlockAnnotation.registerFix(new HbBlockMismatchFix(closeBlockName, openBlockName, true));
        }
      }
      else {
        holder.createErrorAnnotation(openBlockMustacheName,
                                     HbBundle.message("hb.block.mismatch.inspection.missing.end.block", openBlockMustache.getName()));
      }
    }

    if (element instanceof HbCloseBlockMustache) {
      HbCloseBlockMustache closeBlockMustache = (HbCloseBlockMustache)element;
View Full Code Here

Examples of com.dmarcotte.handlebars.psi.HbOpenBlockMustache

    super(astNode);
  }

  @Override
  public String getName() {
    HbOpenBlockMustache openBlockMustache = getHbOpenBlockMustache();
    return openBlockMustache == null ? null : openBlockMustache.getName();
  }
View Full Code Here

Examples of com.dmarcotte.handlebars.psi.HbOpenBlockMustache

  }

  @Nullable
  @Override
  public Icon getIcon(@IconFlags int flags) {
    HbOpenBlockMustache openBlockMustache = getHbOpenBlockMustache();
    return openBlockMustache == null ? null : openBlockMustache.getIcon(0);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.