01: /*
02: * CommitAction.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:
20: import workbench.interfaces.Commitable;
21: import workbench.resource.ResourceMgr;
22:
23: /**
24: * Action to send a commit to the DBMS
25: * @see workbench.gui.sql.SqlPanel#commit()
26: * @author support@sql-workbench.net
27: */
28: public class CommitAction extends WbAction {
29: private Commitable client;
30:
31: public CommitAction(Commitable aClient) {
32: super ();
33: this .client = aClient;
34: KeyStroke key = KeyStroke.getKeyStroke(KeyEvent.VK_M,
35: InputEvent.ALT_MASK);
36: this .initMenuDefinition("MnuTxtCommit", key);
37: this .setMenuItemName(ResourceMgr.MNU_TXT_SQL);
38: this .setIcon(ResourceMgr.getImage("Commit"));
39: }
40:
41: public void executeAction(ActionEvent e) {
42: if (this.client != null)
43: this.client.commit();
44: }
45:
46: }
|