001: package net.sourceforge.squirrel_sql.plugins.sessionscript;
002:
003: /*
004: * Copyright (C) 2002 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: */
021: import java.awt.BorderLayout;
022: import java.awt.Container;
023: import java.awt.Dimension;
024:
025: import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;
026: import net.sourceforge.squirrel_sql.fw.util.log.ILogger;
027: import net.sourceforge.squirrel_sql.fw.util.log.LoggerController;
028: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
029: import net.sourceforge.squirrel_sql.fw.util.StringManager;
030:
031: import net.sourceforge.squirrel_sql.client.IApplication;
032: import net.sourceforge.squirrel_sql.client.gui.BaseInternalFrame;
033:
034: class ScriptsSheet extends BaseInternalFrame {
035: private static final StringManager s_stringMgr = StringManagerFactory
036: .getStringManager(ScriptsSheet.class);
037:
038: /** Logger for this class. */
039: private static ILogger s_log = LoggerController
040: .createLogger(ScriptsSheet.class);
041:
042: /** Singleton instance of this class. */
043: private static ScriptsSheet s_instance;
044:
045: /** Plugin. */
046: private SessionScriptPlugin _plugin;
047:
048: /** Application API. */
049: private IApplication _app;
050:
051: /** Main panel. */
052: private ViewSessionScriptsPanel _mainPnl;
053:
054: private ScriptsSheet(SessionScriptPlugin plugin, IApplication app) {
055: // i18n[sessionscript.startupScripts=Startup Scripts]
056: super (s_stringMgr.getString("sessionscript.startupScripts"),
057: true, true, true, true);
058: _plugin = plugin;
059: _app = app;
060:
061: createUserInterface();
062: }
063:
064: public void dispose() {
065: synchronized (getClass()) {
066: s_instance = null;
067: }
068: super .dispose();
069: }
070:
071: public static synchronized void showSheet(
072: SessionScriptPlugin plugin, IApplication app) {
073: if (s_instance == null) {
074: s_instance = new ScriptsSheet(plugin, app);
075: app.getMainFrame().addInternalFrame(s_instance, true, null);
076: }
077: s_instance.setVisible(true);
078: }
079:
080: /**
081: * Create this sheets user interface.
082: */
083: private void createUserInterface() {
084: setDefaultCloseOperation(DISPOSE_ON_CLOSE);
085: // Icon icon = app.getResources().getIcon(getClass(), "frameIcon"); //i18n
086: // if (icon != null)
087: // {
088: // setFrameIcon(icon);
089: // }
090:
091: GUIUtils.makeToolWindow(this , true);
092:
093: _mainPnl = new ViewSessionScriptsPanel(_plugin, _app);
094:
095: Container content = getContentPane();
096: content.setLayout(new BorderLayout());
097: content.add(_mainPnl, BorderLayout.CENTER);
098:
099: setPreferredSize(new Dimension(600, 400));
100: pack();
101: }
102:
103: }
|