addDiskItemsToPlaylist(playlistName, items, playFirst, -1);
}
public void addDiskItemsToPlaylist(String playlistName, List<IDiskItem> items, boolean playFirst, int insertionIndex) {
if (_items.containsKey(playlistName)) {
DiskItemAdder adder = new DiskItemAdder(playlistName, items, insertionIndex);
ProgressMonitorDialog dialog = new ProgressMonitorDialog(Display.getDefault().getActiveShell());
try {
dialog.run(true, true, adder);
} catch (InvocationTargetException e) {
Log.getInstance(PlaylistController.class).error(e.getMessage());
} catch (InterruptedException e) {
Log.getInstance(PlaylistController.class).error(e.getMessage());
}
if (playFirst) {
Playlist playlist = getPlaylistByName(playlistName);
if (playlist != null) {
AudioItem item = playlist.getAudioItemByPath(adder.getFirstFileItem().getFileName());
if (item != null) {
playFile(playlistName, item);
}
}
}