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.core.gui.globalactions;
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.core.gui.action.AbstractColumbaAction;
26: import org.columba.core.resourceloader.GlobalResourceLoader;
27: import org.columba.core.resourceloader.IconKeys;
28: import org.columba.core.resourceloader.ImageLoader;
29: import org.columba.core.shutdown.ShutdownManager;
30:
31: public class ExitAction extends AbstractColumbaAction {
32: public ExitAction(IFrameMediator controller) {
33: super (controller, GlobalResourceLoader.getString(null, null,
34: "menu_file_exit"));
35:
36: // tooltip text
37: putValue(SHORT_DESCRIPTION, GlobalResourceLoader.getString(
38: null, null, "menu_file_exit").replaceAll("&", ""));
39:
40: // small icon for menu
41: putValue(SMALL_ICON, ImageLoader.getSmallIcon(IconKeys.EXIT));
42:
43: // large icon for toolbar
44: putValue(LARGE_ICON, ImageLoader.getIcon(IconKeys.EXIT));
45:
46: // shortcut key
47: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q,
48: Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()));
49: }
50:
51: /*
52: * Close all open frames, which leads to exiting Columba
53: */
54: public void actionPerformed(ActionEvent evt) {
55:
56: //
57: // @author: fdietz
58: // using shutdown-manager is wrong here, because this
59: // automatically also calls the FrameManager, which
60: // also starts a second shutdown thread
61: // -> This leads into two parallel shutdown thread which
62: // -> is why sometimes config-files, etc. get messed up
63: //
64:
65: //FrameManager.getInstance().storeViews();
66:
67: // @author: tstich
68: // Its better to call the Shutdownmanager
69: // since the above is called automatically from it.
70: // ShutdownManager is modified to allow one shutdown
71: // call only, so we never should have multi-shutdown
72: // problems again.
73:
74: ShutdownManager.getInstance().shutdown(0);
75:
76: }
77: }
|