void (PsiElement from, PsiElement[] elements) { ASTNode parentNode = from.getNode(); for (PsiElement element : elements) { if (element.isValid()) { ASTNode node = element.getNode(); if (node == null || node.getTreeParent() != parentNode) { throw new IncorrectOperationException(); } parentNode.removeChild(node); } } }