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 {
String title = null;
if ((page.getNamespace() != null) &&
(page.getNamespace().intValue() == Namespace.TEMPLATE)) {
title = GT._("Template External Viewer");
} else {
title = GT._("External Viewer");
}
addItem(
popup, page, title, true,
new ActionExternalViewer(wiki, page.getTitle()));
if ((page.getNamespace() != null) &&
(page.getNamespace().intValue() == Namespace.TEMPLATE)) {
title = GT._("Template history");
} else {
title = GT._("History");
}
addItem(
popup, page, title, true,
new ActionExternalViewer(
wiki, page.getTitle(), ActionExternalViewer.ACTION_HISTORY));
}
}
}