// inherit doc comment protected JPopupMenu createPopupMenu() { if (TABLE.getSelectionModel().isSelectionEmpty()) { return null; } JPopupMenu menu = new SkinPopupMenu(); menu.add(new SkinMenuItem(LAUNCH_ACTION)); if (getMediaType().equals(MediaType.getAudioMediaType())) { menu.add(new SkinMenuItem(LAUNCH_OS_ACTION)); } if (hasExploreAction()) { menu.add(new SkinMenuItem(OPEN_IN_FOLDER_ACTION)); } if (areAllSelectedFilesMP4s()) { menu.add(DEMUX_MP4_AUDIO_ACTION); DEMUX_MP4_AUDIO_ACTION.setEnabled( !((DemuxMP4AudioAction) DEMUX_MP4_AUDIO_ACTION).isDemuxing()); } menu.add(new SkinMenuItem(CREATE_TORRENT_ACTION)); if (areAllSelectedFilesPlayable()) { menu.add(createAddToPlaylistSubMenu()); } menu.add(new SkinMenuItem(SEND_TO_FRIEND_ACTION)); menu.add(new SkinMenuItem(SEND_TO_ITUNES_ACTION)); menu.addSeparator(); menu.add(new SkinMenuItem(DELETE_ACTION)); menu.addSeparator(); int[] rows = TABLE.getSelectedRows(); boolean dirSelected = false; boolean fileSelected = false; for (int i = 0; i < rows.length; i++) { File f = DATA_MODEL.get(rows[i]).getFile(); if (f.isDirectory()) { dirSelected = true; // if (IncompleteFileManager.isTorrentFolder(f)) // torrentSelected = true; } else fileSelected = true; if (dirSelected && fileSelected) break; } DELETE_ACTION.setEnabled(true); LibraryFilesTableDataLine line = DATA_MODEL.get(rows[0]); menu.add(createSearchSubMenu(line)); return menu; }
/** Accessor for the <tt>ListSelectionModel</tt> for the wrapped <tt>JTable</tt> instance. */ ListSelectionModel getSelectionModel() { return TABLE.getSelectionModel(); }