01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.mail.gui.composer.action;
17:
18: import java.awt.Toolkit;
19: import java.awt.event.ActionEvent;
20: import java.awt.event.KeyEvent;
21:
22: import javax.swing.KeyStroke;
23:
24: import org.columba.core.gui.action.AbstractColumbaAction;
25: import org.columba.core.resourceloader.ImageLoader;
26: import org.columba.mail.gui.composer.ComposerController;
27: import org.columba.mail.resourceloader.MailImageLoader;
28: import org.columba.mail.util.MailResourceLoader;
29:
30: /**
31: * Add attachment to message.
32: *
33: * @author fdietz
34: */
35: public class AttachFileAction extends AbstractColumbaAction {
36: public AttachFileAction(ComposerController composerController) {
37: super (composerController, MailResourceLoader.getString("menu",
38: "composer", "menu_message_attachFile"));
39:
40: // tooltip text
41: putValue(SHORT_DESCRIPTION, MailResourceLoader.getString(
42: "menu", "composer", "menu_message_attachFile_tooltip")
43: .replaceAll("&", ""));
44:
45: // toolbar text
46: putValue(TOOLBAR_NAME, MailResourceLoader.getString("menu",
47: "composer", "menu_message_attachFile_toolbar"));
48:
49: // large icon for toolbar
50: putValue(LARGE_ICON, MailImageLoader
51: .getIcon("mail-attachment.png"));
52:
53: // small icon for menu
54: putValue(SMALL_ICON, MailImageLoader
55: .getIcon("mail-attachment.png"));
56:
57: //shortcut key
58: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_A,
59: Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()
60: | ActionEvent.ALT_MASK));
61: }
62:
63: /* (non-Javadoc)
64: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
65: */
66: public void actionPerformed(ActionEvent evt) {
67: ComposerController composerController = ((ComposerController) getFrameMediator());
68:
69: composerController.getAttachmentController()
70: .addFileAttachment();
71: }
72: }
|