Set<Entry<IMark, IFolder>> entries = reparentedMarks.entrySet();
Set<IFolder> parentsToUpdate = new HashSet<IFolder>();
try {
fViewer.getControl().getParent().setRedraw(false);
for (Entry<IMark, IFolder> entry : entries) {
IMark reparentedMark = entry.getKey();
IFolder oldParent = entry.getValue();
/* Reparent while keeping the Selection */
ISelection selection = fViewer.getSelection();
fViewer.remove(oldParent, new Object[] { reparentedMark });
fViewer.refresh(reparentedMark.getParent(), false);
fViewer.setSelection(selection);
/* Remember to update parents */
parentsToUpdate.add(oldParent);
parentsToUpdate.add(reparentedMark.getParent());
}
} finally {
fViewer.getControl().getParent().setRedraw(true);
}