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


Java ElementManipulators.getValueText方法代码示例

本文整理汇总了Java中com.intellij.psi.ElementManipulators.getValueText方法的典型用法代码示例。如果您正苦于以下问题:Java ElementManipulators.getValueText方法的具体用法?Java ElementManipulators.getValueText怎么用?Java ElementManipulators.getValueText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.ElementManipulators的用法示例。


在下文中一共展示了ElementManipulators.getValueText方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addMacrodefParameterRefs

import com.intellij.psi.ElementManipulators; //导入方法依赖的package包/类
public static void addMacrodefParameterRefs(@NotNull XmlAttributeValue element, final Collection<PsiReference> refs) {
  final DomElement domElement = DomUtil.getDomElement(element);
  if (domElement == null) {
    return;
  }
  final AntDomMacroDef macrodef = domElement.getParentOfType(AntDomMacroDef.class, true);
  if (macrodef == null) {
    return;
  }
  final String text = ElementManipulators.getValueText(element);
  final int valueBeginingOffset = Math.abs(element.getTextRange().getStartOffset() - element.getValueTextRange().getStartOffset());
  int startIndex;
  int endIndex = -1;
  while ((startIndex = text.indexOf("@{", endIndex + 1)) > endIndex) {
    startIndex += 2;
    endIndex = startIndex;
    int nestedBrackets = 0;
    while (text.length() > endIndex) {
      final char ch = text.charAt(endIndex);
      if (ch == '}') {
        if (nestedBrackets == 0) {
          break;
        }
        --nestedBrackets;
      }
      else if (ch == '{') {
        ++nestedBrackets;
      }
      ++endIndex;
    }
    if(nestedBrackets > 0 || endIndex == text.length()) return;
    if (endIndex >= startIndex) {
      //final String name = text.substring(startIndex, endIndex);
       refs.add(new AntDomMacrodefAttributeReference(element, new TextRange(valueBeginingOffset + startIndex, valueBeginingOffset + endIndex)));
    }
    endIndex = startIndex; 
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:AntReferenceInjector.java

示例2: createReferences

import com.intellij.psi.ElementManipulators; //导入方法依赖的package包/类
private PsiReference[] createReferences(final GenericDomValue domValue, final XmlElement psiElement, final Object converter) {
  ConvertContext context = createConvertContext(psiElement, domValue);

  List<PsiReference> result = new ArrayList<PsiReference>();
  String unresolvedText = ElementManipulators.getValueText(psiElement);

  for (DomReferenceInjector each : DomUtil.getFileElement(domValue).getFileDescription().getReferenceInjectors()) {
    Collections.addAll(result, each.inject(unresolvedText, psiElement, context));
  }

  Collections.addAll(result, doCreateReferences(domValue, psiElement, converter, context));

  return result.toArray(new PsiReference[result.size()]);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:15,代码来源:GenericValueReferenceProvider.java

示例3: getReferencesByElement

import com.intellij.psi.ElementManipulators; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context)
{

	if(XmlSchemaTagsProcessor.PROCESSING_FLAG.get() != null || context.get(SUPPRESS) != null)
	{
		return PsiReference.EMPTY_ARRAY;
	}
	@SuppressWarnings("unchecked") PsiElement host = getHost((T) element);
	if(host instanceof PsiLanguageInjectionHost && InjectedLanguageUtil.hasInjections((PsiLanguageInjectionHost) host))
	{
		return PsiReference.EMPTY_ARRAY;
	}
	String unquotedValue = ElementManipulators.getValueText(element);
	if(XmlHighlightVisitor.skipValidation(element) || !XmlUtil.isSimpleValue(unquotedValue, element))
	{
		return PsiReference.EMPTY_ARRAY;
	}
	@SuppressWarnings("unchecked") final Object descriptor = getDescriptor((T) element);
	if(descriptor instanceof XmlEnumerationDescriptor)
	{
		XmlEnumerationDescriptor enumerationDescriptor = (XmlEnumerationDescriptor) descriptor;

		if(enumerationDescriptor.isFixed() || enumerationDescriptor.isEnumerated((XmlElement) element))
		{
			//noinspection unchecked
			return enumerationDescriptor.getValueReferences((XmlElement) element, unquotedValue);
		}
		else if(unquotedValue.equals(enumerationDescriptor.getDefaultValue()))
		{  // todo case insensitive
			return ContainerUtil.map2Array(enumerationDescriptor.getValueReferences((XmlElement) element, unquotedValue), PsiReference.class, reference -> PsiDelegateReference.createSoft
					(reference, true));
		}
	}
	return PsiReference.EMPTY_ARRAY;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:38,代码来源:XmlEnumeratedValueReferenceProvider.java

示例4: ReferenceSetBase

import com.intellij.psi.ElementManipulators; //导入方法依赖的package包/类
public ReferenceSetBase(@NotNull PsiElement element, int offset) {
  this(ElementManipulators.getValueText(element), element, offset, DOT_SEPARATOR);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ReferenceSetBase.java

示例5: ReferenceSetBase

import com.intellij.psi.ElementManipulators; //导入方法依赖的package包/类
public ReferenceSetBase(@Nonnull PsiElement element, int offset) {
  this(ElementManipulators.getValueText(element), element, offset, DOT_SEPARATOR);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:4,代码来源:ReferenceSetBase.java


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