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

Java XmlElementType类代码示例

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

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



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

示例1: parseComment

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
protected void parseComment() {
  final PsiBuilder.Marker comment = mark();
  advance();
  while (true) {
    final IElementType tt = token();
    if (tt == XML_COMMENT_CHARACTERS|| tt == XML_CONDITIONAL_COMMENT_START
      || tt == XML_CONDITIONAL_COMMENT_START_END || tt == XML_CONDITIONAL_COMMENT_END_START
      || tt == XML_CONDITIONAL_COMMENT_END) {
      advance();
      continue;
    }
    else if (tt == XML_BAD_CHARACTER) {
      final PsiBuilder.Marker error = mark();
      advance();
      error.error(XmlErrorMessages.message("xml.parsing.bad.character"));
      continue;
    }
    if (tt == XML_COMMENT_END) {
      advance();
    }
    break;
  }
  comment.done(XmlElementType.XML_COMMENT);
}
 
开发者ID:LichFaker,项目名称:RtplPlugin,代码行数:25,代码来源:XmlParsing.java


示例2: getNameFromEntityRef

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Nullable
protected static String getNameFromEntityRef(final CompositeElement compositeElement, final IElementType xmlEntityDeclStart) {
  final ASTNode node = compositeElement.findChildByType(xmlEntityDeclStart);
  if (node == null) return null;
  ASTNode name = node.getTreeNext();

  if (name != null && name.getElementType() == TokenType.WHITE_SPACE) {
    name = name.getTreeNext();
  }

  if (name != null && name.getElementType() == XmlElementType.XML_ENTITY_REF) {
    final StringBuilder builder = new StringBuilder();

    ((XmlElement)name.getPsi()).processElements(new PsiElementProcessor() {
      @Override
      public boolean execute(@NotNull final PsiElement element) {
        builder.append(element.getText());
        return true;
      }
    }, name.getPsi());
    if (builder.length() > 0) return builder.toString();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:XmlElementImpl.java


示例3: fun

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Override
public ThreeState fun(ASTNode oldNode,
                      LighterASTNode newNode,
                      FlyweightCapableTreeStructure<LighterASTNode> structure) {
  if (oldNode instanceof XmlTag && newNode.getTokenType() == XmlElementType.XML_TAG) {
    String oldName = ((XmlTag)oldNode).getName();
    Ref<LighterASTNode[]> childrenRef = Ref.create(null);
    int count = structure.getChildren(newNode, childrenRef);
    if (count < 3) return ThreeState.UNSURE;
    LighterASTNode[] children = childrenRef.get();
    if (children[0].getTokenType() != XmlTokenType.XML_START_TAG_START) return ThreeState.UNSURE;
    if (children[1].getTokenType() != XmlTokenType.XML_NAME) return ThreeState.UNSURE;
    if (children[2].getTokenType() != XmlTokenType.XML_TAG_END) return ThreeState.UNSURE;
    LighterASTTokenNode name = (LighterASTTokenNode)children[1];
    CharSequence newName = name.getText();
    if (!Comparing.equal(oldName, newName)) return ThreeState.NO;
  }

  return ThreeState.UNSURE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:XmlParser.java


示例4: build

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
public void build(XmlBuilder builder) {
  PsiBuilder b = createBuilderAndParse();

  FlyweightCapableTreeStructure<LighterASTNode> structure = b.getLightTree();

  LighterASTNode root = structure.getRoot();
  root = structure.prepareForGetChildren(root);

  final Ref<LighterASTNode[]> childrenRef = Ref.create(null);
  final int count = structure.getChildren(root, childrenRef);
  LighterASTNode[] children = childrenRef.get();

  for (int i = 0; i < count; i++) {
    LighterASTNode child = children[i];
    final IElementType tt = child.getTokenType();
    if (tt == XmlElementType.XML_TAG || tt == XmlElementType.HTML_TAG) {
      processTagNode(b, structure, child, builder);
    }
    else if (tt == XmlElementType.XML_PROLOG) {
      processPrologNode(b, builder, structure, child);
    }
  }

  structure.disposeChildren(children, count);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:XmlBuilderDriver.java


示例5: processPrologNode

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
private void processPrologNode(PsiBuilder psiBuilder,
                               XmlBuilder builder,
                               FlyweightCapableTreeStructure<LighterASTNode> structure,
                               LighterASTNode prolog) {
  final Ref<LighterASTNode[]> prologChildren = new Ref<LighterASTNode[]>(null);
  final int prologChildrenCount = structure.getChildren(structure.prepareForGetChildren(prolog), prologChildren);
  for (int i = 0; i < prologChildrenCount; i++) {
    LighterASTNode node = prologChildren.get()[i];
    IElementType type = node.getTokenType();
    if (type == XmlElementType.XML_DOCTYPE) {
      processDoctypeNode(builder, structure, node);
      break;
    }
    if (type == TokenType.ERROR_ELEMENT) {
      processErrorNode(psiBuilder, node, builder);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XmlBuilderDriver.java


示例6: processChild

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Override
@Nullable
protected
ASTNode processChild(List<Block> result, final ASTNode child, final Wrap wrap, final Alignment alignment, final Indent indent) {
  IElementType type = child.getElementType();
  if (type == XmlElementType.XML_TEXT) {
    final PsiElement parent = child.getPsi().getParent();

    if (parent instanceof XmlTag && ((XmlTag)parent).getSubTags().length == 0) {
      if (buildInjectedPsiBlocks(result, child, wrap, alignment, indent)) return child;
    }
    return createXmlTextBlocks(result, child, wrap, alignment);
  } else if (type == XmlElementType.XML_COMMENT) {
    if (buildInjectedPsiBlocks(result, child, wrap, alignment, indent)) return child;
    return super.processChild(result, child, wrap, alignment, indent);
  }
  else {
    return super.processChild(result, child, wrap, alignment, indent);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:XmlTagBlock.java


示例7: shouldKeepWhitespaces

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
private boolean shouldKeepWhitespaces() {
  if (myNode.getElementType() == XmlElementType.XML_TEXT) {
    if (myXmlFormattingPolicy.getShouldKeepWhiteSpaces()) {
      return true;
    }
    else {
      final ASTNode treeParent = myNode.getTreeParent();
      final XmlTag tag = getTag(treeParent);
      if (tag != null) {
        if (myXmlFormattingPolicy.keepWhiteSpacesInsideTag(tag)) {
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:XmlBlock.java


示例8: splitComment

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
protected List<Block> splitComment() {
  if (myNode.getElementType() != XmlElementType.XML_COMMENT) return EMPTY;
  final ArrayList<Block> result = new ArrayList<Block>(3);
  ASTNode child = myNode.getFirstChildNode();
  boolean hasOuterLangElements = false;
  while (child != null) {
    if (child instanceof OuterLanguageElement) {
      hasOuterLangElements = true;
    }
    result.add(new XmlBlock(child, null, null, myXmlFormattingPolicy, getChildIndent(), null, isPreserveSpace()));
    child = child.getTreeNext();
  }
  if (hasOuterLangElements) {
    return result;
  }
  else {
    return EMPTY;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:XmlBlock.java


示例9: getChangeHighlightingDirtyScopeFor

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Override
public PsiElement getChangeHighlightingDirtyScopeFor(@NotNull PsiElement changedElement) {
  try {
    if (changedElement instanceof XmlToken && changedElement.getNode().getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN) {
      final PsiElement grandParent = changedElement.getParent().getParent();
      if (grandParent instanceof XmlAttribute) {
        if (XsltSupport.isXPathAttribute((XmlAttribute)grandParent)) {
          return grandParent;
        }
      }
    } else if (changedElement instanceof XmlTag && XsltSupport.isTemplate((XmlTag)changedElement, false)) {
      return changedElement;
    }
  } catch (NullPointerException e) {
    // sth was null
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:XsltChangeLocalityDetector.java


示例10: parseComment

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
protected void parseComment() {
  final PsiBuilder.Marker comment = mark();
  advance();
  while (true) {
    final IElementType tt = token();
    if (tt == XmlTokenType.XML_COMMENT_CHARACTERS || tt == XmlTokenType.XML_CHAR_ENTITY_REF || tt == XmlTokenType.XML_CONDITIONAL_COMMENT_START
      || tt == XmlTokenType.XML_CONDITIONAL_COMMENT_START_END || tt == XmlTokenType.XML_CONDITIONAL_COMMENT_END_START
      || tt == XmlTokenType.XML_CONDITIONAL_COMMENT_END) {
      advance();
      continue;
    }
    if (tt == XmlTokenType.XML_BAD_CHARACTER) {
      final PsiBuilder.Marker error = mark();
      advance();
      error.error(XmlErrorMessages.message("xml.parsing.bad.character"));
      continue;
    }
    if (tt == XmlTokenType.XML_COMMENT_END) {
      advance();
    }
    break;
  }
  comment.done(XmlElementType.XML_COMMENT);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:HtmlParsing.java


示例11: getNameFromEntityRef

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Nullable
protected static String getNameFromEntityRef(final CompositeElement compositeElement, final IElementType xmlEntityDeclStart) {
  final ASTNode node = compositeElement.findChildByType(xmlEntityDeclStart);
  if (node == null) return null;
  ASTNode name = node.getTreeNext();

  if (name != null && name.getElementType() == TokenType.WHITE_SPACE) {
    name = name.getTreeNext();
  }

  if (name != null && name.getElementType() == XmlElementType.XML_ENTITY_REF) {
    final StringBuilder builder = new StringBuilder();

    ((XmlElement)name.getPsi()).processElements(new PsiElementProcessor() {
      public boolean execute(@NotNull final PsiElement element) {
        builder.append(element.getText());
        return true;
      }
    }, name.getPsi());
    if (builder.length() > 0) return builder.toString();
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:XmlElementImpl.java


示例12: fun

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Override
public ThreeState fun(ASTNode oldNode,
                      LighterASTNode newNode,
                      FlyweightCapableTreeStructure<LighterASTNode> structure) {
  if (oldNode instanceof XmlTag && newNode.getTokenType() == XmlElementType.XML_TAG) {
    String oldName = ((XmlTag)oldNode).getName();
    Ref<LighterASTNode[]> childrenRef = Ref.create(null);
    int count = structure.getChildren(newNode, childrenRef);
    if (count < 3) return ThreeState.UNSURE;
    LighterASTNode[] children = childrenRef.get();
    if (children[0].getTokenType() != XmlTokenType.XML_START_TAG_START) return ThreeState.UNSURE;
    if (children[1].getTokenType() != XmlTokenType.XML_NAME) return ThreeState.UNSURE;
    if (children[2].getTokenType() != XmlTokenType.XML_TAG_END) return ThreeState.UNSURE;
    LighterASTTokenNode name = (LighterASTTokenNode)children[1];
    CharSequence newName = name.getText();
    if (!oldName.equals(newName)) return ThreeState.NO;
  }

  return ThreeState.UNSURE;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:XmlParser.java


示例13: findEndTagName

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Nullable
static XmlToken findEndTagName(@Nullable final PsiErrorElement element) {
  if (element == null) return null;

  final ASTNode astNode = element.getNode();
  if (astNode == null) return null;

  ASTNode current = astNode.getLastChildNode();
  ASTNode prev = current;

  while (current != null) {
    final IElementType elementType = prev.getElementType();

    if ((elementType == XmlElementType.XML_NAME || elementType == XmlElementType.XML_TAG_NAME) &&
        current.getElementType() == XmlElementType.XML_END_TAG_START) {
      return (XmlToken)prev.getPsi();
    }

    prev = current;
    current = current.getTreePrev();
  }

  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:XmlWrongClosingTagNameInspection.java


示例14: processChild

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
protected
@Nullable
ASTNode processChild(List<Block> result, final ASTNode child, final Wrap wrap, final Alignment alignment, final Indent indent) {
  IElementType type = child.getElementType();
  if (type == XmlElementType.XML_TEXT) {
    final PsiElement parent = child.getPsi().getParent();

    if (parent instanceof XmlTag && ((XmlTag)parent).getSubTags().length == 0) {
      if (buildInjectedPsiBlocks(result, child, wrap, alignment, indent)) return child;
    }
    return createXmlTextBlocks(result, child, wrap, alignment);
  } else if (type == XmlElementType.XML_COMMENT) {
    if (buildInjectedPsiBlocks(result, child, wrap, alignment, indent)) return child;
    return super.processChild(result, child, wrap, alignment, indent);
  }
  else {
    return super.processChild(result, child, wrap, alignment, indent);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:XmlTagBlock.java


示例15: indentChildrenOf

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
public boolean indentChildrenOf(final XmlTag parentTag) {
  if (parentTag == null) {
    return true;
  }
  final PsiElement firstChild = findFirstNonEmptyChild(parentTag);

  if (firstChild == null) {
    return false;
  }

  if (firstChild.getNode().getElementType() != XmlElementType.XML_START_TAG_START) {
    return false;
  }

  if (mySettings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_LINES > 0 &&
      getLines(parentTag) > mySettings.HTML_DO_NOT_ALIGN_CHILDREN_OF_MIN_LINES) {
    return false;
  }
  else {
    return !checkName(parentTag, mySettings.HTML_DO_NOT_INDENT_CHILDREN_OF);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:HtmlPolicy.java


示例16: splitAttribute

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
private List<Block> splitAttribute(ASTNode node, XmlFormattingPolicy formattingPolicy) {
  final ArrayList<Block> result = new ArrayList<Block>(3);
  ASTNode child = node.getFirstChildNode();
  while (child != null) {
    if (child.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_START_DELIMITER ||
        child.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_END_DELIMITER) {
      result.add(new XmlBlock(child, null, null, formattingPolicy, null, null, isPreserveSpace()));
    }
    else if (!child.getPsi().getLanguage().isKindOf(XMLLanguage.INSTANCE) && containsOuterLanguageElement(child)) {
      // Fix for EA-20311:
      // In case of another embedded language create a splittable XML block which can be
      // merged with other language's code blocks.
      createLeafBlocks(child, result);
    }
    else if (child.getElementType() != TokenType.ERROR_ELEMENT || child.getFirstChildNode() != null) {
      result.add(new ReadOnlyBlock(child));
    }
    child = child.getTreeNext();
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:XmlBlock.java


示例17: splitComment

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
private List<Block> splitComment() {
  if (myNode.getElementType() != XmlElementType.XML_COMMENT) return EMPTY;
  final ArrayList<Block> result = new ArrayList<Block>(3);
  ASTNode child = myNode.getFirstChildNode();
  boolean hasOuterLangElements = false;
  while (child != null) {
    if (child instanceof OuterLanguageElement) {
      hasOuterLangElements = true;
    }
    result.add(new XmlBlock(child, null, null, myXmlFormattingPolicy, getChildIndent(), null, isPreserveSpace()));
    child = child.getTreeNext();
  }
  if (hasOuterLangElements) {
    return result;
  }
  else {
    return EMPTY;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:XmlBlock.java


示例18: getValueElement

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Override
public XmlAttributeValue getValueElement()
{
	if(isInternalReference())
	{
		for(ASTNode e = getFirstChildNode(); e != null; e = e.getTreeNext())
		{
			if(e.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE)
			{
				return (XmlAttributeValue) SourceTreeToPsiMap.treeElementToPsi(e);
			}
		}
	}
	else
	{
		for(ASTNode e = getLastChildNode(); e != null; e = e.getTreePrev())
		{
			if(e.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE)
			{
				return (XmlAttributeValue) SourceTreeToPsiMap.treeElementToPsi(e);
			}
		}
	}

	return null;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:27,代码来源:XmlEntityDeclImpl.java


示例19: hasCDATA

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Override
public boolean hasCDATA()
{
	for(XmlText xmlText : myTextElements)
	{
		PsiElement[] children = xmlText.getChildren();
		for(PsiElement child : children)
		{
			if(child.getNode().getElementType() == XmlElementType.XML_CDATA)
			{
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:17,代码来源:XmlTagValueImpl.java


示例20: getChildRole

import com.intellij.psi.xml.XmlElementType; //导入依赖的package包/类
@Override
public int getChildRole(ASTNode child)
{
	LOG.assertTrue(child.getTreeParent() == this);
	IElementType i = child.getElementType();
	if(i == XmlElementType.XML_PROLOG)
	{
		return XmlChildRole.XML_PROLOG;
	}
	else if(i == XmlElementType.XML_TAG)
	{
		return XmlChildRole.XML_TAG;
	}
	else
	{
		return ChildRoleBase.NONE;
	}
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:19,代码来源:XmlDocumentImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java RegistryException类代码示例发布时间:2022-05-22
下一篇:
Java MRClientProtocolService类代码示例发布时间: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