int fixedEndHistory = 0;
JMenu submenuView = new JMenu(GT._("External Viewer"));
JMenu submenuHistory = new JMenu(GT._("History"));
Iterator<Page> iter = page.getRedirectIteratorWithPage();
while (iter.hasNext()) {
Page pageTmp = iter.next();
fixedBeginView += addItem(
submenuView, pageTmp, null, true,
new ActionExternalViewer(wiki, pageTmp.getTitle()));
fixedBeginHistory += addItem(
submenuHistory, pageTmp, null, true,
new ActionExternalViewer(
wiki, pageTmp.getTitle(), ActionExternalViewer.ACTION_HISTORY));
}
if ((links != null) && (links.size() > 0) && showLinks) {
fixedBeginView += addSeparator(submenuView);
fixedBeginHistory += addSeparator(submenuHistory);
for (Page p : links) {
if (p.isRedirect()) {
JMenu submenuRedirectView = new JMenu(p.getTitle());
JMenu submenuRedirectHistory = new JMenu(p.getTitle());
Iterator<Page> itPage = p.getRedirectIteratorWithPage();
while (itPage.hasNext()) {
Page redirect = itPage.next();
addItem(
submenuRedirectView, redirect, null, true,
new ActionExternalViewer(wiki, redirect.getTitle()));
addItem(
submenuRedirectHistory, redirect, null, true,
new ActionExternalViewer(
wiki, redirect.getTitle(), ActionExternalViewer.ACTION_HISTORY));
}
submenuView.add(submenuRedirectView);
submenuHistory.add(submenuRedirectHistory);
} else {
addItem(
submenuView, p, null, true,
new ActionExternalViewer(wiki, p.getTitle()));
addItem(
submenuHistory, p, null, true,
new ActionExternalViewer(
wiki, p.getTitle(), ActionExternalViewer.ACTION_HISTORY));
}
}
fixedEndView += addSeparator(submenuView);
fixedEndHistory += addSeparator(submenuHistory);
iter = page.getRedirectIteratorWithPage();
while (iter.hasNext()) {
Page pageTmp = iter.next();
fixedEndView += addItem(
submenuView, pageTmp, null, true,
new ActionExternalViewer(wiki, pageTmp.getTitle()));
fixedEndHistory += addItem(
submenuHistory, pageTmp, null, true,
new ActionExternalViewer(
wiki, pageTmp.getTitle(), ActionExternalViewer.ACTION_HISTORY));
}
}
addSubmenu(popup, submenuView, fixedBeginView, fixedEndView);
addSubmenu(popup, submenuHistory, fixedBeginHistory, fixedEndHistory);
} else {