01: package net.sourceforge.squirrel_sql.client.mainframe.action;
02:
03: /*
04: * Copyright (C) 2006 Rob Manning
05: * manningr@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: import java.beans.PropertyVetoException;
23:
24: import net.sourceforge.squirrel_sql.client.IApplication;
25: import net.sourceforge.squirrel_sql.client.action.SquirrelAction;
26: import net.sourceforge.squirrel_sql.client.gui.db.DriversListInternalFrame;
27: import net.sourceforge.squirrel_sql.client.gui.db.IDriversList;
28: import net.sourceforge.squirrel_sql.fw.sql.ISQLDriver;
29: import net.sourceforge.squirrel_sql.fw.util.StringManager;
30: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
31: import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
32: import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
33:
34: /**
35: * This <CODE>Action</CODE> allows the user to create a new <TT>ISQLDriver</TT>.
36: *
37: * @author <A HREF="mailto:colbell@users.sourceforge.net">Colin Bell</A>
38: */
39: public class ShowDriverWebsiteAction extends SquirrelAction {
40: /** Logger for this class. */
41: private static ILogger s_log = LoggerController
42: .createLogger(ShowDriverWebsiteAction.class);
43:
44: /** Internationalized strings for this class. */
45: private static final StringManager s_stringMgr = StringManagerFactory
46: .getStringManager(ShowDriverWebsiteAction.class);
47:
48: /**
49: * List of all the users drivers.
50: */
51: private IDriversList _drivers;
52:
53: /**
54: * Ctor.
55: *
56: * @param app Application API.
57: */
58: public ShowDriverWebsiteAction(IApplication app, IDriversList list) {
59: super (app);
60: if (list == null) {
61: throw new IllegalArgumentException(
62: "Null DriversList passed");
63: }
64: _drivers = list;
65: }
66:
67: /**
68: * Perform this action. Execute the create driver command.
69: *
70: * @param evt The current event.
71: */
72: public void actionPerformed(ActionEvent evt) {
73: IApplication app = getApplication();
74: DriversListInternalFrame tw = app.getWindowManager()
75: .getDriversListInternalFrame();
76: tw.moveToFront();
77: try {
78: tw.setSelected(true);
79: } catch (PropertyVetoException ex) {
80: //i18n[CreateDriverAction.error.selectingwindow=Error selecting window]
81: s_log
82: .error(
83: s_stringMgr
84: .getString("CreateDriverAction.error.selectingwindow"),
85: ex);
86: }
87:
88: ISQLDriver driver = _drivers.getSelectedDriver();
89: if (driver != null) {
90: new ShowDriverWebsiteCommand(app, driver).execute();
91: }
92: }
93: }
|