本文整理汇总了Java中com.intellij.psi.xml.XmlTagValue类的典型用法代码示例。如果您正苦于以下问题:Java XmlTagValue类的具体用法?Java XmlTagValue怎么用?Java XmlTagValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlTagValue类属于com.intellij.psi.xml包,在下文中一共展示了XmlTagValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}
}