01: package org.rege.isqlj.squirrel;
02:
03: /**
04: * <p>Title: sqsc-isqlj</p>
05: * <p>Description: SquirrelSQL plugin for iSqlJ</p>
06: * <p>Copyright: Copyright (c) 2003 Stathis Alexopoulos</p>
07: * @author Stathis Alexopoulos stathis@rege.org
08: * <br>
09: * <br>
10: * <p>
11: * This file is part of sqsc-isqlj.
12: * </p>
13: * <br>
14: * <p>
15: * sqsc-isqlj is free software; you can redistribute it and/or modify
16: * it under the terms of the GNU Lesser General Public License as published by
17: * the Free Software Foundation; either version 2 of the License, or
18: * (at your option) any later version.
19: *
20: * Foobar is distributed in the hope that it will be useful,
21: * but WITHOUT ANY WARRANTY; without even the implied warranty of
22: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23: * GNU Lesser General Public License for more details.
24: *
25: * You should have received a copy of the GNU Lesser General Public License
26: * along with Foobar; if not, write to the Free Software
27: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28: * </p>
29: */
30:
31: import java.awt.event.ActionEvent;
32:
33: import net.sourceforge.squirrel_sql.fw.util.BaseException;
34: import net.sourceforge.squirrel_sql.fw.util.Resources;
35:
36: import net.sourceforge.squirrel_sql.client.IApplication;
37: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
38: import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
39: import net.sourceforge.squirrel_sql.client.session.ISession;
40: import net.sourceforge.squirrel_sql.client.session.action.ISessionAction;
41:
42: public class ExecuteISqlJAction extends SquirrelAction implements
43: ISessionAction {
44: private ISession session;
45: private ISqlJPlugin plugin;
46:
47: public ExecuteISqlJAction(IApplication app, Resources rsrc,
48: ISqlJPlugin plugin) throws IllegalArgumentException {
49: super (app, rsrc);
50: if (plugin == null) {
51: throw new IllegalArgumentException(
52: "null ISqlJPlugin passed");
53: }
54: this .plugin = plugin;
55: }
56:
57: {
58: }
59:
60: public void actionPerformed(ActionEvent evt) {
61: if (session != null) {
62: try {
63: new ExecuteISqlJCommand(getParentFrame(evt), session,
64: plugin).execute();
65: } catch (BaseException ex) {
66: session.showErrorMessage(ex);
67: }
68: }
69: }
70:
71: public void setSession(ISession session) {
72: this.session = session;
73: }
74:
75: }
|