com.intellij.util.io.StringRef Java Examples

The following examples show how to use com.intellij.util.io.StringRef. 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 File: BashIncludeCommandElementType.java    From BashSupport with 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 #2
Source File: QualifiedName.java    From consulo with 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 #3
Source File: PsiLetStubElementType.java    From reasonml-idea-plugin with 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 #4
Source File: CSharpBaseVariableStubElementType.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@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 #5
Source File: CSharpUserTypeStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CSharpWithStringValueStub<CSharpUserType> deserialize(@Nonnull StubInputStream stubInputStream,
		StubElement stubElement) throws IOException
{
	StringRef ref = stubInputStream.readName();
	return new CSharpWithStringValueStub<CSharpUserType>(stubElement, this, ref);
}
 
Example #6
Source File: FusionStubElementType.java    From intellij-neos with GNU General Public License v3.0 5 votes vote down vote up
public String getNameAsString(StringRef name) {
    if (name != null) {
        return name.getString();
    }

    return null;
}
 
Example #7
Source File: AtParamStub.java    From bamboo-soy with 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 #8
Source File: TemplateDefinitionStub.java    From bamboo-soy with 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 #9
Source File: ShaderDefStubElementType.java    From consulo-unity3d with 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 #10
Source File: CSharpMethodStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@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 #11
Source File: BashVarElementType.java    From BashSupport with 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 #12
Source File: PsiModuleStub.java    From reasonml-idea-plugin with 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 #13
Source File: CSharpTypeStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CSharpTypeDeclStub deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	StringRef parentQName = stubInputStream.readName();
	StringRef vmQName = stubInputStream.readName();
	int otherModifierMask = stubInputStream.readVarInt();
	return new CSharpTypeDeclStub(stubElement, StringRef.toString(parentQName), StringRef.toString(vmQName), otherModifierMask);
}
 
Example #14
Source File: PsiValStubElementType.java    From reasonml-idea-plugin with 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 #15
Source File: PsiExceptionStubElementType.java    From reasonml-idea-plugin with 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 #16
Source File: CSharpUsingNamespaceStatementStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CSharpWithStringValueStub<CSharpUsingNamespaceStatement> deserialize(@Nonnull StubInputStream stubInputStream,
		StubElement stubElement) throws IOException
{
	StringRef referenceText = stubInputStream.readName();
	return new CSharpWithStringValueStub<CSharpUsingNamespaceStatement>(stubElement, this, referenceText);
}
 
Example #17
Source File: CSharpTypeListElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CSharpTypeListStub deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	byte value = stubInputStream.readByte();
	String[] refs = new String[value];
	for(int i = 0; i < value; i++)
	{
		refs[i] = StringRef.toString(stubInputStream.readName());
	}
	return new CSharpTypeListStub(stubElement, this, refs);
}
 
Example #18
Source File: CSharpUsingNamespaceStatementStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Override
public CSharpWithStringValueStub<CSharpUsingNamespaceStatement> createStub(@Nonnull CSharpUsingNamespaceStatement statement,
		StubElement stubElement)
{
	String referenceText = statement.getReferenceText();
	return new CSharpWithStringValueStub<CSharpUsingNamespaceStatement>(stubElement, this, StringRef.fromNullableString(referenceText));
}
 
Example #19
Source File: AtStateStub.java    From bamboo-soy with 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 #20
Source File: CSharpConstructorStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@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 #21
Source File: BashStubFileElementType.java    From BashSupport with 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 #22
Source File: BashVarDefElementType.java    From BashSupport with 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 #23
Source File: CSharpReferenceExpressionStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@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 #24
Source File: BashSimpleCommandElementType.java    From BashSupport with 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 #25
Source File: CSharpNamespaceStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CSharpNamespaceDeclStub deserialize(@Nonnull StubInputStream stubInputStream, StubElement stubElement) throws IOException
{
	StringRef referenceTextRef = stubInputStream.readName();
	return new CSharpNamespaceDeclStub(stubElement, this, referenceTextRef);
}
 
Example #26
Source File: CSharpGenericConstraintStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@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
Source File: CSharpConversionMethodStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@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 #28
Source File: CSharpIdentifierStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CSharpIdentifierStub deserialize(@Nonnull StubInputStream dataStream, StubElement parentStub) throws IOException
{
	StringRef nameRef = dataStream.readName();
	return new CSharpIdentifierStub(parentStub, this, nameRef);
}
 
Example #29
Source File: PsiLetStub.java    From reasonml-idea-plugin with 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 #30
Source File: CSharpIndexMethodStubElementType.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public CSharpIndexMethodDeclStub deserialize(@Nonnull StubInputStream inputStream, StubElement stubElement) throws IOException
{
	StringRef qname = inputStream.readName();
	return new CSharpIndexMethodDeclStub(stubElement, StringRef.toString(qname));
}