当前位置: 首页>>代码示例>>Java>>正文


Java GenericDomValue.getStringValue方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ClassArrayConverterImpl.java

示例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()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:ParentStyleConverter.java

示例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()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:AntDomTargetDependsListConverter.java

示例4: valueOf

import com.intellij.util.xml.GenericDomValue; //导入方法依赖的package包/类
@Override
public final String valueOf(GenericDomValue<T> object) {
  return object.getStringValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:GenericValueColumnInfo.java

示例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)};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:MavenReferenceConverter.java


注:本文中的com.intellij.util.xml.GenericDomValue.getStringValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。