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()); }
@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$ } }
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(); } }); }