本文整理汇总了Java中com.intellij.util.xml.GenericDomValue.getStringValue方法的典型用法代码示例。如果您正苦于以下问题:Java GenericDomValue.getStringValue方法的具体用法?Java GenericDomValue.getStringValue怎么用?Java GenericDomValue.getStringValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.xml.GenericDomValue
的用法示例。
在下文中一共展示了GenericDomValue.getStringValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createReferences
import com.intellij.util.xml.GenericDomValue; //导入方法依赖的package包/类
@NotNull
public PsiReference[] createReferences(final GenericDomValue genericDomValue, final PsiElement element, final ConvertContext context) {
final String s = genericDomValue.getStringValue();
if (s != null) {
final int offset = ElementManipulators.getOffsetInElement(element);
final ArrayList<PsiReference> list = new ArrayList<PsiReference>();
int pos = -1;
while (true) {
while (pos + 1 < s.length()) {
if (!Character.isWhitespace(s.charAt(pos + 1))) {
break;
}
pos++;
}
int nextPos = s.indexOf(',', pos + 1);
if (nextPos == -1) {
createReference(element, s.substring(pos + 1), pos + 1 + offset, list);
break;
}
else {
createReference(element, s.substring(pos + 1, nextPos), pos + 1 + offset, list);
pos = nextPos;
}
}
return list.toArray(new PsiReference[list.size()]);
}
return PsiReference.EMPTY_ARRAY;
}
示例2: getReferencesInStyleName
import com.intellij.util.xml.GenericDomValue; //导入方法依赖的package包/类
@NotNull
private static PsiReference[] getReferencesInStyleName(@NotNull GenericDomValue<?> value, @NotNull AndroidFacet facet) {
String s = value.getStringValue();
if (s == null) {
return PsiReference.EMPTY_ARRAY;
}
int start = 0;
final int idx = s.indexOf('/');
if (idx >= 0) {
start = idx + 1;
s = s.substring(start);
}
final String[] ids = s.split("\\.");
if (ids.length < 2) {
return PsiReference.EMPTY_ARRAY;
}
final List<PsiReference> result = new ArrayList<PsiReference>(ids.length - 1);
int offset = s.length();
for (int i = ids.length - 1; i >= 0; i--) {
final String styleName = s.substring(0, offset);
if (i < ids.length - 1) {
final ResourceValue val = ResourceValue.referenceTo((char)0, null, ResourceType.STYLE.getName(), styleName);
result.add(new ResourceNameConverter.MyParentStyleReference(value, new TextRange(1 + start, 1 + start + offset), val, facet));
}
if (ResourceNameConverter.hasExplicitParent(facet, styleName)) {
break;
}
offset = offset - ids[i].length() - 1;
}
return result.toArray(new PsiReference[result.size()]);
}
示例3: createReferences
import com.intellij.util.xml.GenericDomValue; //导入方法依赖的package包/类
@NotNull
public PsiReference[] createReferences(GenericDomValue<TargetResolver.Result> value, PsiElement element, ConvertContext context) {
final XmlElement xmlElement = value.getXmlElement();
if (!(xmlElement instanceof XmlAttribute)) {
return PsiReference.EMPTY_ARRAY;
}
final XmlAttributeValue valueElement = ((XmlAttribute)xmlElement).getValueElement();
if (valueElement == null) {
return PsiReference.EMPTY_ARRAY;
}
final String refsString = value.getStringValue();
if (refsString == null) {
return PsiReference.EMPTY_ARRAY;
}
final List<PsiReference> refs = new ArrayList<PsiReference>();
final AntDomTargetReference.ReferenceGroup group = new AntDomTargetReference.ReferenceGroup();
final TextRange wholeStringRange = ElementManipulators.getValueTextRange(valueElement);
final StringTokenizer tokenizer = new StringTokenizer(refsString, ",", false);
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken();
int tokenStartOffset = tokenizer.getCurrentPosition() - token.length();
final String ref = token.trim();
if (ref.length() != token.length()) {
for (int idx = 0; idx < token.length(); idx++) {
if (Character.isWhitespace(token.charAt(idx))) {
tokenStartOffset++;
}
else {
break;
}
}
}
refs.add(new AntDomTargetReference(element, TextRange.from(wholeStringRange.getStartOffset() + tokenStartOffset, ref.length()), group));
}
return refs.toArray(new PsiReference[refs.size()]);
}
示例4: valueOf
import com.intellij.util.xml.GenericDomValue; //导入方法依赖的package包/类
@Override
public final String valueOf(GenericDomValue<T> object) {
return object.getStringValue();
}
示例5: createReferences
import com.intellij.util.xml.GenericDomValue; //导入方法依赖的package包/类
@NotNull
public PsiReference[] createReferences(GenericDomValue value, PsiElement element, ConvertContext context) {
String text = value.getStringValue();
TextRange range = ElementManipulators.getValueTextRange(element);
return new PsiReference[]{createReference(element, text, range)};
}