01: package net.sourceforge.squirrel_sql.plugins.sqlscript.table_script;
02:
03: /*
04: * Copyright (C) 2005 Gerd Wagner
05: * gerdwagner@users.sourceforge.net
06: *
07: * This program is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU General Public License
09: * as published by the Free Software Foundation; either version 2
10: * of the License, or any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU General Public License for more details.
16: *
17: * You should have received a copy of the GNU General Public License
18: * along with this program; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20: */
21:
22: import java.awt.event.ActionEvent;
23:
24: import net.sourceforge.squirrel_sql.fw.util.Resources;
25: import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin;
26:
27: import net.sourceforge.squirrel_sql.client.IApplication;
28: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
29: import net.sourceforge.squirrel_sql.client.session.ISession;
30: import net.sourceforge.squirrel_sql.client.session.ISQLPanelAPI;
31: import net.sourceforge.squirrel_sql.client.session.action.ISessionAction;
32: import net.sourceforge.squirrel_sql.client.session.action.ISQLPanelAction;
33:
34: public class CreateTableOfCurrentSQLAction extends SquirrelAction
35: implements ISQLPanelAction {
36:
37: /**
38: * Current session.
39: */
40: private ISession _session;
41:
42: /**
43: * Current plugin.
44: */
45: private final SQLScriptPlugin _plugin;
46:
47: public CreateTableOfCurrentSQLAction(IApplication app,
48: Resources rsrc, SQLScriptPlugin plugin) {
49: super (app, rsrc);
50: _plugin = plugin;
51: }
52:
53: public void actionPerformed(ActionEvent evt) {
54: if (_session != null) {
55: new CreateTableOfCurrentSQLCommand(_session, _plugin)
56: .execute();
57: }
58: }
59:
60: public void setSQLPanel(ISQLPanelAPI panel) {
61: if (null != panel) {
62: _session = panel.getSession();
63: } else {
64: _session = null;
65: }
66: setEnabled(null != _session);
67: }
68: }
|