// 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;
  }
 public List<MediaSource> getFilesView() {
   int size = DATA_MODEL.getRowCount();
   List<MediaSource> result = new ArrayList<MediaSource>(size);
   for (int i = 0; i < size; i++) {
     try {
       File file = DATA_MODEL.get(i).getFile();
       if (MediaPlayer.isPlayableFile(file)) {
         result.add(new MediaSource(DATA_MODEL.get(i).getFile()));
       }
     } catch (Exception e) {
       return Collections.emptyList();
     }
   }
   return result;
 }
  public void handleActionKey() {
    LibraryFilesTableDataLine line = DATA_MODEL.get(TABLE.getSelectedRow());
    if (line == null || line.getFile() == null) {
      return;
    }
    if (getMediaType().equals(MediaType.getAudioMediaType())
        && MediaPlayer.isPlayableFile(line.getFile())) {
      MediaPlayer.instance()
          .asyncLoadMedia(new MediaSource(line.getFile()), true, false, true, null, getFilesView());
      UXStats.instance().log(UXAction.LIBRARY_PLAY_AUDIO_FROM_FILE);
      return;
    }

    int[] rows = TABLE.getSelectedRows();
    // LibraryTableModel ltm = DATA_MODEL;
    // File file;
    for (int i = 0; i < rows.length; i++) {
      // file = ltm.getFile(rows[i]);
      // if it's a directory try to select it in the library tree
      // if it could be selected return
      //			if (file.isDirectory()
      //				&& LibraryMediator.setSelectedDirectory(file))
      //				return;
    }

    launch(true);
  }
 private boolean areAllSelectedFilesPlayable() {
   boolean selectionIsAllAudio = true;
   int[] selectedRows = TABLE.getSelectedRows();
   for (int i : selectedRows) {
     if (!MediaPlayer.isPlayableFile(DATA_MODEL.get(i).getInitializeObject())) {
       selectionIsAllAudio = false;
       break;
     }
   }
   return selectionIsAllAudio;
 }