*/
public void finish() {
/* Run Retention since settings changed */
if (fSettingsChanged) {
final INewsMark activeFeedViewNewsMark = OwlUI.getActiveFeedViewNewsMark();
Job retentionJob = new Job(Messages.RetentionPropertyPage_PERFORMING_CLEANUP) {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
Set<IBookMark> bookmarks = new HashSet<IBookMark>();
for (IEntity entity : fEntities) {
if (entity instanceof IBookMark)
bookmarks.add((IBookMark) entity);
else if (entity instanceof IFolder)
CoreUtils.fillBookMarks(bookmarks, Collections.singleton((IFolder) entity));
}
monitor.beginTask(Messages.RetentionPropertyPage_PERFORMING_CLEANUP, bookmarks.size());
for (IBookMark bookmark : bookmarks) {
if (Controller.getDefault().isShuttingDown() || monitor.isCanceled())
break;
/* Check if retention should run or not */
if (activeFeedViewNewsMark != null) {
if (activeFeedViewNewsMark.equals(bookmark))
continue; //Avoid clean up on feed the user is reading on
else if (activeFeedViewNewsMark instanceof FolderNewsMark && ((FolderNewsMark) activeFeedViewNewsMark).contains(bookmark))
continue; //Avoid clean up on folder the user is reading on if feed contained
}