01: package org.firebirdsql.squirrel.act;
02:
03: import java.awt.event.ActionEvent;
04:
05: import net.sourceforge.squirrel_sql.fw.util.Resources;
06:
07: import net.sourceforge.squirrel_sql.client.IApplication;
08: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
09: import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
10: import net.sourceforge.squirrel_sql.client.session.ISession;
11: import net.sourceforge.squirrel_sql.client.session.action.ISessionAction;
12:
13: /**
14: * This <TT>Action</TT> will run a "EXPLAIN TABLE" over the
15: * currently selected tables.
16: *
17: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
18: */
19: public class ActivateIndexAction extends SquirrelAction implements
20: ISessionAction {
21: /** Current session. */
22: private ISession _session;
23:
24: /** Current plugin. */
25: private final IPlugin _plugin;
26:
27: /**
28: * Ctor.
29: *
30: * @param app Application API.
31: * @param rsrc Plugins resources.
32: * @param plugin This plugin.
33: *
34: * @throws IllegalArgumentException
35: * Thrown if a<TT>null</TT> <TT>IApplication</TT>,
36: * <TT>Resources</TT> or <TT>IPlugin</TT> passed.
37: */
38: public ActivateIndexAction(IApplication app, Resources rsrc,
39: IPlugin plugin) {
40: super (app, rsrc);
41: if (app == null) {
42: throw new IllegalArgumentException("IApplication == null");
43: }
44: if (rsrc == null) {
45: throw new IllegalArgumentException("Resources == null");
46: }
47: if (plugin == null) {
48: throw new IllegalArgumentException("IPlugin == null");
49: }
50:
51: _plugin = plugin;
52: }
53:
54: public void actionPerformed(ActionEvent evt) {
55: if (_session != null) {
56: try {
57: new AlterIndexCommand(_session, _plugin, true)
58: .execute();
59: } catch (Throwable th) {
60: _session.showErrorMessage(th);
61: }
62: }
63: }
64:
65: /**
66: * Set the current session.
67: *
68: * @param session The current session.
69: */
70: public void setSession(ISession session) {
71: _session = session;
72: }
73: }
|