本文整理汇总了Java中com.intellij.util.io.StringRef类的典型用法代码示例。如果您正苦于以下问题:Java StringRef类的具体用法?Java StringRef怎么用?Java StringRef使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringRef类属于com.intellij.util.io包,在下文中一共展示了StringRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStub
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@Override
public PsiNameValuePairStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
String name = null;
String value = null;
List<LighterASTNode> children = tree.getChildren(node);
for (LighterASTNode child : children) {
if (child.getTokenType() == JavaTokenType.IDENTIFIER) {
name = RecordUtil.intern(tree.getCharTable(), child);
}
else if (child.getTokenType() == JavaElementType.LITERAL_EXPRESSION) {
value = RecordUtil.intern(tree.getCharTable(), tree.getChildren(child).get(0));
value = StringUtil.unquoteString(value);
}
}
return new PsiNameValuePairStubImpl(parentStub, StringRef.fromString(name), StringRef.fromString(value));
}
示例2: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@NotNull
@Override
public PsiClassStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
byte flags = dataStream.readByte();
boolean isAnonymous = PsiClassStubImpl.isAnonymous(flags);
boolean isEnumConst = PsiClassStubImpl.isEnumConstInitializer(flags);
JavaClassElementType type = typeForClass(isAnonymous, isEnumConst);
if (!isAnonymous) {
StringRef name = dataStream.readName();
StringRef qname = dataStream.readName();
int languageLevelId = dataStream.readByte();
StringRef sourceFileName = dataStream.readName();
PsiClassStubImpl classStub = new PsiClassStubImpl(type, parentStub, qname, name, null, flags);
classStub.setLanguageLevel(LanguageLevel.values()[languageLevelId]);
classStub.setSourceFileName(sourceFileName);
return classStub;
}
else {
StringRef baseRef = dataStream.readName();
return new PsiClassStubImpl(type, parentStub, null, null, baseRef, flags);
}
}
示例3: PsiClassStubImpl
import com.intellij.util.io.StringRef; //导入依赖的package包/类
public PsiClassStubImpl(final JavaClassElementType type,
final StubElement parent,
final StringRef qualifiedName,
final StringRef name,
final StringRef baseRefText,
final byte flags) {
super(parent, type);
myQualifiedName = qualifiedName;
myName = name;
myBaseRefText = baseRefText;
myFlags = flags;
if (StubBasedPsiElementBase.ourTraceStubAstBinding) {
String creationTrace = "Stub creation thread: " + Thread.currentThread() + "\n" + DebugUtil.currentStackTrace();
putUserData(StubBasedPsiElementBase.CREATION_TRACE, creationTrace);
}
}
示例4: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@NotNull
public static SerializedFqnTypeRef deserialize(@NotNull StubInputStream stream) throws IOException {
String shortNameStr = StringRef.toString(stream.readName());
Qn shortName = null;
List<Qn> namespacesToSearch = null;
if (shortNameStr != null) {
shortName = Qn.fromDotSeparated(shortNameStr);
namespacesToSearch = StubSerializerUtil.deserializeList(s -> {
StringRef namespaceRef = s.readName();
String namespace = StringRef.toString(namespaceRef);
return namespace == null ? null : Qn.fromDotSeparated(namespace);
}, stream, true);
}
return new SerializedFqnTypeRef(shortName, namespacesToSearch);
}
示例5: createStubForFile
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@NotNull
@Override
protected StubElement createStubForFile(@NotNull PsiFile file, @NotNull LighterAST tree) {
if (!(file instanceof PsiJavaFile)) {
return super.createStubForFile(file, tree);
}
String refText = "";
LighterASTNode pkg = LightTreeUtil.firstChildOfType(tree, tree.getRoot(), JavaElementType.PACKAGE_STATEMENT);
if (pkg != null) {
LighterASTNode ref = LightTreeUtil.firstChildOfType(tree, pkg, JavaElementType.JAVA_CODE_REFERENCE);
if (ref != null) {
refText = JavaSourceUtil.getReferenceText(tree, ref);
}
}
return new PsiJavaFileStubImpl((PsiJavaFile)file, StringRef.fromString(refText), false);
}
示例6: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@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;
}
示例7: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@NotNull
public PyTargetExpressionStub deserialize(@NotNull final StubInputStream stream, final StubElement parentStub)
throws IOException {
String name = StringRef.toString(stream.readName());
String docString = stream.readUTFFast();
if (docString.isEmpty()) {
docString = null;
}
PyTargetExpressionStub.InitializerType initializerType = PyTargetExpressionStub.InitializerType.fromIndex(stream.readVarInt());
if (initializerType == PyTargetExpressionStub.InitializerType.Custom) {
final String typeName = stream.readName().getString();
for(CustomTargetExpressionStubType type: getCustomStubTypes()) {
if (type.getClass().getCanonicalName().equals(typeName)) {
CustomTargetExpressionStub stub = type.deserializeStub(stream);
return new PyTargetExpressionStubImpl(name, docString, stub, parentStub);
}
}
throw new IOException("Unknown custom stub type " + typeName);
}
QualifiedName initializer = QualifiedName.deserialize(stream);
boolean isQualified = stream.readBoolean();
return new PyTargetExpressionStubImpl(name, docString, initializerType, initializer, isQualified, parentStub);
}
示例8: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@NotNull
public ModuleStub deserialize(@NotNull final StubInputStream dataStream, final StubElement parentStub) throws IOException {
StringRef moduleName = dataStream.readName();
int moduleQNLength = dataStream.readInt();
String[] moduleQN = new String[moduleQNLength];
for (int i = 0; i < moduleQNLength; i++) {
moduleQN[i] = dataStream.readUTFFast();
}
ModulePath modulePath = new ModulePath(moduleQN);
return new ModuleStub(parentStub, this, moduleName, modulePath);
}
示例9: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@NotNull
@Override
public TemplateDefinitionStub deserialize(
@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
final StringRef ref = dataStream.readName();
return new TemplateDefinitionStub(parentStub, ref.getString());
}
示例10: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@NotNull
@Override
public NamespaceDeclarationStub deserialize(
@NotNull StubInputStream dataStream, StubElement parentStub) throws IOException {
final StringRef ref = dataStream.readName();
return new NamespaceDeclarationStub(parentStub, ref.getString());
}
示例11: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@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());
}
示例12: createStub
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@Override
public LuaCompoundIdentifierStub createStub(@NotNull LuaCompoundIdentifier psi, StubElement parentStub) {
final LuaType luaType = psi.getLuaType();
final byte[] bytes = luaType instanceof LuaPrimitiveType ? null : SerializationUtils.serialize(luaType);
final boolean declaration = psi.isCompoundDeclaration() && psi.getScopeIdentifier() instanceof LuaGlobal;
return new LuaCompoundIdentifierStubImpl(parentStub, StringRef.fromNullableString(psi.getName()), declaration, bytes, luaType);
}
示例13: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@Override
public LuaCompoundIdentifierStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
StringRef ref = dataStream.readName();
final Pair<LuaType, byte[]> pair = LuaStubUtils.readSubstitutableType(dataStream);
byte[] typedata = pair.getSecond();
LuaType type = pair.first;
boolean isDeclaration = dataStream.readBoolean();
return new LuaCompoundIdentifierStubImpl(parentStub, ref, isDeclaration, typedata, type);
}
示例14: createStub
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@Override
public LuaModuleDeclarationStub createStub(@NotNull LuaModuleExpression psi, StubElement parentStub) {
log.debug(psi.getText());
final String moduleName = psi.getModuleName();
return new LuaModuleDeclarationStubImpl(parentStub, StringRef.fromNullableString(psi.getName()), StringRef.fromNullableString(moduleName),
SerializationUtils.serialize(psi.getLuaType()));
}
示例15: deserialize
import com.intellij.util.io.StringRef; //导入依赖的package包/类
@Override
public LuaFileStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
StringRef name = dataStream.readName();
// System.out.println("deserialized file " + name.getString() + " module " + (module!=null?module.getString():"null"));
return new LuaFileStub(name);
}