本文整理汇总了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;未经允许,请勿转载。 |
请发表评论