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.table.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.api.gui.frame.IFrameMediator;
25: import org.columba.api.selection.ISelectionListener;
26: import org.columba.api.selection.SelectionChangedEvent;
27: import org.columba.core.command.CommandProcessor;
28: import org.columba.core.gui.action.AbstractColumbaAction;
29: import org.columba.mail.command.IMailFolderCommandReference;
30: import org.columba.mail.gui.composer.command.RedirectCommand;
31: import org.columba.mail.gui.frame.MailFrameMediator;
32: import org.columba.mail.gui.table.selection.TableSelectionChangedEvent;
33: import org.columba.mail.util.MailResourceLoader;
34:
35: /**
36: * @author frd
37: * modified ReplyAction by SWITT
38: *
39: * To change this generated comment go to
40: * Window>Preferences>Java>Code Generation>Code and Comments
41: */
42: public class RedirectAction extends AbstractColumbaAction implements
43: ISelectionListener {
44: public RedirectAction(IFrameMediator frameMediator) {
45:
46: //mod: 20040629 SWITT
47: super (frameMediator, MailResourceLoader.getString("menu",
48: "mainframe", "menu_message_redirect"));
49:
50: // tooltip text ;mod: 20040629 SWITT
51: putValue(SHORT_DESCRIPTION, MailResourceLoader.getString(
52: "menu", "mainframe", "menu_message_redirect_tooltip")
53: .replaceAll("&", ""));
54:
55: // toolbar text is usually a bit shorter ;mod: 20040629 SWITT
56: putValue(TOOLBAR_NAME, MailResourceLoader.getString("menu",
57: "mainframe", "menu_message_redirect_toolbar"));
58:
59: // icons ;mod: 20040629 SWITT
60: /*
61: putValue(SMALL_ICON, ImageLoader.getSmallImageIcon("redirect_small.png"));
62: putValue(LARGE_ICON, ImageLoader.getImageIcon("redirect.png"));
63: */
64:
65: // shortcut key is STRG-E ;mod: 20040629 SWITT
66: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_E,
67: Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
68:
69: setEnabled(false);
70: ((MailFrameMediator) frameMediator)
71: .registerTableSelectionListener(this );
72: }
73:
74: /* (non-Javadoc)
75: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
76: */
77: public void actionPerformed(ActionEvent evt) {
78: IMailFolderCommandReference r = ((MailFrameMediator) getFrameMediator())
79: .getTableSelection();
80: CommandProcessor.getInstance().addOp(new RedirectCommand(r));
81: }
82:
83: /* (non-Javadoc)
84: * @see org.columba.core.gui.selection.ISelectionListener#selectionChanged(org.columba.core.gui.selection.SelectionChangedEvent)
85: */
86: public void selectionChanged(SelectionChangedEvent e) {
87: TableSelectionChangedEvent tableEvent = (TableSelectionChangedEvent) e;
88: setEnabled(tableEvent.getUids().length != 0);
89: }
90: }
|