1 17 package org.columba.mail.filter.plugins; 18 19 import java.io.File ; 20 import java.net.URL ; 21 22 import org.columba.api.command.ICommand; 23 import org.columba.api.command.ICommandReference; 24 import org.columba.api.command.IWorkerStatusController; 25 import org.columba.core.command.Command; 26 import org.columba.core.filter.AbstractFilterAction; 27 import org.columba.core.filter.IFilterAction; 28 import org.columba.core.folder.DefaultFolderCommandReference; 29 import org.columba.core.folder.api.IFolder; 30 31 39 public class PlaySoundFilterAction extends AbstractFilterAction { 40 41 44 public ICommand getCommand( 45 IFilterAction filterAction, 46 IFolder srcFolder, 47 Object [] uids) 48 throws Exception { 49 50 for (int i = 0; i < uids.length; i++) { 52 System.out.println("Hello World for message-uid=" + uids[i]); 53 } 54 55 58 DefaultFolderCommandReference r = 59 new DefaultFolderCommandReference(srcFolder, uids); 60 61 PlaySoundCommand c = new PlaySoundCommand(r); 62 63 return c; 64 65 } 66 67 76 class PlaySoundCommand extends Command { 77 public PlaySoundCommand(ICommandReference reference) { 78 super(reference); 79 } 80 81 public void execute(IWorkerStatusController worker) throws Exception { 82 83 File soundFile = new File ("sound.wav"); 85 URL url = soundFile.toURL(); 86 87 PlaySound.play(url); 88 } 89 } 90 } 91 | Popular Tags |