final Iterator<?> iterator = viewerSelection.iterator();
while (iterator.hasNext()) {
final Object obj = iterator.next();
if (obj instanceof IDocument) {
final IDocument doc = (IDocument) obj;
if (docMap.containsKey(doc.getSource())) {
docMap.get(doc.getSource()).add(doc);
} else {
final ArrayList<IDocument> docs = new ArrayList<IDocument>();
docs.add(doc);
docMap.put(doc.getSource(), docs);
}
}
}
for (final IAbstractDocumentSource source : docMap.keySet()) {
final ArrayList<IDocument> docs = docMap.get(source);
for (final IDocument doc : docs) {
boolean doDelete = true;
if (Type.ATTACHMENT == doc.getType() && ContentType.FILE == doc.getContentType()
&& !doc.isEmpty()) {
doDelete = MessageDialog.openConfirm(removeButton.getShell(),
Messages.docView_deleteAttachConfirmTitle,
Messages.docView_deleteAttachConfirmMsg);
}