01: /*
02: * FileSaveAction.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.actions;
13:
14: import java.awt.event.ActionEvent;
15: import java.awt.event.InputEvent;
16: import java.awt.event.KeyEvent;
17:
18: import javax.swing.KeyStroke;
19: import workbench.gui.sql.EditorPanel;
20:
21: import workbench.interfaces.TextFileContainer;
22: import workbench.resource.ResourceMgr;
23:
24: /**
25: * Save the current file in the SQL Editor.
26: * @author support@sql-workbench.net
27: */
28: public class FileSaveAction extends WbAction {
29: private EditorPanel client;
30:
31: public FileSaveAction(EditorPanel aClient) {
32: super ();
33: this .client = aClient;
34: this .initMenuDefinition("MnuTxtFileSave", KeyStroke
35: .getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
36: this .setMenuItemName(ResourceMgr.MNU_TXT_FILE);
37: this .setEnabled(this .client.hasFileLoaded());
38: }
39:
40: public void executeAction(ActionEvent e) {
41: this.client.saveCurrentFile();
42: }
43: }
|