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.Frame;
22:
23: import javax.swing.JDialog;
24:
25: import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;
26: import net.sourceforge.squirrel_sql.fw.util.ICommand;
27: import net.sourceforge.squirrel_sql.fw.util.StringManager;
28: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
29: import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
30: import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
31:
32: import net.sourceforge.squirrel_sql.client.IApplication;
33:
34: import net.sourceforge.squirrel_sql.plugins.exportconfig.ExportConfigPlugin;
35: import net.sourceforge.squirrel_sql.plugins.exportconfig.gui.ExportDialog;
36:
37: /**
38: * This command allow the user to save configuration information to the file
39: * system.
40: *
41: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
42: */
43: class ExportConfigurationCommand implements ICommand {
44: /** Logger for this class. */
45: private final static ILogger s_log = LoggerController
46: .createLogger(ExportConfigurationCommand.class);
47:
48: /** Parent frame. */
49: private final Frame _frame;
50:
51: /** Current plugin. */
52: private ExportConfigPlugin _plugin;
53:
54: /**
55: * Ctor.
56: *
57: * @param frame Parent frame for dialogs etc.
58: * @param plugin Current plugin.
59: *
60: * @throws IllegalArgumentException
61: * Thrown if a <TT>null</TT> <TT>Frame</TT>,
62: * <TT>ExportConfigPlugin</TT> passed.
63: */
64: public ExportConfigurationCommand(Frame frame,
65: ExportConfigPlugin plugin) {
66: super ();
67:
68: if (frame == null) {
69: throw new IllegalArgumentException("Frame == null");
70: }
71: if (plugin == null) {
72: throw new IllegalArgumentException(
73: "ExportConfigPlugin == null");
74: }
75:
76: _frame = frame;
77: _plugin = plugin;
78: }
79:
80: /**
81: * Execute this command. Display dialog and process users request.
82: */
83: public void execute() {
84: final IApplication app = _plugin.getApplication();
85: final JDialog dlog = new ExportDialog(app, _plugin);
86: dlog.pack();
87: GUIUtils.centerWithinParent(dlog);
88: dlog.show();
89: }
90: }
|