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

Java XmlTagChild类代码示例

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

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



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

示例1: getElementsToSurround

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
@NotNull public PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
  final Pair<XmlTagChild, XmlTagChild> childrenInRange = XmlUtil.findTagChildrenInRange(file, startOffset, endOffset);
  if (childrenInRange == null) {
    final PsiElement elementAt = file.findElementAt(startOffset);
    if (elementAt instanceof XmlToken &&
        ((XmlToken)elementAt).getTokenType() == XmlTokenType.XML_DATA_CHARACTERS) {
      return new PsiElement[] {elementAt};
    }
    return PsiElement.EMPTY_ARRAY;
  }
  List<PsiElement> result = new ArrayList<PsiElement>();
  PsiElement first = childrenInRange.getFirst();
  PsiElement last = childrenInRange.getSecond();
  while(true) {
    result.add(first);
    if (first == last) break;
    first = first.getNextSibling();
  }

  return PsiUtilCore.toPsiElementArray(result);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:XmlSurroundDescriptor.java


示例2: resolve

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Nullable
public PsiElement resolve() {
  PsiElement result = doResolve();
  if (result == null) {
    if (MavenDomUtil.isMavenFile(getElement())) {
      result = tryResolveToActivationSection();
      if (result == null) return null;
    }
  }

  if (result instanceof XmlTag) {
    XmlTagChild[] children = ((XmlTag)result).getValue().getChildren();
    if (children.length != 1 || !(children[0] instanceof Navigatable)) return result;
    return new MavenPsiElementWrapper(result, (Navigatable)children[0]);
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MavenPropertyPsiReference.java


示例3: applyFix

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
  final PsiElement element = descriptor.getPsiElement();
  if (element != null) {
    final PsiFile containingFile = element.getContainingFile();
    LOG.assertTrue(containingFile != null && JavaFxFileTypeFactory.isFxml(containingFile), containingFile == null ? "no containing file found" : "containing file: " + containingFile.getName());
    final XmlTag xmlTag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
    if (xmlTag != null) {
      final XmlTag parentTag = xmlTag.getParentTag();
      final PsiElement[] children = PsiTreeUtil.getChildrenOfType(xmlTag, XmlTagChild.class);
      if (children != null) {
        if (!FileModificationService.getInstance().preparePsiElementsForWrite(element)) return;
        if (children.length > 0) {
          parentTag.addRange(children[0], children[children.length - 1]);
        }
        xmlTag.delete();
        CodeStyleManager.getInstance(project).reformat(parentTag);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:UnwrapTagFix.java


示例4: getElementsToSurround

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@NotNull public PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
  final Pair<XmlTagChild, XmlTagChild> childrenInRange = XmlUtil.findTagChildrenInRange(file, startOffset, endOffset);
  if (childrenInRange == null) {
    final PsiElement elementAt = file.findElementAt(startOffset);
    if (elementAt instanceof XmlToken &&
        ((XmlToken)elementAt).getTokenType() == XmlTokenType.XML_DATA_CHARACTERS) {
      return new PsiElement[] {elementAt};
    }
    return PsiElement.EMPTY_ARRAY;
  }
  List<PsiElement> result = new ArrayList<PsiElement>();
  PsiElement first = childrenInRange.getFirst();
  PsiElement last = childrenInRange.getSecond();
  while(true) {
    result.add(first);
    if (first == last) break;
    first = first.getNextSibling();
  }

  return PsiUtilCore.toPsiElementArray(result);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:XmlSurroundDescriptor.java


示例5: getTextElements

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
@NotNull
public XmlText[] getTextElements()
{
	XmlText[] textElements = myTextElements;
	if(textElements != null)
	{
		return textElements;
	}
	final List<XmlText> textElementsList = new ArrayList<XmlText>();
	for(final XmlTagChild element : myElements)
	{
		if(element instanceof XmlText)
		{
			textElementsList.add((XmlText) element);
		}
	}
	return myTextElements = textElementsList.isEmpty() ? XmlText.EMPTY_ARRAY : ContainerUtil.toArray(textElementsList, new XmlText[textElementsList.size()]);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:20,代码来源:XmlTagValueImpl.java


示例6: getText

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
@NotNull
public String getText()
{
	String text = myText;
	if(text != null)
	{
		return text;
	}
	final StringBuilder consolidatedText = new StringBuilder();
	for(final XmlTagChild element : myElements)
	{
		consolidatedText.append(element.getText());
	}
	return myText = consolidatedText.toString();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:17,代码来源:XmlTagValueImpl.java


示例7: getElementsToSurround

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@NotNull public PsiElement[] getElementsToSurround(PsiFile file, int startOffset, int endOffset) {
  final Pair<XmlTagChild, XmlTagChild> childrenInRange = XmlUtil.findTagChildrenInRange(file, startOffset, endOffset);
  if (childrenInRange == null) {
    final PsiElement elementAt = file.findElementAt(startOffset);
    if (elementAt instanceof XmlToken &&
        ((XmlToken)elementAt).getTokenType() == XmlTokenType.XML_DATA_CHARACTERS) {
      return new PsiElement[] {elementAt};
    }
    return PsiElement.EMPTY_ARRAY;
  }
  List<PsiElement> result = new ArrayList<PsiElement>();
  PsiElement first = childrenInRange.getFirst();
  PsiElement last = childrenInRange.getSecond();
  while(true) {
    result.add(first);
    if (first == last) break;
    first = first.getNextSibling();
  }

  return PsiUtilBase.toPsiElementArray(result);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:22,代码来源:XmlSurroundDescriptor.java


示例8: checkClassReferenceInStaticContext

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
private void checkClassReferenceInStaticContext(final JSExpression node, @PropertyKey(resourceBundle = JavaScriptBundle.BUNDLE) String key)
{
	PsiElement element = PsiTreeUtil.getParentOfType(node, JSFunction.class, JSFile.class, JSClass.class, JSObjectLiteralExpression.class,
			XmlTagChild.class);

	if(element instanceof JSFunction)
	{
		final JSFunction function = (JSFunction) element;

		final JSAttributeList attributeList = function.getAttributeList();
		if(attributeList != null && attributeList.hasModifier(JSAttributeList.ModifierType.STATIC))
		{
			myHolder.createErrorAnnotation(node, JavaScriptBundle.message(key));
			return;
		}
	}

	PsiElement elementParent;
	if(node instanceof JSSuperExpression && (element == null || (!((elementParent = element.getParent()) instanceof JSClass) && (!(elementParent
			instanceof JSFile) || elementParent.getContext() == null))))
	{
		myHolder.createErrorAnnotation(node, JavaScriptBundle.message("javascript.validation.message.super.referenced.without.class.instance.context"));
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:25,代码来源:JSAnnotatingVisitor.java


示例9: visitJSReturnStatement

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
public void visitJSReturnStatement(final JSReturnStatement node)
{
	final PsiElement element = PsiTreeUtil.getParentOfType(node, JSFunction.class, XmlTagChild.class, XmlAttributeValue.class, JSFile.class);
	if((element instanceof JSFile && !(element.getContext() instanceof PsiLanguageInjectionHost)) || (element instanceof XmlTagChild && !(element
			.getParent() instanceof XmlAttributeValue)))
	{
		myHolder.createErrorAnnotation(node, JavaScriptBundle.message("javascript.validation.message.return.outside.function.definition"));
	}

	if(element instanceof JSFunction)
	{
		final @NonNls String typeString = ((JSFunction) element).getReturnTypeString();
		if(typeString != null && !"void".equals(typeString) && node.getExpression() == null)
		{
			myHolder.createErrorAnnotation(node, JavaScriptBundle.message("javascript.validation.message.return.value.of.type.is.required", typeString));
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:20,代码来源:JSAnnotatingVisitor.java


示例10: isTerminated

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
private static boolean isTerminated(JSStatement statement)
{
	final PsiElement parent = statement.getParent();
	if(parent instanceof JSForInStatement || parent instanceof JSForStatement)
	{
		return true;
	}
	final String text = statement.getText();
	if(text == null)
	{
		return true;
	}

	boolean terminated = text.endsWith(";");
	if(!terminated)
	{
		PsiElement container = PsiTreeUtil.getNonStrictParentOfType(parent, JSFile.class, XmlAttributeValue.class, XmlTagChild.class);
		if(container instanceof JSFile)
		{
			container = container.getContext();
		}
		terminated = container instanceof XmlAttributeValue; // some inline javascript
	}
	return terminated;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:26,代码来源:UnterminatedStatementJSInspection.java


示例11: createXmlTagChildChanged

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
public static PomModelEvent createXmlTagChildChanged(PomModel source, XmlTag context, XmlTagChild treeElement) {
  final PomModelEvent event = new PomModelEvent(source);
  final XmlAspectChangeSetImpl xmlAspectChangeSet = new XmlAspectChangeSetImpl(source, PsiTreeUtil.getParentOfType(context, XmlFile.class));
  xmlAspectChangeSet.add(new XmlTagChildChangedImpl(context, treeElement));
  event.registerChangeSet(source.getModelAspect(XmlAspect.class), xmlAspectChangeSet);
  return event;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:XmlTagChildChangedImpl.java


示例12: createXmlTagValue

import com.intellij.psi.xml.XmlTagChild; //导入依赖的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


示例13: getNextSiblingInTag

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
public XmlTagChild getNextSiblingInTag()
{
	PsiElement nextSibling = getNextSibling();
	if(nextSibling instanceof XmlTagChild)
	{
		return (XmlTagChild) nextSibling;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:11,代码来源:XmlTextImpl.java


示例14: getPrevSiblingInTag

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
public XmlTagChild getPrevSiblingInTag()
{
	PsiElement prevSibling = getPrevSibling();
	if(prevSibling instanceof XmlTagChild)
	{
		return (XmlTagChild) prevSibling;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:11,代码来源:XmlTextImpl.java


示例15: doInjectTo

import com.intellij.psi.xml.XmlTagChild; //导入依赖的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


示例16: processInjectedFileForTag

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
public static void processInjectedFileForTag(final @NotNull XmlTag tag, @NotNull JSInjectedFilesVisitor visitor)
{

	for(XmlTagChild child : tag.getValue().getChildren())
	{
		if(child instanceof XmlText)
		{
			InjectedLanguageUtil.enumerate(child, visitor);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:12,代码来源:JSResolveUtil.java


示例17: getPrevSiblingInTag

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
@Override
public XmlTagChild getPrevSiblingInTag()
{
	final PsiElement prevSibling = getPrevSibling();
	if(prevSibling instanceof XmlTagChild)
	{
		return (XmlTagChild) prevSibling;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:11,代码来源:JSEmbeddedContentImpl.java


示例18: findNearestClass

import com.intellij.psi.xml.XmlTagChild; //导入依赖的package包/类
private PsiElement findNearestClass()
{
	PsiElement elt = element;
	PsiElement parent;
	while(!((parent = elt.getParent()) instanceof JSFile) && !(parent instanceof JSPackageStatement))
	{
		if(parent instanceof XmlTagChild)
		{
			break;
		}
		elt = parent;
		if(elt == null || elt instanceof JSClass)
		{
			break;
		}
	}

	if(parent instanceof XmlTag && XmlBackedJSClassImpl.isInlineComponentTag((XmlTag) parent))
	{
		elt = XmlBackedJSClassImpl.getXmlBackedClass((XmlTag) parent);
	}

	if(elt != null && !(elt instanceof JSClass))
	{
		elt = elt.getNextSibling();
		if(elt instanceof PsiWhiteSpace)
		{
			elt = elt.getNextSibling();
		}
	}
	return elt;
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:33,代码来源:JSReferenceSet.java


示例19: getNextSiblingInTag

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


示例20: getPrevSiblingInTag

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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