Search in sources :

Example 1 with ASTWrapperPsiElement

use of com.intellij.extapi.psi.ASTWrapperPsiElement in project intellij-community by JetBrains.

the class TraverserBasedASTNode method getPsiImpl.

public PsiElement getPsiImpl() {
    IElementType type = getElementType();
    ParserDefinition pd = LanguageParserDefinitions.INSTANCE.forLanguage(type.getLanguage());
    if (pd != null && pd.getWhitespaceTokens().contains(type) || pd == null && type == TokenType.WHITE_SPACE) {
        return new PsiWhiteSpaceImpl(getChars());
    } else if (pd != null && pd.getCommentTokens().contains(type)) {
        return new ASTWrapperPsiComment(this);
    } else if (pd == null || myNode instanceof LighterASTTokenNode) {
        return new ASTWrapperPsiElement(this);
    } else {
        return pd.createElement(this);
    }
}
Also used : IElementType(com.intellij.psi.tree.IElementType) ASTWrapperPsiElement(com.intellij.extapi.psi.ASTWrapperPsiElement) PsiWhiteSpaceImpl(com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl)

Example 2 with ASTWrapperPsiElement

use of com.intellij.extapi.psi.ASTWrapperPsiElement in project intellij-community by JetBrains.

the class GroovyDocPsiCreator method createElement.

public static PsiElement createElement(ASTNode node) {
    IElementType type = node.getElementType();
    if (type instanceof GroovyDocTagValueTokenType) {
        GroovyDocTagValueTokenType value = (GroovyDocTagValueTokenType) type;
        GroovyDocTagValueTokenType.TagValueTokenType valueType = GroovyDocTagValueTokenType.getValueType(node);
        if (valueType == GroovyDocTagValueTokenType.TagValueTokenType.REFERENCE_ELEMENT)
            return new GrDocReferenceElementImpl(node);
        return new GrDocTagValueTokenImpl(node);
    }
    if (type == GroovyDocElementTypes.GDOC_TAG)
        return new GrDocTagImpl(node);
    if (type == GroovyDocElementTypes.GDOC_INLINED_TAG)
        return new GrDocInlinedTagImpl(node);
    if (type == GroovyDocElementTypes.GDOC_METHOD_REF)
        return new GrDocMethodReferenceImpl(node);
    if (type == GroovyDocElementTypes.GDOC_FIELD_REF)
        return new GrDocFieldReferenceImpl(node);
    if (type == GroovyDocElementTypes.GDOC_PARAM_REF)
        return new GrDocParameterReferenceImpl(node);
    if (type == GroovyDocElementTypes.GDOC_METHOD_PARAMS)
        return new GrDocMethodParamsImpl(node);
    if (type == GroovyDocElementTypes.GDOC_METHOD_PARAMETER)
        return new GrDocMethodParameterImpl(node);
    return new ASTWrapperPsiElement(node);
}
Also used : GroovyDocTagValueTokenType(org.jetbrains.plugins.groovy.lang.groovydoc.parser.elements.GroovyDocTagValueTokenType) IElementType(com.intellij.psi.tree.IElementType) ASTWrapperPsiElement(com.intellij.extapi.psi.ASTWrapperPsiElement)

Aggregations

ASTWrapperPsiElement (com.intellij.extapi.psi.ASTWrapperPsiElement)2 IElementType (com.intellij.psi.tree.IElementType)2 PsiWhiteSpaceImpl (com.intellij.psi.impl.source.tree.PsiWhiteSpaceImpl)1 GroovyDocTagValueTokenType (org.jetbrains.plugins.groovy.lang.groovydoc.parser.elements.GroovyDocTagValueTokenType)1