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.api.gui.frame.IFrameMediator; 23 import org.columba.core.command.CommandProcessor; 24 import org.columba.core.desktop.ColumbaDesktop; 25 import org.columba.core.resourceloader.IconKeys; 26 import org.columba.core.resourceloader.ImageLoader; 27 import org.columba.mail.command.IMailFolderCommandReference; 28 import org.columba.mail.command.MailFolderCommandReference; 29 import org.columba.mail.gui.frame.MessageViewOwner; 30 import org.columba.mail.gui.message.IMessageController; 31 import org.columba.mail.gui.message.command.OpenAttachmentCommand; 32 import org.columba.mail.gui.message.viewer.AttachmentsViewer; 33 import org.columba.mail.util.MailResourceLoader; 34 35 40 public class OpenAttachmentAction extends AbstractAction { 41 42 private Integer [] address; 43 44 private IMessageController mediator; 45 private AttachmentsViewer attachmentViewer; 46 47 public OpenAttachmentAction(IMessageController mediator, Integer [] address) { 48 super(MailResourceLoader.getString("menu", "mainframe", 49 "attachmentopen")); 50 51 this.mediator = mediator; 52 this.address = address; 53 54 putValue(SHORT_DESCRIPTION, MailResourceLoader.getString("menu", 56 "mainframe", "attachmentopen_tooltip").replaceAll("&", "")); 57 58 putValue(SMALL_ICON, ImageLoader.getSmallIcon(IconKeys.FOLDER_OPEN)); 60 62 setEnabled(ColumbaDesktop.getInstance().supportsOpen()); 63 64 } 65 66 public OpenAttachmentAction(IMessageController mediator, 67 AttachmentsViewer attachmentViewer) { 68 super(MailResourceLoader.getString("menu", "mainframe", 69 "attachmentopen")); 70 71 this.mediator = mediator; 72 this.attachmentViewer = attachmentViewer; 73 74 putValue(SHORT_DESCRIPTION, MailResourceLoader.getString("menu", 76 "mainframe", "attachmentopen_tooltip").replaceAll("&", "")); 77 78 putValue(SMALL_ICON, ImageLoader.getIcon(IconKeys.FOLDER_OPEN)); 80 82 setEnabled(ColumbaDesktop.getInstance().supportsOpen()); 83 84 } 85 86 91 public void actionPerformed(ActionEvent evt) { 92 IMailFolderCommandReference ref = mediator.getSelectedReference(); 93 94 if (attachmentViewer != null) { 95 address = attachmentViewer.getSelected(); 96 } 97 98 CommandProcessor.getInstance().addOp( 99 new OpenAttachmentCommand(new MailFolderCommandReference(ref 100 .getSourceFolder(), ref.getUids(), address))); 101 } 102 103 } | Popular Tags |