// Path: src/main/java/org/antlr/jetbrains/st4plugin/Icons.java
// public class Icons {
//     public static final Icon STG_FILE = IconLoader.getIcon("/icons/st.png");
//     public static final Icon BIGSTRING = IconLoader.getIcon("/icons/bigstring.png");
//     public static final Icon BIGSTRING_NONL = IconLoader.getIcon("/icons/bigstring-nonl.png");
//     public static final Icon STRING = IconLoader.getIcon("/icons/string.png");
//     public static final Icon DICT = IconLoader.getIcon("/icons/dict.png");
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STGParser.class) int ruleIndex) {
//     return RULE_ELEMENT_TYPES.get(ruleIndex);
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public static TokenIElementType getTokenElementType(@MagicConstant(valuesFromClass = STGLexer.class) int ruleIndex) {
//     return TOKEN_ELEMENT_TYPES.get(ruleIndex);
// }


import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import org.antlr.jetbrains.st4plugin.Icons;
import org.antlr.jetbrains.st4plugin.parsing.STGLexer;
import org.antlr.jetbrains.st4plugin.parsing.STGParser;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Arrays;
import java.util.stream.Collectors;
import static org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes.getRuleElementType;
import static org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes.getTokenElementType;
            text.append(')');
        }

        return text.toString();
    }

    @Nullable
    @Override
    public String getLocationString() {
        return null;
    }

    @Nullable
    @Override
    public Icon getIcon(boolean unused) {
        if (psiElement.getNode().getElementType() == getRuleElementType(STGParser.RULE_dict)) {
            return Icons.DICT;
        }

        ASTNode content = psiElement.getNode().findChildByType(getRuleElementType(STGParser.RULE_templateContent));
        IElementType elementType = null;

        if (content != null) {
            ASTNode firstChild = content.getFirstChildNode();

            if (firstChild != null) {
                elementType = firstChild.getElementType();
            }
        }

// Path: src/main/java/org/antlr/jetbrains/st4plugin/Icons.java
// public class Icons {
//     public static final Icon STG_FILE = IconLoader.getIcon("/icons/st.png");
//     public static final Icon BIGSTRING = IconLoader.getIcon("/icons/bigstring.png");
//     public static final Icon BIGSTRING_NONL = IconLoader.getIcon("/icons/bigstring-nonl.png");
//     public static final Icon STRING = IconLoader.getIcon("/icons/string.png");
//     public static final Icon DICT = IconLoader.getIcon("/icons/dict.png");
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public static RuleIElementType getRuleElementType(@MagicConstant(valuesFromClass = STGParser.class) int ruleIndex) {
//     return RULE_ELEMENT_TYPES.get(ruleIndex);
// }
// 
// Path: src/main/java/org/antlr/jetbrains/st4plugin/psi/STGroupTokenTypes.java
// public static TokenIElementType getTokenElementType(@MagicConstant(valuesFromClass = STGLexer.class) int ruleIndex) {
//     return TOKEN_ELEMENT_TYPES.get(ruleIndex);
// }


// Path: src/main/java/org/antlr/jetbrains/st4plugin/structview/STGroupTemplateDefItemPresentation.java
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.TokenSet;
import org.antlr.jetbrains.st4plugin.Icons;
import org.antlr.jetbrains.st4plugin.parsing.STGLexer;
import org.antlr.jetbrains.st4plugin.parsing.STGParser;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Arrays;
import java.util.stream.Collectors;
import static org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes.getRuleElementType;
import static org.antlr.jetbrains.st4plugin.psi.STGroupTokenTypes.getTokenElementType;

            text.append(')');
        }

        return text.toString();
    }

    @Nullable
    @Override
    public String getLocationString() {
        return null;
    }

    @Nullable
    @Override
    public Icon getIcon(boolean unused) {
        if (psiElement.getNode().getElementType() == getRuleElementType(STGParser.RULE_dict)) {
            return Icons.DICT;
        }

        ASTNode content = psiElement.getNode().findChildByType(getRuleElementType(STGParser.RULE_templateContent));
        IElementType elementType = null;

        if (content != null) {
            ASTNode firstChild = content.getFirstChildNode();

            if (firstChild != null) {
                elementType = firstChild.getElementType();
            }
        }

        if (elementType == getTokenElementType(STGLexer.STRING)) {