Exemplo n.º 1
0
 private void initLibraryListView() {
   IActionAddableListView<ILibrary> libraryView = controlView.getLibraryView();
   libraryView.addAction(new AddLibraryAction(libraryModel, resources));
   libraryView.addAction(new DeleteLibraryAction(resources, controlView, libraryModel));
   libraryView.addAction(
       new AddMusicFolderAction(resources, searchControl, libraryModel, controlView));
   libraryView.addAction(
       new AddMusicFileAction(resources, searchControl, libraryModel, controlView));
   libraryView.setObjects(libraryModel.getAllLibraries());
 }
Exemplo n.º 2
0
 @Override
 protected void execute(Component parentComponent) {
   Path mp3File =
       DirectoryFileChooser.chooseSingleFile(
           parentComponent,
           ADD_MUSIC_CHOOSER_VALUE,
           resources.getString("Music.Actions.AddFile.FileDialogTitle"),
           new Mp3FileFilter(resources)); // $NON-NLS-1$
   if (mp3File == null) {
     return;
   }
   String libraryName = ((ILibrary) view.getSelectedLibrary()).getName();
   try {
     model.addTrack(libraryName, mp3File);
     view.getTrackListView()
         .setObjects(searchControl.getTracks(((ILibrary) view.getSelectedLibrary()).getName()));
   } catch (Exception e) {
     MessageUtilities.indicateMessage(
         AddMusicFileAction.class,
         parentComponent,
         new Message(resources.getString("Errors.MusicDatabase.ReadMusicData"), e)); // $NON-NLS-1$
   }
 }
Exemplo n.º 3
0
 public AddMusicFileAction(
     IResources resources,
     IMusicSearchControl searchControl,
     ILibraryControl model,
     ILibraryControlView view) {
   super(new FileUi(resources).getAddFileIcon());
   this.resources = resources;
   this.searchControl = searchControl;
   setToolTipText(resources.getString("Music.Actions.AddFile.Tooltip")); // $NON-NLS-1$
   this.model = model;
   this.view = view;
   view.whenSelectionChanges(
       new Runnable() {
         @Override
         public void run() {
           updateEnabled();
         }
       });
   updateEnabled();
 }
Exemplo n.º 4
0
 private void initListening() {
   controlView.addLibraryListSelectionListener(
       new LibrarySelectionListener(controlView, searchControl, resources));
   libraryModel.addLibraryChangedListener(
       new ILibraryChangedListener() {
         public void librariesChanged(ILibrary[] allLibraries, ILibrary selectedLibrary) {
           controlView.getLibraryView().setObjects(allLibraries);
         }
       });
   selectionModel.addCurrentSelectionChangeListener(
       new IChangeListener() {
         public void changeOccurred() {
           refreshTrackView();
         }
       });
   selectionModel
       .getTrackDetailModel()
       .addChangeDetailListener(
           new IChangeListener() {
             public void changeOccurred() {
               refreshTrackView();
             }
           });
 }
Exemplo n.º 5
0
 private void updateEnabled() {
   setEnabled(view.getSelectedLibrary() != null);
 }
Exemplo n.º 6
0
 private void refreshTrackView() {
   controlView.getTrackListView().refreshView();
 }
Exemplo n.º 7
0
 private void initTrackListView() {
   Action removeTrackAction =
       new RemoveTrackFromLibraryAction(resources, controlView, libraryModel);
   controlView.getTrackListView().addAction(removeTrackAction);
 }