Пример #1
0
 @Override
 public void checkDelete() throws IncorrectOperationException {
   if (!getViewProvider().isEventSystemEnabled()) {
     throw new IncorrectOperationException();
   }
   CheckUtil.checkWritable(this);
 }
Пример #2
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);
 }
Пример #3
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);
 }
Пример #4
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);
 }
Пример #5
0
 @Override
 public final void checkAdd(@NotNull PsiElement element) throws IncorrectOperationException {
   CheckUtil.checkWritable(this);
 }