1 /* 2 * aTunes 3 * Copyright (C) Alex Aranda, Sylvain Gaudard and contributors 4 * 5 * See http://www.atunes.org/wiki/index.php?title=Contributing for information about contributors 6 * 7 * http://www.atunes.org 8 * http://sourceforge.net/projects/atunes 9 * 10 * This program is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU General Public License 12 * as published by the Free Software Foundation; either version 2 13 * of the License, or (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 */ 20 21 package net.sourceforge.atunes.kernel.modules.process; 22 23 import java.util.List; 24 25 import javax.swing.SwingUtilities; 26 27 import net.sourceforge.atunes.model.IDialogFactory; 28 import net.sourceforge.atunes.model.IErrorDialog; 29 import net.sourceforge.atunes.model.ILocalAudioObject; 30 import net.sourceforge.atunes.model.IProcessListener; 31 import net.sourceforge.atunes.utils.I18nUtils; 32 33 class ExportProcessListener implements 34 IProcessListener<List<ILocalAudioObject>> { 35 36 private IDialogFactory dialogFactory; 37 38 /** 39 * @param dialogFactory 40 */ setDialogFactory(final IDialogFactory dialogFactory)41 public void setDialogFactory(final IDialogFactory dialogFactory) { 42 this.dialogFactory = dialogFactory; 43 } 44 45 @Override processCanceled()46 public void processCanceled() { 47 // Nothing to do 48 } 49 50 @Override processFinished(final boolean ok, final List<ILocalAudioObject> result)51 public void processFinished(final boolean ok, 52 final List<ILocalAudioObject> result) { 53 SwingUtilities.invokeLater(new Runnable() { 54 @Override 55 public void run() { 56 if (!ok) { 57 ExportProcessListener.this.dialogFactory.newDialog( 58 IErrorDialog.class).showErrorDialog( 59 I18nUtils.getString("ERRORS_IN_EXPORT_PROCESS")); 60 } 61 } 62 }); 63 } 64 }