Java Code Examples for com.intellij.util.io.StringRef

The following examples show how to use com.intellij.util.io.StringRef. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: reasonml-idea-plugin   Source File: PsiLetStubElementType.java    License: MIT License 6 votes vote down vote up
@NotNull
public PsiLetStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
    StringRef name = dataStream.readName();
    String qname = dataStream.readUTFFast();
    boolean isFunction = dataStream.readBoolean();

    List<String> deconstructionNames = new ArrayList<>();
    byte namesCount = dataStream.readByte();
    if (namesCount > 0) {
        for (int i = 0; i < namesCount; i++) {
             deconstructionNames.add(dataStream.readUTFFast());
        }
    }

    String alias = null;
    boolean isAlias = dataStream.readBoolean();
    if (isAlias) {
        alias = dataStream.readUTFFast();
    }

    return new PsiLetStub(parentStub, this, name, qname, alias, isFunction, deconstructionNames);
}
 
Example 2
Source Project: BashSupport   Source File: BashIncludeCommandElementType.java    License: Apache License 2.0 6 votes vote down vote up
public BashIncludeCommandStub createStub(@NotNull BashIncludeCommand psi, StubElement parentStub) {
    BashFileReference fileReference = psi.getFileReference();

    String filename = null;
    String includer = null;

    if (fileReference != null && fileReference.isStatic()) {
        filename = fileReference.getFilename();
        if (filename.contains("/") && !filename.endsWith("/")) {
            int index = filename.lastIndexOf("/");
            filename = filename.substring(index + 1);
        }

        VirtualFile virtualFile = psi.getContainingFile().getUserData(IndexingDataKeys.VIRTUAL_FILE);
        if (virtualFile == null) {
            virtualFile = psi.getContainingFile().getViewProvider().getVirtualFile();
        }

        includer = virtualFile.getPath();
    }

    return new BashIncludeCommandStubImpl(parentStub, StringRef.fromString(filename), StringRef.fromString(includer), BashElementTypes.INCLUDE_COMMAND_ELEMENT);
}
 
Example 3
@Nonnull
@Override
public CSharpVariableDeclStub<V> deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	int otherModifierMask = stubInputStream.readVarInt();

	String parentQName = null;
	if(supportsParentQName())
	{
		parentQName = StringRef.toString(stubInputStream.readName());
	}

	String initializerText = null;
	if(supportsInitializer(otherModifierMask))
	{
		initializerText = StringRef.toString(stubInputStream.readName());
	}
	return new CSharpVariableDeclStub<>(stubElement, this, parentQName, otherModifierMask, initializerText);
}
 
Example 4
Source Project: consulo   Source File: QualifiedName.java    License: Apache License 2.0 6 votes vote down vote up
@Nullable
public static QualifiedName deserialize(StubInputStream dataStream) throws IOException {
  QualifiedName qName;
  int size = dataStream.readVarInt();
  if (size == 0) {
    qName = null;
  }
  else {
    qName = new QualifiedName(size);
    for (int i = 0; i < size; i++) {
      final StringRef name = dataStream.readName();
      qName.myComponents.add(name == null ? null : name.getString());
    }
  }
  return qName;
}
 
Example 5
Source Project: reasonml-idea-plugin   Source File: PsiLetStub.java    License: MIT License 5 votes vote down vote up
public PsiLetStub(StubElement parent, @NotNull IStubElementType elementType, StringRef name, String qname, String alias, boolean isFunction, List<String> deconstructionNames) {
    super(parent, elementType, name);
    m_qname = qname;
    m_alias = alias;
    m_isFunction = isFunction;
    m_deconstructionNames = deconstructionNames;
}
 
Example 6
Source Project: reasonml-idea-plugin   Source File: PsiModuleStub.java    License: MIT License 5 votes vote down vote up
public PsiModuleStub(StubElement parent, @NotNull IStubElementType elementType, @Nullable StringRef name, @Nullable String path, String alias,
                     boolean isComponent, boolean isInterface) {
    super(parent, elementType, name);
    m_path = path;
    m_qname = path == null || path.length() == 0 ? "" + name : path + "." + name;
    m_alias = alias;
    m_isComponent = isComponent;
    m_isInterface = isInterface;
}
 
