01: /*
02: * ManageMacroAction.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.gui.MainWindow;
21: import workbench.gui.sql.SqlPanel;
22: import workbench.log.LogMgr;
23: import workbench.resource.ResourceMgr;
24: import workbench.sql.MacroManager;
25:
26: /**
27: * @author support@sql-workbench.net
28: */
29: public class ManageMacroAction extends WbAction {
30: private MainWindow client;
31:
32: public ManageMacroAction(MainWindow aClient) {
33: super ();
34: this .client = aClient;
35: this .initMenuDefinition("MnuTxtManageMacros", KeyStroke
36: .getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_MASK));
37: this .setMenuItemName(ResourceMgr.MNU_TXT_SQL);
38: this .setIcon(null);
39: }
40:
41: public void executeAction(ActionEvent e) {
42: SqlPanel sql = this .client.getCurrentSqlPanel();
43: if (sql != null) {
44: MacroManager.getInstance().selectAndRun(sql);
45: } else {
46: LogMgr.logWarning("ManageMacroAction.actionPerformed()",
47: "Don't have a current SqlPanel!");
48: }
49: }
50:
51: }
|