01: package net.sourceforge.squirrel_sql.plugins.sqlscript.table_script;
02:
03: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
04: import net.sourceforge.squirrel_sql.client.session.action.IObjectTreeAction;
05: import net.sourceforge.squirrel_sql.client.session.ISession;
06: import net.sourceforge.squirrel_sql.client.session.IObjectTreeAPI;
07: import net.sourceforge.squirrel_sql.client.IApplication;
08: import net.sourceforge.squirrel_sql.plugins.sqlscript.SQLScriptPlugin;
09: import net.sourceforge.squirrel_sql.fw.util.Resources;
10:
11: import java.awt.event.ActionEvent;
12:
13: public class CreateSelectScriptAction extends SquirrelAction implements
14: IObjectTreeAction {
15:
16: /**
17: * Current session.
18: */
19: private ISession _session;
20:
21: /**
22: * Current plugin.
23: */
24: private final SQLScriptPlugin _plugin;
25:
26: public CreateSelectScriptAction(IApplication app, Resources rsrc,
27: SQLScriptPlugin plugin) {
28: super (app, rsrc);
29: _plugin = plugin;
30: }
31:
32: public void actionPerformed(ActionEvent evt) {
33: if (_session != null) {
34: new CreateSelectScriptCommand(_session, _plugin).execute();
35: }
36: }
37:
38: /**
39: * Set the current session.
40: *
41: * @param session The current session.
42: */
43: public void setSession(ISession session) {
44: _session = session;
45: }
46:
47: public void setObjectTree(IObjectTreeAPI tree) {
48: if (null != tree) {
49: _session = tree.getSession();
50: } else {
51: _session = null;
52: }
53: setEnabled(null != _session);
54: }
55: }
|