Exemple #1
0
 @Override
 public PsiElement addAfter(@NotNull PsiElement element, PsiElement anchor)
     throws IncorrectOperationException {
   CheckUtil.checkWritable(this);
   TreeElement elementCopy = ChangeUtil.copyToElement(element);
   calcTreeElement()
       .addInternal(
           elementCopy, elementCopy, SourceTreeToPsiMap.psiElementToTree(anchor), Boolean.FALSE);
   elementCopy = ChangeUtil.decodeInformation(elementCopy);
   return SourceTreeToPsiMap.treeElementToPsi(elementCopy);
 }
Exemple #2
0
 @Override
 public void deleteChildRange(PsiElement first, PsiElement last)
     throws IncorrectOperationException {
   CheckUtil.checkWritable(this);
   if (first == null) {
     LOG.assertTrue(last == null);
     return;
   }
   ASTNode firstElement = SourceTreeToPsiMap.psiElementToTree(first);
   ASTNode lastElement = SourceTreeToPsiMap.psiElementToTree(last);
   CompositeElement treeElement = calcTreeElement();
   LOG.assertTrue(firstElement.getTreeParent() == treeElement);
   LOG.assertTrue(lastElement.getTreeParent() == treeElement);
   CodeEditUtil.removeChildren(treeElement, firstElement, lastElement);
 }
Exemple #3
0
 @Override
 public PsiElement addRangeBefore(
     @NotNull PsiElement first, @NotNull PsiElement last, PsiElement anchor)
     throws IncorrectOperationException {
   return SharedImplUtil.addRange(
       this, first, last, SourceTreeToPsiMap.psiElementToTree(anchor), Boolean.TRUE);
 }
Exemple #4
0
 @Override
 public PsiElement add(@NotNull PsiElement element) throws IncorrectOperationException {
   CheckUtil.checkWritable(this);
   TreeElement elementCopy = ChangeUtil.copyToElement(element);
   calcTreeElement().addInternal(elementCopy, elementCopy, null, null);
   elementCopy = ChangeUtil.decodeInformation(elementCopy);
   return SourceTreeToPsiMap.treeElementToPsi(elementCopy);
 }