01: package net.sourceforge.squirrel_sql.plugins.mysql.action;
02:
03: /*
04: * Copyright (C) 2003 Arun Kapilan.P
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2.1 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: import java.awt.event.ActionEvent;
21:
22: import net.sourceforge.squirrel_sql.fw.util.Resources;
23:
24: import net.sourceforge.squirrel_sql.client.IApplication;
25: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
26: import net.sourceforge.squirrel_sql.client.session.ISession;
27: import net.sourceforge.squirrel_sql.client.session.action.ISessionAction;
28:
29: import net.sourceforge.squirrel_sql.plugins.mysql.MysqlPlugin;
30:
31: /**
32: * CreateTableAction.java
33: *
34: * Created on June 13, 2003, 9:56 AM
35: *
36: * @author Arun Kapilan.P
37: */
38: public class CreateTableAction extends SquirrelAction implements
39: ISessionAction {
40: /** Current session. */
41: private ISession _session;
42:
43: /** Current plugin. */
44: private final MysqlPlugin _plugin;
45:
46: public CreateTableAction(IApplication app, Resources rsrc,
47: MysqlPlugin plugin) {
48: super (app, rsrc);
49: _plugin = plugin;
50: }
51:
52: public void actionPerformed(ActionEvent evt) {
53: if (_session != null) {
54: try {
55: new CreateTableCommand(_session, _plugin).execute();
56: } catch (Throwable th) {
57: _session.showErrorMessage(th);
58: }
59: }
60: }
61:
62: /**
63: * Set the current session.
64: *
65: * @param session The current session.
66: */
67: public void setSession(ISession session) {
68: _session = session;
69: }
70: }
|