use of com.intellij.psi.tree.IElementType in project intellij-community by JetBrains.
the class XmlElementDeclImpl method getChildRole.
@Override
public int getChildRole(ASTNode child) {
LOG.assertTrue(child.getTreeParent() == this);
IElementType i = child.getElementType();
if (i == XML_NAME) {
return XmlChildRole.XML_NAME;
} else if (i == XML_ELEMENT_CONTENT_SPEC) {
return XmlChildRole.XML_ELEMENT_CONTENT_SPEC;
} else {
return ChildRoleBase.NONE;
}
}
use of com.intellij.psi.tree.IElementType in project intellij-community by JetBrains.
the class XmlDoctypeImpl method getChildRole.
@Override
public int getChildRole(ASTNode child) {
LOG.assertTrue(child.getTreeParent() == this);
IElementType i = child.getElementType();
if (i == XmlTokenType.XML_DOCTYPE_PUBLIC) {
return XmlChildRole.XML_DOCTYPE_PUBLIC;
} else if (i == XmlTokenType.XML_DOCTYPE_SYSTEM) {
return XmlChildRole.XML_DOCTYPE_SYSTEM;
} else if (i == XmlTokenType.XML_NAME) {
return XmlChildRole.XML_NAME;
} else {
return ChildRoleBase.NONE;
}
}
use of com.intellij.psi.tree.IElementType in project intellij-community by JetBrains.
the class XmlElementContentSpecImpl method getChildRole.
@Override
public int getChildRole(ASTNode child) {
LOG.assertTrue(child.getTreeParent() == this);
IElementType i = child.getElementType();
if (i == XML_CONTENT_ANY) {
return XmlChildRole.XML_CONTENT_ANY;
} else if (i == XML_CONTENT_EMPTY) {
return XmlChildRole.XML_CONTENT_EMPTY;
} else if (i == XML_PCDATA) {
return XmlChildRole.XML_PCDATA;
} else {
return ChildRoleBase.NONE;
}
}
use of com.intellij.psi.tree.IElementType in project intellij-community by JetBrains.
the class GroovyCompletionUtil method addRParenth.
public static int addRParenth(Editor editor, int oldTail, boolean space_within_cast_parentheses) {
int offset = -1;
final HighlighterIterator iterator = ((EditorEx) editor).getHighlighter().createIterator(oldTail);
while (!iterator.atEnd()) {
final IElementType tokenType = iterator.getTokenType();
if (TokenSets.WHITE_SPACES_OR_COMMENTS.contains(tokenType)) {
iterator.advance();
continue;
}
if (tokenType == GroovyTokenTypes.mRPAREN) {
offset = iterator.getEnd();
}
break;
}
if (offset != -1)
return offset;
offset = oldTail;
if (space_within_cast_parentheses) {
offset = TailType.insertChar(editor, oldTail, ' ');
}
return TailType.insertChar(editor, offset, ')');
}
use of com.intellij.psi.tree.IElementType in project intellij-community by JetBrains.
the class GroovyCompletionUtil method isWildcardCompletion.
/*
we are here: foo(List<? <caret> ...
*/
public static boolean isWildcardCompletion(PsiElement position) {
PsiElement prev = PsiUtil.getPreviousNonWhitespaceToken(position);
if (prev instanceof PsiErrorElement)
prev = PsiUtil.getPreviousNonWhitespaceToken(prev);
if (prev == null || prev.getNode().getElementType() != GroovyTokenTypes.mQUESTION)
return false;
final PsiElement pprev = PsiUtil.getPreviousNonWhitespaceToken(prev);
if (pprev == null)
return false;
final IElementType t = pprev.getNode().getElementType();
return t == GroovyTokenTypes.mLT || t == GroovyTokenTypes.mCOMMA;
}
Aggregations