• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java XmlTagValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.psi.xml.XmlTagValue的典型用法代码示例。如果您正苦于以下问题:Java XmlTagValue类的具体用法?Java XmlTagValue怎么用?Java XmlTagValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



XmlTagValue类属于com.intellij.psi.xml包,在下文中一共展示了XmlTagValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getRangeInElement

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Override
@NotNull
public TextRange getRangeInElement(@NotNull final XmlTag tag) {
  if (tag.getSubTags().length > 0) {
    // Text range in tag with subtags is not supported, return empty range, consider making this function nullable.
    return TextRange.EMPTY_RANGE;
  }

  final XmlTagValue value = tag.getValue();
  final XmlText[] texts = value.getTextElements();
  switch (texts.length) {
    case 0:
      return value.getTextRange().shiftRight(-tag.getTextOffset());
    case 1:
      return getValueRange(texts[0]);
    default:
      return TextRange.EMPTY_RANGE;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XmlTagManipulator.java


示例2: getPackageInfoText

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Nullable
private static String getPackageInfoText(XmlFile xmlFile) {
  final XmlTag rootTag = xmlFile.getRootTag();
  if (rootTag == null) {
    return null;
  }
  final PsiElement[] children = rootTag.getChildren();
  for (PsiElement child : children) {
    if (!(child instanceof HtmlTag)) {
      continue;
    }
    final HtmlTag htmlTag = (HtmlTag)child;
    @NonNls final String name = htmlTag.getName();
    if ("body".equalsIgnoreCase(name)) {
      final XmlTagValue value = htmlTag.getValue();
      return value.getText();
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:PackageDotHtmlMayBePackageInfoInspection.java


示例3: getRangeInElement

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
public TextRange getRangeInElement(final XmlTag tag) {
  if (tag.getSubTags().length > 0) {
    // Text range in tag with subtags is not supported, return empty range, consider making this function nullable.
    return TextRange.EMPTY_RANGE;
  }

  final XmlTagValue value = tag.getValue();
  final XmlText[] texts = value.getTextElements();
  switch (texts.length) {
    case 0:
      return value.getTextRange().shiftRight(-tag.getTextOffset());
    case 1:
      return getValueRange(texts[0]);
    default:
      return TextRange.EMPTY_RANGE;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:18,代码来源:XmlTagManipulator.java


示例4: getPackageInfoText

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Nullable
private static String getPackageInfoText(XmlFile xmlFile) {
  final XmlTag rootTag = xmlFile.getRootTag();
  if (rootTag == null) {
    return null;
  }
  final PsiElement[] children = rootTag.getChildren();
  for (PsiElement child : children) {
    if (!(child instanceof HtmlTag)) {
      continue;
    }
    final HtmlTag htmlTag = (HtmlTag)child;
    @NonNls final String name = htmlTag.getName();
    if ("body".equals(name)) {
      final XmlTagValue value = htmlTag.getValue();
      return value.getText();
    }
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:PackageDotHtmlMayBePackageInfoInspection.java


示例5: getRangeInElement

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Override
@NotNull
public TextRange getRangeInElement(@NotNull final XmlTag tag)
{
	if(tag.getSubTags().length > 0)
	{
		// Text range in tag with subtags is not supported, return empty range, consider making this function nullable.
		return TextRange.EMPTY_RANGE;
	}

	final XmlTagValue value = tag.getValue();
	final XmlText[] texts = value.getTextElements();
	switch(texts.length)
	{
		case 0:
			return value.getTextRange().shiftRight(-tag.getTextOffset());
		case 1:
			return getValueRange(texts[0]);
		default:
			return TextRange.EMPTY_RANGE;
	}
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:23,代码来源:XmlTagManipulator.java


示例6: getValueRanges

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
public static TextRange[] getValueRanges(@NotNull final XmlTag tag)
{
	final XmlTagValue value = tag.getValue();
	final XmlText[] texts = value.getTextElements();
	if(texts.length == 0)
	{
		return new TextRange[]{value.getTextRange().shiftRight(-tag.getTextOffset())};
	}
	else
	{
		final TextRange[] ranges = new TextRange[texts.length];
		for(int i = 0; i < texts.length; i++)
		{
			ranges[i] = getValueRange(texts[i]);
		}
		return ranges;
	}
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:19,代码来源:XmlTagManipulator.java


示例7: getPackageInfoText

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Nullable
private static String getPackageInfoText(XmlFile xmlFile)
{
	final XmlTag rootTag = xmlFile.getRootTag();
	if(rootTag == null)
	{
		return null;
	}
	final PsiElement[] children = rootTag.getChildren();
	for(PsiElement child : children)
	{
		if(!(child instanceof HtmlTag))
		{
			continue;
		}
		final HtmlTag htmlTag = (HtmlTag) child;
		@NonNls final String name = htmlTag.getName();
		if("body".equals(name))
		{
			final XmlTagValue value = htmlTag.getValue();
			return value.getText();
		}
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:26,代码来源:PackageDotHtmlMayBePackageInfoInspection.java


示例8: localizeDescription

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
private String localizeDescription(final DomElement dom) {
    if (dom instanceof Description) {
        final XmlElement xmlElement = dom.getXmlElement();
        if (xmlElement instanceof XmlTag) {
            final XmlTagValue value = ((XmlTag) xmlElement).getValue();
            if (value != null) {
                return value.getTrimmedText();
            }
        }
    }
    return null;
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:13,代码来源:TSStructureTreeElement.java


示例9: getTarget

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Nullable
public static DomTarget getTarget(DomElement element, GenericDomValue nameElement) {
  if (nameElement instanceof GenericAttributeValue) {
    final GenericAttributeValue genericAttributeValue = (GenericAttributeValue)nameElement;
    final XmlAttributeValue attributeValue = genericAttributeValue.getXmlAttributeValue();
    if (attributeValue == null) {
      return null;
    }

    final int length = attributeValue.getTextLength();
    if (length >= 2) {
      return new DomTarget(element, attributeValue, new TextRange(1, length - 1), nameElement);
    }
  }

  final XmlTag tag = nameElement.getXmlTag();
  if (tag == null) {
    return null;
  }

  XmlTagValue tagValue = tag.getValue();
  if (StringUtil.isEmpty(tagValue.getTrimmedText())) {
    return null;
  }

  return new DomTarget(element, tag, XmlTagUtil.getTrimmedValueRange(tag), nameElement);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:DomTarget.java


示例10: getValueRanges

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
public static TextRange[] getValueRanges(@NotNull final XmlTag tag) {
  final XmlTagValue value = tag.getValue();
  final XmlText[] texts = value.getTextElements();
  if (texts.length == 0) {
    return new TextRange[] { value.getTextRange().shiftRight(-tag.getTextOffset()) };
  } else {
    final TextRange[] ranges = new TextRange[texts.length];
    for (int i = 0; i < texts.length; i++) {
      ranges[i] = getValueRange(texts[i]);
    }
    return ranges;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:XmlTagManipulator.java


示例11: testPsiPrimitiveTypeArray

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
public void testPsiPrimitiveTypeArray() throws Throwable {
  final MyElement element = createElement("<a><psi-type>int[]</psi-type></a>");
  final GenericDomValue value = element.getPsiType();
  final XmlTagValue tagValue = value.getXmlTag().getValue();
  final int i = tagValue.getText().indexOf(value.getStringValue());
  assertReference(value, value.getXmlTag(), tagValue.getTextRange().getStartOffset() + i + "int".length());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:DomReferencesTest.java


示例12: assertReference

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
protected PsiReference assertReference(final GenericDomValue value, PsiElement resolveTo) {
  final XmlTagValue tagValue = value.getXmlTag().getValue();
  final TextRange textRange = tagValue.getTextRange();
  final String s = value.getStringValue();
  assertNotNull(s);
  final int i = tagValue.getText().indexOf(s);
  return assertReference(value, resolveTo, textRange.getStartOffset() + i + s.length());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:DomHardCoreTestCase.java


示例13: getTrimmedValueRange

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@NotNull
public static TextRange getTrimmedValueRange(final @NotNull XmlTag tag) {
  XmlTagValue tagValue = tag.getValue();
  final String text = tagValue.getText();
  final String trimmed = text.trim();
  final int index = text.indexOf(trimmed);
  final int startOffset = tagValue.getTextRange().getStartOffset() - tag.getTextRange().getStartOffset() + index;
  return new TextRange(startOffset, startOffset + trimmed.length());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:XmlTagUtil.java


示例14: assertReference

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
protected PsiReference assertReference(final GenericDomValue value, PsiElement resolveTo) {
  final XmlTagValue tagValue = value.getXmlTag().getValue();
  final TextRange textRange = tagValue.getTextRange();
  final String s = value.getStringValue();
  final int i = tagValue.getText().indexOf(s);
  return assertReference(value, resolveTo, textRange.getStartOffset() + i + s.length());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:8,代码来源:DomHardCoreTestCase.java


示例15: getValueRanges

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
public static TextRange[] getValueRanges(final @NotNull XmlTag tag) {
  final XmlTagValue value = tag.getValue();
  final XmlText[] texts = value.getTextElements();
  if (texts.length == 0) {
    return new TextRange[] { value.getTextRange().shiftRight(-tag.getTextOffset()) };
  } else {
    final TextRange[] ranges = new TextRange[texts.length];
    for (int i = 0; i < texts.length; i++) {
      ranges[i] = getValueRange(texts[i]);
    }
    return ranges;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:XmlTagManipulator.java


示例16: getRequestAttributes

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
/**
 * "_controller" and "_route"
 * "/_profiler/242e61?panel=request"
 *
 * <tr>
 *  <th>_route</th>
 *  <td>foo_route</td>
 * </tr>
 */
@NotNull
public static Map<String, String> getRequestAttributes(@NotNull Project project, @NotNull String html) {
    HtmlFileImpl htmlFile = (HtmlFileImpl) PsiFileFactory.getInstance(project).createFileFromText(HTMLLanguage.INSTANCE, html);

    String[] keys = new String[] {"_controller", "_route"};

    Map<String, String> map = new HashMap<>();
    PsiTreeUtil.processElements(htmlFile, psiElement -> {
        if(!(psiElement instanceof XmlTag) || !"th".equals(((XmlTag) psiElement).getName())) {
            return true;
        }

        XmlTagValue keyTag = ((XmlTag) psiElement).getValue();
        String key = StringUtils.trim(keyTag.getText());
        if(!ArrayUtils.contains(keys, key)) {
            return true;
        }

        XmlTag tdTag = PsiTreeUtil.getNextSiblingOfType(psiElement, XmlTag.class);
        if(tdTag == null || !"td".equals(tdTag.getName())) {
            return true;
        }

        XmlTagValue valueTag = tdTag.getValue();
        String value = valueTag.getText();
        if(StringUtils.isBlank(value)) {
            return true;
        }

        // Symfony 3.2 profiler debug? strip html
        map.put(key, stripHtmlTags(value));

        // exit if all item found
        return map.size() != keys.length;
    });

    return map;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:48,代码来源:ProfilerUtil.java


示例17: getValueReferences

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Override
public PsiReference[] getValueReferences(XmlTag xmlTag, @NotNull String text)
{
	XmlTagValue value = xmlTag.getValue();
	XmlText[] elements = value.getTextElements();
	if(elements.length == 0 || xmlTag.getSubTags().length > 0)
	{
		return PsiReference.EMPTY_ARRAY;
	}
	return new PsiReference[]{
			new XmlEnumeratedValueReference(xmlTag, this, ElementManipulators.getValueTextRange(xmlTag))
	};
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:14,代码来源:XmlElementDescriptorImpl.java


示例18: createXmlTagValue

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
public static XmlTagValue createXmlTagValue(XmlTag tag)
{
	final List<XmlTagChild> bodyElements = new ArrayList<XmlTagChild>();

	tag.processElements(new PsiElementProcessor()
	{
		boolean insideBody = false;

		@Override
		public boolean execute(@NotNull PsiElement element)
		{
			final ASTNode treeElement = element.getNode();
			if(insideBody)
			{
				if(treeElement != null && treeElement.getElementType() == XmlTokenType.XML_END_TAG_START)
				{
					return false;
				}
				if(!(element instanceof XmlTagChild))
				{
					return true;
				}
				bodyElements.add((XmlTagChild) element);
			}
			else if(treeElement != null && treeElement.getElementType() == XmlTokenType.XML_TAG_END)
			{
				insideBody = true;
			}
			return true;
		}
	}, tag);

	XmlTagChild[] tagChildren = ContainerUtil.toArray(bodyElements, new XmlTagChild[bodyElements.size()]);
	return new XmlTagValueImpl(tagChildren, tag);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:36,代码来源:XmlTagValueImpl.java


示例19: doInjectTo

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
private boolean doInjectTo(final XmlTag tag)
{
	final XmlTagValue value = tag.getValue();
	final XmlTagChild[] tagChildren = value.getChildren();

	return tagChildren.length == 1 && (tagChildren[0].getNode().getElementType() == XmlElementType.XML_CDATA || !tagChildren[0].textContains('<'));
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:8,代码来源:JSLanguageInjector.java


示例20: getValue

import com.intellij.psi.xml.XmlTagValue; //导入依赖的package包/类
@Override
@NotNull
public XmlTagValue getValue() {
    return xmlTag.getValue();
}
 
开发者ID:magento,项目名称:magento2-phpstorm-plugin,代码行数:6,代码来源:LineMarkerXmlTagDecorator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CheckGroup类代码示例发布时间:2022-05-22
下一篇:
Java ExchangeFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap