DiagramEditPart part = editor.getDiagramEditPart();
// save this image if there is something in it
if (part.getChildren().size() > 0) {
IProgressMonitor saveMonitor = new SubProgressMonitor(monitor, 1);
saveMonitor.beginTask("Saving container " + part.resolveSemanticElement(), 1 + formats.size());
for (ImageFileFormat format : formats) {
IPath destination = generateImageDestination(container, format);
monitor.subTask("Saving image " + destination.lastSegment() + " ( " + format.getName() + ")");
CopyToImageUtil img = getCopyToImageUtil();
img.copyToImage(part, destination, format, new SubProgressMonitor(monitor, 1));