Search in sources :

Example 1 with PsiImportStatementStubImpl

use of com.intellij.psi.impl.java.stubs.impl.PsiImportStatementStubImpl in project intellij-community by JetBrains.

the class JavaImportStatementElementType method createStub.

@Override
public PsiImportStatementStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
    boolean isOnDemand = false;
    String refText = null;
    for (LighterASTNode child : tree.getChildren(node)) {
        IElementType type = child.getTokenType();
        if (type == JavaElementType.JAVA_CODE_REFERENCE || type == JavaElementType.IMPORT_STATIC_REFERENCE) {
            refText = JavaSourceUtil.getReferenceText(tree, child);
        } else if (type == JavaTokenType.ASTERISK) {
            isOnDemand = true;
        }
    }
    byte flags = PsiImportStatementStubImpl.packFlags(isOnDemand, node.getTokenType() == JavaElementType.IMPORT_STATIC_STATEMENT);
    return new PsiImportStatementStubImpl(parentStub, refText, flags);
}
Also used : IElementType(com.intellij.psi.tree.IElementType) LighterASTNode(com.intellij.lang.LighterASTNode) PsiImportStatementStubImpl(com.intellij.psi.impl.java.stubs.impl.PsiImportStatementStubImpl)

Example 2 with PsiImportStatementStubImpl

use of com.intellij.psi.impl.java.stubs.impl.PsiImportStatementStubImpl in project intellij-community by JetBrains.

the class JavaImportStatementElementType method deserialize.

@NotNull
@Override
public PsiImportStatementStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
    final byte flags = dataStream.readByte();
    final StringRef refText = dataStream.readName();
    return new PsiImportStatementStubImpl(parentStub, refText, flags);
}
Also used : PsiImportStatementStubImpl(com.intellij.psi.impl.java.stubs.impl.PsiImportStatementStubImpl) StringRef(com.intellij.util.io.StringRef) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PsiImportStatementStubImpl (com.intellij.psi.impl.java.stubs.impl.PsiImportStatementStubImpl)2 LighterASTNode (com.intellij.lang.LighterASTNode)1 IElementType (com.intellij.psi.tree.IElementType)1 StringRef (com.intellij.util.io.StringRef)1 NotNull (org.jetbrains.annotations.NotNull)1