Object object = list.getModel().getElementAt(position);
if (!(object instanceof CheckErrorPage)) {
return;
}
CheckErrorPage error = (CheckErrorPage) object;
CheckErrorAlgorithm algorithm = error.getAlgorithm();
// Menu name
BasicMenuCreator menu = new BasicMenuCreator();
JPopupMenu popup = menu.createPopupMenu(GT._("Error n°{0}", algorithm.getErrorNumberString()));
// Global fixes
JMenuItem menuItem = null;
String[] fixes = algorithm.getGlobalFixes();
if ((fixes != null) && (fixes.length > 0)) {
menu.addSeparator(popup);
for (int i = 0; i < fixes.length; i++) {
menuItem = new JMenuItem(fixes[i]);
ActionListener action = new CheckErrorGlobalFixAction(
algorithm, fixes[i], error.getPage(), textComponent, button);
menuItem.addActionListener(action);
popup.add(menuItem);
}
}
// Create sub menus
menu.addSeparator(popup);
menu.addItemView(wiki, popup, algorithm.getLink(), GT._("Detail"));
CheckWiki checkWiki = APIFactory.getCheckWiki();
String toolserverUrl = checkWiki.getUrlDescription(wiki, algorithm);
menu.addItemView(null, popup, toolserverUrl, GT._("List on {0}", CheckWiki.getServerName(wiki)));
menu.addItemView(wiki, popup, algorithm.getWhiteListPageName(), GT._("View or edit whitelist"));
popup.show(e.getComponent(), e.getX(), e.getY());
}