Package com.dmarcotte.handlebars.psi.impl

Source Code of com.dmarcotte.handlebars.psi.impl.HbBlockWrapperImpl

package com.dmarcotte.handlebars.psi.impl;

import com.dmarcotte.handlebars.psi.HbBlockWrapper;
import com.dmarcotte.handlebars.psi.HbOpenBlockMustache;
import com.intellij.lang.ASTNode;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.*;

public class HbBlockWrapperImpl extends HbPsiElementImpl implements HbBlockWrapper {
  public HbBlockWrapperImpl(@NotNull ASTNode astNode) {
    super(astNode);
  }

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

  @Nullable
  @Override
  public Icon getIcon(@IconFlags int flags) {
    HbOpenBlockMustache openBlockMustache = getHbOpenBlockMustache();
    return openBlockMustache == null ? null : openBlockMustache.getIcon(0);
  }

  private HbOpenBlockMustache getHbOpenBlockMustache() {
    return PsiTreeUtil.findChildOfType(this, HbOpenBlockMustache.class);
  }
}
TOP

Related Classes of com.dmarcotte.handlebars.psi.impl.HbBlockWrapperImpl

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.