001: package org.rege.isqlj.squirrel;
002:
003: /**
004: * <p>Title: sqsc-isqlj</p>
005: * <p>Description: SquirrelSQL plugin for iSqlJ</p>
006: * <p>Copyright: Copyright (c) 2003 Stathis Alexopoulos</p>
007: * @author Stathis Alexopoulos stathis@rege.org
008: * <br>
009: * <br>
010: * <p>
011: * This file is part of sqsc-isqlj.
012: * </p>
013: * <br>
014: * <p>
015: * sqsc-isqlj is free software; you can redistribute it and/or modify
016: * it under the terms of the GNU Lesser General Public License as published by
017: * the Free Software Foundation; either version 2 of the License, or
018: * (at your option) any later version.
019: *
020: * Foobar is distributed in the hope that it will be useful,
021: * but WITHOUT ANY WARRANTY; without even the implied warranty of
022: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
023: * GNU Lesser General Public License for more details.
024: *
025: * You should have received a copy of the GNU Lesser General Public License
026: * along with Foobar; if not, write to the Free Software
027: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
028: * </p>
029: */
030:
031: import javax.swing.JMenu;
032:
033: import net.sourceforge.squirrel_sql.client.IApplication;
034: import net.sourceforge.squirrel_sql.client.action.ActionCollection;
035: import net.sourceforge.squirrel_sql.client.gui.session.ObjectTreeInternalFrame;
036: import net.sourceforge.squirrel_sql.client.gui.session.SQLInternalFrame;
037: import net.sourceforge.squirrel_sql.client.plugin.DefaultSessionPlugin;
038: import net.sourceforge.squirrel_sql.client.plugin.PluginException;
039: import net.sourceforge.squirrel_sql.client.plugin.PluginResources;
040: import net.sourceforge.squirrel_sql.client.plugin.PluginSessionCallback;
041: import net.sourceforge.squirrel_sql.client.session.ISession;
042:
043: public class ISqlJPlugin extends DefaultSessionPlugin {
044: private interface IMenuResourceKeys {
045: String SCRIPTS = "isqlj";
046: }
047:
048: private PluginResources resources;
049:
050: public ISqlJPlugin() {
051: }
052:
053: public synchronized void initialize() throws PluginException {
054: super .initialize();
055: IApplication app = getApplication();
056:
057: resources = new ISqlJPluginResources(
058: "org.rege.isqlj.squirrel.ISqlJ", this );
059:
060: ActionCollection coll = app.getActionCollection();
061: coll.add(new ExecuteISqlJAction(app, resources, this ));
062: createMenu();
063: }
064:
065: public PluginSessionCallback sessionStarted(ISession session) {
066:
067: PluginSessionCallback ret = new PluginSessionCallback() {
068: public void sqlInternalFrameOpened(
069: SQLInternalFrame sqlInternalFrame, ISession sess) {
070: // TODO
071: // Plugin supports only the main session window
072: }
073:
074: public void objectTreeInternalFrameOpened(
075: ObjectTreeInternalFrame objectTreeInternalFrame,
076: ISession sess) {
077: // TODO
078: // Plugin supports only the main session window
079: }
080: };
081: return ret;
082:
083: }
084:
085: public void unload() {
086: super .unload();
087: }
088:
089: private void createMenu() {
090: IApplication app = getApplication();
091: ActionCollection coll = app.getActionCollection();
092:
093: JMenu menu = resources.createMenu(IMenuResourceKeys.SCRIPTS);
094: resources.addToMenu(coll.get(ExecuteISqlJAction.class), menu);
095:
096: app.addToMenu(IApplication.IMenuIDs.SESSION_MENU, menu);
097: }
098:
099: public String getInternalName() {
100: return "sqsc-isqlj";
101: }
102:
103: public String getDescriptiveName() {
104: return "Plugin for iSqlJ Interpreter";
105: }
106:
107: public String getAuthor() {
108: return "Stathis Alexopoulos";
109: }
110:
111: public String getContributors() {
112: return "";
113: }
114:
115: public String getWebSite() {
116: return "http://www.rege.org/isqlj";
117: }
118:
119: public String getVersion() {
120: return "0.10";
121: }
122:
123: public String getHelpFileName() {
124: return "myHelp.txt";
125: }
126:
127: public String getChangeLogFileName() {
128: return "myLog.txt";
129: }
130:
131: public String getLicenceFileName() {
132: return "myLicence.txt";
133: }
134: }
|