01: /*
02: * SSHTools - Java SSH2 API
03: *
04: * Copyright (C) 2002-2003 Lee David Painter and Contributors.
05: *
06: * Contributions made by:
07: *
08: * Brett Smith
09: * Richard Pernavas
10: * Erwin Bolwidt
11: *
12: * This program is free software; you can redistribute it and/or
13: * modify it under the terms of the GNU General Public License
14: * as published by the Free Software Foundation; either version 2
15: * of the License, or (at your option) any later version.
16: *
17: * This program is distributed in the hope that it will be useful,
18: * but WITHOUT ANY WARRANTY; without even the implied warranty of
19: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20: * GNU General Public License for more details.
21: *
22: * You should have received a copy of the GNU General Public License
23: * along with this program; if not, write to the Free Software
24: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25: */
26: package com.sshtools.common.ui;
27:
28: import org.apache.commons.logging.Log;
29: import org.apache.commons.logging.LogFactory;
30:
31: import java.awt.event.ActionEvent;
32: import java.awt.event.KeyEvent;
33:
34: import javax.swing.Action;
35: import javax.swing.KeyStroke;
36:
37: /**
38: *
39: *
40: * @author $author$
41: * @version $Revision: 1.14 $
42: */
43: public class NewWindowAction extends StandardAction {
44: /** */
45: protected Log log = LogFactory.getLog(NewWindowAction.class);
46:
47: //
48: private SshToolsApplication application;
49:
50: /**
51: * Creates a new NewWindowAction object.
52: *
53: * @param application
54: */
55: public NewWindowAction(SshToolsApplication application) {
56: this .application = application;
57: putValue(Action.NAME, "New Window");
58: putValue(Action.SMALL_ICON,
59: getIcon("/com/sshtools/common/ui/newwindow.png"));
60: putValue(LARGE_ICON,
61: getIcon("/com/sshtools/common/ui/largenewwindow.png"));
62: putValue(Action.SHORT_DESCRIPTION, "Create new window");
63: putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(
64: KeyEvent.VK_W, KeyEvent.ALT_MASK));
65: putValue(Action.LONG_DESCRIPTION, "Create a new SSHTerm window");
66: putValue(Action.MNEMONIC_KEY, new Integer('w'));
67: putValue(Action.ACTION_COMMAND_KEY, "new-window");
68: putValue(StandardAction.ON_MENUBAR, new Boolean(true));
69: putValue(StandardAction.MENU_NAME, "File");
70: putValue(StandardAction.MENU_ITEM_GROUP, new Integer(0));
71: putValue(StandardAction.MENU_ITEM_WEIGHT, new Integer(90));
72: putValue(StandardAction.ON_TOOLBAR, new Boolean(true));
73: putValue(StandardAction.TOOLBAR_GROUP, new Integer(0));
74: putValue(StandardAction.TOOLBAR_WEIGHT, new Integer(90));
75: }
76:
77: /**
78: *
79: *
80: * @param evt
81: */
82: public void actionPerformed(ActionEvent evt) {
83: try {
84: application.newContainer();
85: } catch (SshToolsApplicationException stae) {
86: log.error(stae);
87: }
88: }
89: }
|