コード例 #1
0
 @Override
 public void doubleClick(final DoubleClickEvent event) {
   final Playlist playlist = player.getPlaylist();
   if (!playlist.isEmpty()) {
     final StructuredSelection selection = (StructuredSelection) event.getSelection();
     playlist.setCurrentTrack((PlaylistItem) selection.getFirstElement());
     player.play();
     event.getViewer().refresh();
   }
 }
コード例 #2
0
 public void savePlaylist(final Playlist playlist) {
   if (!playlist.isEmpty()) {
     val shell = display.getActiveShell();
     val dialog = new FileChooser(shell, SWT.SAVE);
     dialog.setFilterExtensions(new String[] {new PlaylistWriter().formatExtensions()});
     dialog.setFilterNames(new String[] {new PlaylistWriter().completeFormatName()});
     val selectedFileName = dialog.open();
     if (selectedFileName != null) {
       val selectedFile = new File(selectedFileName);
       if (new PlaylistWriter().canHandle(selectedFile)) {
         new PlaylistWriter().write(selectedFile, playlist);
       }
     }
   }
 }