void (final List<? extends PackagingElementNode<?>> nodes) { Set<PackagingElementNode<?>> parents = new HashSet<>(); for (PackagingElementNode<?> node : nodes) { final List<? extends PackagingElement<?>> toDelete = node.getPackagingElements(); for (PackagingElement<?> element : toDelete) { final Collection<PackagingNodeSource> nodeSources = node.getNodeSource(element); if (nodeSources.isEmpty()) { final CompositePackagingElement<?> parent = node.getParentElement(element); if (parent != null) { ContainerUtil.addIfNotNull(parents, node.getParentNode()); parent.removeChild(element); } } else { Collection<PackagingNodeSource> rootSources = getRootNodeSources(nodeSources); for (PackagingNodeSource source : rootSources) { parents.add(source.getSourceParentNode()); source.getSourceParentElement().removeChild(source.getSourceElement()); } } } } for (PackagingElementNode<?> parent : parents) { myTree.addSubtreeToUpdate(parent); } }