01: package net.sourceforge.squirrel_sql.plugins.exportconfig.action;
02:
03: /*
04: * Copyright (C) 2003 Colin Bell
05: * colbell@users.sourceforge.net
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2.1 of the License, or (at your option) any later version.
11: *
12: * This library 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 GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free Software
19: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: */
21: import java.awt.event.ActionEvent;
22:
23: import net.sourceforge.squirrel_sql.fw.util.BaseException;
24: import net.sourceforge.squirrel_sql.fw.util.Resources;
25: import net.sourceforge.squirrel_sql.fw.util.StringManager;
26: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
27:
28: import net.sourceforge.squirrel_sql.client.IApplication;
29: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
30:
31: import net.sourceforge.squirrel_sql.plugins.exportconfig.ExportConfigPlugin;
32:
33: /**
34: * This <TT>Action</TT> will allow the user to export the database drivers to
35: * the file system.
36: *
37: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
38: */
39: public class ExportDriversAction extends SquirrelAction {
40: private static final StringManager s_stringMgr = StringManagerFactory
41: .getStringManager(ExportDriversAction.class);
42:
43: /** Application API. */
44: private final IApplication _app;
45:
46: /** Current plugin. */
47: private final ExportConfigPlugin _plugin;
48:
49: /**
50: * Ctor.
51: *
52: * @param app Application API.
53: * @param rsrc Plugins resources.
54: * @param plugin This plugin.
55: *
56: * @throws IllegalArgumentException
57: * Thrown if a�<TT>null</TT> <TT>IApplication</TT>,
58: * <TT>Resources</TT> or <TT>MysqlPlugin</TT> passed.
59: *
60: * @throws IllegalArgumentException
61: * Thrown if an invalid <TT>checktype</TT> passed.
62: */
63: public ExportDriversAction(IApplication app, Resources rsrc,
64: ExportConfigPlugin plugin) {
65: super (app, rsrc);
66: if (app == null) {
67: throw new IllegalArgumentException("IApplication == null");
68: }
69: if (rsrc == null) {
70: throw new IllegalArgumentException("Resources == null");
71: }
72: if (plugin == null) {
73: throw new IllegalArgumentException(
74: "ExportConfigPlugin == null");
75: }
76:
77: _app = app;
78: _plugin = plugin;
79: }
80:
81: public void actionPerformed(ActionEvent evt) {
82: try {
83: new ExportDriversCommand(getParentFrame(evt), _plugin)
84: .execute();
85: } catch (BaseException ex) {
86: // i18n[exportconfig.errorSavingDrivers=Error saving drivers]
87: _app.showErrorDialog(s_stringMgr
88: .getString("exportconfig.errorSavingDrivers"), ex);
89: }
90: }
91: }
|