本文整理汇总了Java中com.intellij.psi.xml.XmlToken.getNextSibling方法的典型用法代码示例。如果您正苦于以下问题:Java XmlToken.getNextSibling方法的具体用法?Java XmlToken.getNextSibling怎么用?Java XmlToken.getNextSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.xml.XmlToken
的用法示例。
在下文中一共展示了XmlToken.getNextSibling方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildVisitor
import com.intellij.psi.xml.XmlToken; //导入方法依赖的package包/类
@Override
@NotNull
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
return new XmlElementVisitor() {
@Override public void visitXmlToken(final XmlToken token) {
if (token.getTokenType() == XmlTokenType.XML_NAME) {
PsiElement element = token.getPrevSibling();
while(element instanceof PsiWhiteSpace) element = element.getPrevSibling();
if (element instanceof XmlToken && ((XmlToken)element).getTokenType() == XmlTokenType.XML_START_TAG_START) {
PsiElement parent = element.getParent();
if (parent instanceof XmlTag && !(token.getNextSibling() instanceof OuterLanguageElement)) {
XmlTag tag = (XmlTag)parent;
checkTag(tag, holder, isOnTheFly);
}
}
}
}
@Override public void visitXmlAttribute(final XmlAttribute attribute) {
checkAttribute(attribute, holder, isOnTheFly);
}
};
}
示例2: getTag
import com.intellij.psi.xml.XmlToken; //导入方法依赖的package包/类
private static TextRange getTag(XmlToken tagName, IElementType tagStart) {
if (tagName != null) {
PsiElement s = tagName.getPrevSibling();
while (s != null && s.getNode().getElementType() != tagStart) {
s = s.getPrevSibling();
}
PsiElement f = tagName.getNextSibling();
while (f != null &&
!(f.getNode().getElementType() == XmlTokenType.XML_TAG_END ||
f.getNode().getElementType() == XmlTokenType.XML_EMPTY_ELEMENT_END)) {
f = f.getNextSibling();
}
if (s != null && f != null) {
return new TextRange(s.getTextRange().getStartOffset(), f.getTextRange().getEndOffset());
}
}
return null;
}
示例3: select
import com.intellij.psi.xml.XmlToken; //导入方法依赖的package包/类
@Override
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
List<TextRange> result = super.select(e, editorText, cursorOffset, editor);
PsiElement[] children = e.getChildren();
PsiElement first = null;
PsiElement last = null;
for (PsiElement child : children) {
if (child instanceof XmlToken) {
XmlToken token = (XmlToken)child;
if (token.getTokenType() == XmlTokenType.XML_CDATA_START) {
first = token.getNextSibling();
}
if (token.getTokenType() == XmlTokenType.XML_CDATA_END) {
last = token.getPrevSibling();
break;
}
}
}
if (first != null && last != null) {
result.addAll(expandToWholeLine(editorText,
new TextRange(first.getTextRange().getStartOffset(),
last.getTextRange().getEndOffset()),
false));
}
return result;
}
示例4: select
import com.intellij.psi.xml.XmlToken; //导入方法依赖的package包/类
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
List<TextRange> result = super.select(e, editorText, cursorOffset, editor);
PsiElement[] children = e.getChildren();
PsiElement first = null;
PsiElement last = null;
for (PsiElement child : children) {
if (child instanceof XmlToken) {
XmlToken token = (XmlToken)child;
if (token.getTokenType() == XmlTokenType.XML_CDATA_START) {
first = token.getNextSibling();
}
if (token.getTokenType() == XmlTokenType.XML_CDATA_END) {
last = token.getPrevSibling();
break;
}
}
}
if (first != null && last != null) {
result.addAll(expandToWholeLine(editorText,
new TextRange(first.getTextRange().getStartOffset(),
last.getTextRange().getEndOffset()),
false));
}
return result;
}