/* Add all Root Folders */
startingNodes.addAll(CoreUtils.loadRootFolders());
/* Select from all available Starting Nodes */
ITreeNode targetNode = null;
for (IFolderChild startingNode : startingNodes) {
TreeTraversal traversal = new TreeTraversal(startingNode instanceof IFolder ? new ModelTreeNode((IFolder) startingNode) : new ModelTreeNode((IMark) startingNode)) {
@Override
public boolean select(ITreeNode node) {
Object data = node.getData();
/* Check for Unread news if required */
if (data instanceof INewsMark) {
INewsMark newsmark = (INewsMark) data;
if (fType.isUnread() && newsmark.getNewsCount(EnumSet.of(INews.State.NEW, INews.State.UNREAD, INews.State.UPDATED)) == 0)
return false;
}
/* Folders are no valid navigation nodes */
else if (data instanceof IFolder)
return false;
return true;
}
};
targetNode = fType.isNext() ? traversal.nextNode() : traversal.previousNode();
if (targetNode != null)
break;
}
/* Open Node if present */
if (targetNode != null) {
INewsMark mark = (INewsMark) targetNode.getData();
/* Open in FeedView */
PerformAfterInputSet perform = null;
if (fType.isNewsScoped() && fType.isUnread())
perform = PerformAfterInputSet.SELECT_UNREAD_NEWS;