Example 7
Source Project: reasonml-idea-plugin   Source File: PsiValStubElementType.java    License: MIT License 5 votes vote down vote up
@NotNull
public PsiValStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
    StringRef name = dataStream.readName();
    String path = dataStream.readUTFFast();
    boolean isFunction = dataStream.readBoolean();
    return new PsiValStub(parentStub, this, name, path, isFunction);
}
 
Example 8
Source Project: reasonml-idea-plugin   Source File: PsiExceptionStubElementType.java    License: MIT License 5 votes vote down vote up
@NotNull
public PsiExceptionStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
    StringRef name = dataStream.readName();
    String path = dataStream.readUTFFast();

    return new PsiExceptionStub(parentStub, this, name, path);
}
 
Example 9
Source Project: reasonml-idea-plugin   Source File: PsiVariantStubElementType.java    License: MIT License 5 votes vote down vote up
@NotNull
public PsiVariantDeclarationStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
    StringRef moduleName = dataStream.readName();
    String path = dataStream.readUTFFast();

    return new PsiVariantDeclarationStub(parentStub, this, moduleName, path);
}
 
Example 10
@NotNull
public PsiModuleStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
    StringRef moduleName = dataStream.readName();
    String qname = dataStream.readUTFFast();
    boolean isComponent = dataStream.readBoolean();
    boolean isInterface = dataStream.readBoolean();

    return new PsiModuleStub(parentStub, this, moduleName, qname, null, isComponent, isInterface);
}
 
Example 11
Source Project: reasonml-idea-plugin   Source File: PsiExternalStubElementType.java    License: MIT License 5 votes vote down vote up
@NotNull
public PsiExternalStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
    StringRef name = dataStream.readName();
    String path = dataStream.readUTFFast();
    boolean isFunction = dataStream.readBoolean();

    return new PsiExternalStub(parentStub, this, name, path, isFunction);
}
 
Example 12
Source Project: bamboo-soy   Source File: AtStateStub.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public AtStateStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub)
    throws IOException {
  final StringRef ref = dataStream.readName();
  final StringRef ref2 = dataStream.readName();
  return new AtStateStub(
      parentStub, ref.getString(), ref2.getString());
}
 
Example 13
Source Project: bamboo-soy   Source File: TemplateDefinitionStub.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public TemplateDefinitionStub deserialize(
    @NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
  final StringRef ref = dataStream.readName();
  return new TemplateDefinitionStub(parentStub, ref.getString());
}
 
Example 14
Source Project: bamboo-soy   Source File: NamespaceDeclarationStub.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public NamespaceDeclarationStub deserialize(
    @NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
  final StringRef ref = dataStream.readName();
  return new NamespaceDeclarationStub(parentStub, ref.getString());
}
 
Example 15
Source Project: bamboo-soy   Source File: AtParamStub.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public AtParamStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub)
    throws IOException {
  final StringRef ref = dataStream.readName();
  final StringRef ref2 = dataStream.readName();
  return new AtParamStub(
      parentStub, ref.getString(), ref2.getString(), dataStream.readBoolean());
}
 
Example 16
public String getNameAsString(StringRef name) {
    if (name != null) {
        return name.getString();
    }

    return null;
}
 
Example 17
Source Project: BashSupport   Source File: BashVarElementType.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
public BashVarStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
    StringRef ref = dataStream.readName();
    int prefixLength = dataStream.readInt();

    return new BashVarStubImpl(parentStub, ref, this, prefixLength);
}
 
Example 18
Source Project: BashSupport   Source File: BashStubFileElementType.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
@Override
public BashFileStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
    StringRef name = dataStream.readName();

    return new BashFileStubImpl(null, name);
}
 
Example 19
Source Project: BashSupport   Source File: BashVarDefElementType.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
public BashVarDefStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
    StringRef ref = dataStream.readName();
    boolean readOnly = dataStream.readBoolean();

    return new BashVarDefStubImpl(parentStub, ref, this, readOnly);
}
 
