public static void deleteElementFromParent(@NotNull PsiElement element) {
    PsiElement parent = element.getParent();
    if (parent instanceof ASTDelegatePsiElement) {
      CheckUtil.checkWritable(element);
      ((ASTDelegatePsiElement)parent).deleteChildInternal(element.getNode());
    }
    else if (parent instanceof CompositeElement) {
      CheckUtil.checkWritable(element);
      ((CompositeElement)parent).deleteChildInternal(element.getNode());
    }
    else if (parent instanceof PsiFile) {
      CheckUtil.checkWritable(element);
      parent.deleteChildRange(element, element);
    }
    else {
      throw new UnsupportedOperationException(element.getClass().getName() + " under " + (parent == null ? "null" : parent.getClass().getName()));
    }
  }
public static void deleteElementFromParent(@NotNull PsiElement element)