use of com.intellij.lang.ASTNode in project intellij-community by JetBrains.
the class XPathElementImpl method addAfter.
public PsiElement addAfter(@NotNull PsiElement psiElement, final PsiElement anchor) throws IncorrectOperationException {
final ASTNode astNode = anchor.getNode();
assert astNode != null;
final ASTNode next = astNode.getTreeNext();
final ASTNode node = getNode();
final ASTNode newNode = psiElement.getNode();
assert newNode != null;
if (next != null) {
node.addChild(newNode, next);
} else {
node.addChild(newNode);
}
return node.getPsi();
}
use of com.intellij.lang.ASTNode in project intellij-community by JetBrains.
the class XPathElementImpl method addBefore.
public PsiElement addBefore(@NotNull PsiElement psiElement, final PsiElement anchor) throws IncorrectOperationException {
final ASTNode node = getNode();
final ASTNode child = psiElement.getNode();
assert child != null;
node.addChild(child, anchor.getNode());
return node.getPsi();
}
use of com.intellij.lang.ASTNode in project intellij-community by JetBrains.
the class XPathFunctionCallImpl method getFunctionName.
@NotNull
public String getFunctionName() {
final ASTNode node = getNameNode();
final String name = node != null ? node.getText() : null;
assert name != null : unexpectedPsiAssertion();
return name;
}
use of com.intellij.lang.ASTNode in project intellij-community by JetBrains.
the class XPathVariableReferenceImpl method renameTo.
private void renameTo(String newElementName) {
final XPathVariableReference child = XPathChangeUtil.createVariableReference(this, newElementName);
final PrefixedNameImpl newName = ((PrefixedNameImpl) child.getQName());
final PrefixedNameImpl oldName = ((PrefixedNameImpl) getQName());
assert newName != null;
assert oldName != null;
final ASTNode localNode = newName.getLocalNode();
getNode().replaceChild(oldName.getLocalNode(), localNode);
}
use of com.intellij.lang.ASTNode in project intellij-community by JetBrains.
the class PyNamedParameterImpl method getDefaultValue.
@Nullable
public PyExpression getDefaultValue() {
final PyNamedParameterStub stub = getStub();
if (stub != null && !stub.hasDefaultValue()) {
return null;
}
ASTNode[] nodes = getNode().getChildren(PythonDialectsTokenSetProvider.INSTANCE.getExpressionTokens());
if (nodes.length > 0) {
return (PyExpression) nodes[0].getPsi();
}
return null;
}
Aggregations