Example 20
Source Project: BashSupport   Source File: BashSimpleCommandElementType.java    License: Apache License 2.0 5 votes vote down vote up
@NotNull
public BashCommandStub deserialize(@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
    StringRef bashCommandFilename = dataStream.readName();
    boolean internalCommandBash3 = dataStream.readBoolean();
    boolean internalCommandBash4 = dataStream.readBoolean();
    boolean genericCommand = dataStream.readBoolean();

    return new BashCommandStubImpl(parentStub, StringRef.toString(bashCommandFilename), this, internalCommandBash3, internalCommandBash4, genericCommand);
}
 
Example 21
Source Project: consulo-unity3d   Source File: ShaderDefStubElementType.java    License: Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public ShaderDefStub deserialize(@Nonnull StubInputStream dataStream, StubElement parentStub) throws IOException
{
	StringRef name = dataStream.readName();
	return new ShaderDefStub(parentStub, this, name);
}
 
Example 22
@Nonnull
@Override
public CSharpMethodDeclStub deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	StringRef qname = stubInputStream.readName();
	int otherModifierMask = stubInputStream.readVarInt();
	int operatorIndex = stubInputStream.readVarInt();
	return new CSharpMethodDeclStub(stubElement, StringRef.toString(qname), otherModifierMask, operatorIndex);
}
 
Example 23
@Nonnull
@Override
public CSharpIndexMethodDeclStub deserialize(@Nonnull StubInputStream inputStream, StubElement stubElement) throws IOException
{
	StringRef qname = inputStream.readName();
	return new CSharpIndexMethodDeclStub(stubElement, StringRef.toString(qname));
}
 
Example 24
@Nonnull
@Override
public CSharpIdentifierStub deserialize(@Nonnull StubInputStream dataStream, StubElement parentStub) throws IOException
{
	StringRef nameRef = dataStream.readName();
	return new CSharpIdentifierStub(parentStub, this, nameRef);
}
 
Example 25
@Nonnull
@Override
public CSharpMethodDeclStub deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	StringRef qname = stubInputStream.readName();
	return new CSharpMethodDeclStub(stubElement, this, StringRef.toString(qname), 0, -1);
}
 
Example 26
@Nonnull
@Override
public CSharpWithStringValueStub<CSharpGenericConstraint> deserialize(@Nonnull StubInputStream inputStream,
		StubElement stubElement) throws IOException
{
	StringRef text = inputStream.readName();
	return new CSharpWithStringValueStub<CSharpGenericConstraint>(stubElement, this, text);
}
 
Example 27
@Nonnull
@Override
public CSharpNamespaceDeclStub deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	StringRef referenceTextRef = stubInputStream.readName();
	return new CSharpNamespaceDeclStub(stubElement, this, referenceTextRef);
}
 
Example 28
@Nonnull
@Override
public CSharpReferenceExpressionStub deserialize(@Nonnull StubInputStream dataStream, StubElement parentStub) throws IOException
{
	StringRef referenceText = dataStream.readName();
	int kind = dataStream.readVarInt();
	int memberAccessType = dataStream.readVarInt();
	boolean global = dataStream.readBoolean();
	return new CSharpReferenceExpressionStub(parentStub, this, StringRef.toString(referenceText), kind, memberAccessType, global);
}
 
Example 29
@Nonnull
@Override
public CSharpMethodDeclStub deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	StringRef qname = stubInputStream.readName();
	int otherModifierMask = stubInputStream.readVarInt();
	return new CSharpMethodDeclStub(stubElement, this, StringRef.toString(qname), otherModifierMask, -1);
}
 
Example 30
@Override
public CSharpWithStringValueStub<CSharpUsingNamespaceStatement> createStub(@Nonnull CSharpUsingNamespaceStatement statement,
		StubElement stubElement)
{
	String referenceText = statement.getReferenceText();
	return new CSharpWithStringValueStub<CSharpUsingNamespaceStatement>(stubElement, this, StringRef.fromNullableString(referenceText));
}