1 package org.columba.mail.gui.message.action; 17 18 import java.awt.event.ActionEvent ; 19 20 import javax.swing.AbstractAction ; 21 22 import org.columba.core.command.CommandProcessor; 23 import org.columba.core.resourceloader.IconKeys; 24 import org.columba.core.resourceloader.ImageLoader; 25 import org.columba.mail.command.IMailFolderCommandReference; 26 import org.columba.mail.command.MailFolderCommandReference; 27 import org.columba.mail.gui.message.IMessageController; 28 import org.columba.mail.gui.message.command.SaveAttachmentAsCommand; 29 import org.columba.mail.gui.message.viewer.AttachmentsViewer; 30 import org.columba.mail.util.MailResourceLoader; 31 32 37 public class SaveAsAttachmentAction extends AbstractAction { 38 39 private Integer [] address; 40 41 private AttachmentsViewer attachmentViewer; 42 43 private IMessageController mediator; 44 45 public SaveAsAttachmentAction(IMessageController mediator, Integer [] address) { 46 super(MailResourceLoader.getString("menu", "mainframe", 47 "attachmentsaveas")); 48 this.mediator = mediator; 49 this.address = address; 50 51 putValue(SHORT_DESCRIPTION, MailResourceLoader.getString("menu", 53 "mainframe", "attachmentsaveas_tooltip").replaceAll("&", "")); 54 55 putValue(SMALL_ICON, ImageLoader 57 .getSmallIcon(IconKeys.DOCUMENT_SAVE_AS)); 58 60 } 61 62 public SaveAsAttachmentAction(IMessageController mediator, 63 AttachmentsViewer attachmentViewer) { 64 super(MailResourceLoader.getString("menu", "mainframe", 65 "attachmentsaveas")); 66 this.mediator = mediator; 67 this.attachmentViewer = attachmentViewer; 68 69 putValue(SHORT_DESCRIPTION, MailResourceLoader.getString("menu", 71 "mainframe", "attachmentsaveas_tooltip").replaceAll("&", "")); 72 73 putValue(SMALL_ICON, ImageLoader 75 .getSmallIcon(IconKeys.DOCUMENT_SAVE_AS)); 76 78 } 79 80 81 public void actionPerformed(ActionEvent evt) { 82 IMailFolderCommandReference ref = mediator.getSelectedReference(); 83 84 if (attachmentViewer != null) 85 address = attachmentViewer.getSelected(); 86 87 CommandProcessor.getInstance().addOp( 88 new SaveAttachmentAsCommand(new MailFolderCommandReference(ref 89 .getSourceFolder(), ref.getUids(), address))); 90 91 } 92 93 } | Popular Tags |