/** Delete selected items from a playlist (not from disk) */
  public void removeSelection() {

    LibraryPlaylistsTableDataLine[] lines = getSelectedLibraryLines();

    if (currentPlaylist != null && currentPlaylist.getId() == LibraryDatabase.STARRED_PLAYLIST_ID) {
      for (LibraryPlaylistsTableDataLine line : lines) {
        PlaylistItem playlistItem = line.getInitializeObject();
        playlistItem.setStarred(false);
        playlistItem.save();
      }

      LibraryMediator.instance().getLibraryExplorer().refreshSelection();

    } else {

      for (LibraryPlaylistsTableDataLine line : lines) {
        PlaylistItem playlistItem = line.getInitializeObject();
        playlistItem.delete();
      }

      LibraryMediator.instance().getLibraryPlaylists().reselectPlaylist();

      clearSelection();
    }

    super.removeSelection();
  }
  public void selectCurrentSong() {
    // Select current playlist.
    Playlist currentPlaylist = AudioPlayer.instance().getCurrentPlaylist();
    final AudioSource currentSong = AudioPlayer.instance().getCurrentSong();

    // If the current song is being played from a playlist.
    if (currentPlaylist != null && currentSong != null && currentSong.getPlaylistItem() != null) {
      if (currentPlaylist.getId() != LibraryDatabase.STARRED_PLAYLIST_ID) {

        // select the song once it's available on the right hand side
        getLibraryPlaylists()
            .enqueueRunnable(
                new Runnable() {
                  public void run() {
                    GUIMediator.safeInvokeLater(
                        new Runnable() {
                          public void run() {
                            LibraryPlaylistsTableMediator.instance()
                                .setItemSelected(currentSong.getPlaylistItem());
                          }
                        });
                  }
                });

        // select the playlist
        getLibraryPlaylists().selectPlaylist(currentPlaylist);
      } else {
        LibraryExplorer libraryFiles = getLibraryExplorer();

        // select the song once it's available on the right hand side
        libraryFiles.enqueueRunnable(
            new Runnable() {
              public void run() {
                GUIMediator.safeInvokeLater(
                    new Runnable() {
                      public void run() {
                        LibraryPlaylistsTableMediator.instance()
                            .setItemSelected(currentSong.getPlaylistItem());
                      }
                    });
              }
            });

        libraryFiles.selectStarred();
      }

    } else if (currentSong != null && currentSong.getFile() != null) {
      // selects the audio node at the top
      LibraryExplorer libraryFiles = getLibraryExplorer();

      // select the song once it's available on the right hand side
      libraryFiles.enqueueRunnable(
          new Runnable() {
            public void run() {
              GUIMediator.safeInvokeLater(
                  new Runnable() {
                    public void run() {
                      LibraryFilesTableMediator.instance().setFileSelected(currentSong.getFile());
                    }
                  });
            }
          });

      libraryFiles.selectAudio();
    } else if (currentSong instanceof InternetRadioAudioSource) {
      // selects the audio node at the top
      LibraryExplorer libraryFiles = getLibraryExplorer();

      // select the song once it's available on the right hand side
      libraryFiles.enqueueRunnable(
          new Runnable() {
            public void run() {
              GUIMediator.safeInvokeLater(
                  new Runnable() {
                    public void run() {
                      LibraryInternetRadioTableMediator.instance()
                          .setItemSelected(
                              ((InternetRadioAudioSource) currentSong).getInternetRadioStation());
                    }
                  });
            }
          });

      libraryFiles.selectRadio();
    } else if (currentSong instanceof DeviceAudioSource) {
      // selects the audio node at the top
      LibraryExplorer libraryFiles = getLibraryExplorer();

      // select the song once it's available on the right hand side
      libraryFiles.enqueueRunnable(
          new Runnable() {
            public void run() {
              GUIMediator.safeInvokeLater(
                  new Runnable() {
                    public void run() {
                      LibraryDeviceTableMediator.instance()
                          .setItemSelected(((DeviceAudioSource) currentSong).getFileDescriptor());
                    }
                  });
            }
          });

      libraryFiles.selectDeviceFileType(
          ((DeviceAudioSource) currentSong).getDevice(),
          ((DeviceAudioSource) currentSong).getFileDescriptor().fileType);
    }

    // Scroll to current song.
  }