@Override public JPopupMenu createMenu( JPopupMenu popupMenu, SearchResultDataLine[] lines, SearchResultMediator resultPanel) { PopupUtils.addMenuItem( SearchMediator.DOWNLOAD_STRING, new ActionListener() { public void actionPerformed(ActionEvent e) { download(false); } }, popupMenu, lines.length > 0, 1); PopupUtils.addMenuItem( SearchMediator.DOWNLOAD_PARTIAL_FILES_STRING, resultPanel.DOWNLOAD_PARTIAL_FILES_LISTENER, popupMenu, lines.length == 1, 2); PopupUtils.addMenuItem( SearchMediator.TORRENT_DETAILS_STRING, new ActionListener() { public void actionPerformed(ActionEvent e) { showDetails(true); } }, popupMenu, lines.length == 1, 3); return popupMenu; }
protected JPopupMenu createPopupMenu(SearchResultDataLine[] lines) { // do not return a menu if right-clicking on the dummy panel if (!isKillable()) return null; JPopupMenu menu = new SkinPopupMenu(); if (lines.length > 0) { boolean allWithHash = true; for (int i = 0; i < lines.length; i++) { if (lines[i].getHash() == null) { allWithHash = false; break; } } PopupUtils.addMenuItem( I18n.tr("Copy Magnet"), COPY_MAGNET_ACTION_LISTENER, menu, allWithHash); PopupUtils.addMenuItem(I18n.tr("Copy Hash"), COPY_HASH_ACTION_LISTENER, menu, allWithHash); menu.add(createSearchAgainMenu(lines[0])); } else { menu.add(new SkinMenuItem(new RepeatSearchAction())); } return (new SearchResultMenu(this)).addToMenu(menu, lines); }