001: package net.sourceforge.squirrel_sql.client;
002:
003: /*
004: * Copyright (C) 2001-2006 Colin Bell
005: * colbell@users.sourceforge.net
006: *
007: * Modifications Copyright (C) 2003-2004 Jason Height
008: *
009: * This library is free software; you can redistribute it and/or
010: * modify it under the terms of the GNU Lesser General Public
011: * License as published by the Free Software Foundation; either
012: * version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful,
015: * but WITHOUT ANY WARRANTY; without even the implied warranty of
016: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
017: * Lesser General Public License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
022: */
023: import javax.swing.Action;
024: import javax.swing.JComponent;
025: import javax.swing.JMenu;
026:
027: import net.sourceforge.squirrel_sql.client.gui.db.DataCache;
028: import net.sourceforge.squirrel_sql.fw.sql.SQLDriverManager;
029: import net.sourceforge.squirrel_sql.fw.util.IMessageHandler;
030: import net.sourceforge.squirrel_sql.fw.util.TaskThreadPool;
031:
032: import net.sourceforge.squirrel_sql.client.action.ActionCollection;
033: import net.sourceforge.squirrel_sql.client.gui.WindowManager;
034: import net.sourceforge.squirrel_sql.client.gui.mainframe.MainFrame;
035: import net.sourceforge.squirrel_sql.client.plugin.IPlugin;
036: import net.sourceforge.squirrel_sql.client.plugin.PluginManager;
037: import net.sourceforge.squirrel_sql.client.preferences.PreferenceType;
038: import net.sourceforge.squirrel_sql.client.preferences.SquirrelPreferences;
039: import net.sourceforge.squirrel_sql.client.resources.SquirrelResources;
040: import net.sourceforge.squirrel_sql.client.session.ISQLEntryPanelFactory;
041: import net.sourceforge.squirrel_sql.client.session.SessionManager;
042: import net.sourceforge.squirrel_sql.client.session.mainpanel.SQLHistory;
043:
044: /**
045: * Defines the API to do callbacks on the application.
046: */
047: public interface IApplication {
048: public interface IMenuIDs extends MainFrame.IMenuIDs {
049: // Empty body.
050: }
051:
052: /**
053: * Return the dummy plugin used internally by the SQuirreL client
054: * when a plugin is needed for accessing API functions.
055: *
056: * @return the dummy plugin used internally by the SQuirreL client.
057: */
058: IPlugin getDummyAppPlugin();
059:
060: /**
061: * Return the plugin manager responsible for this applications plugins.
062: *
063: * @return the plugin manager responsible for this applications plugins.
064: */
065: PluginManager getPluginManager();
066:
067: /**
068: * Return the manager responsible for windows.
069: *
070: * @return the manager responsible for windows.
071: */
072: WindowManager getWindowManager();
073:
074: ActionCollection getActionCollection();
075:
076: SQLDriverManager getSQLDriverManager();
077:
078: DataCache getDataCache();
079:
080: SquirrelPreferences getSquirrelPreferences();
081:
082: SquirrelResources getResources();
083:
084: /**
085: * Retrieves the message handler for the application.
086: *
087: * @return Application level message handler.
088: */
089: IMessageHandler getMessageHandler();
090:
091: /**
092: * Return an array of all the sessions currently active.
093: *
094: * @return array of all active sessions.
095: */
096: //ISession[] getActiveSessions();
097: /**
098: * Retrieve the object that manages sessions.
099: *
100: * @return <TT>SessionManager</TT>.
101: */
102: SessionManager getSessionManager();
103:
104: /**
105: * Display an error message dialog.
106: *
107: * @param msg The error msg.
108: */
109: void showErrorDialog(String msg);
110:
111: /**
112: * Display an error message dialog.
113: *
114: * @param th The Throwable that caused the error
115: */
116: void showErrorDialog(Throwable th);
117:
118: /**
119: * Display an error message dialog.
120: *
121: * @param msg The error msg.
122: * @param th The Throwable that caused the error
123: */
124: void showErrorDialog(String msg, Throwable th);
125:
126: /**
127: * Return the main frame.
128: *
129: * @return The main frame for the app.
130: */
131: MainFrame getMainFrame();
132:
133: /**
134: * Return the thread pool for this app.
135: *
136: * @return the thread pool for this app.
137: */
138: TaskThreadPool getThreadPool();
139:
140: /**
141: * Return the collection of <TT>FontInfo </TT> objects for this app.
142: *
143: * @return the collection of <TT>FontInfo </TT> objects for this app.
144: */
145: FontInfoStore getFontInfoStore();
146:
147: /**
148: * Return the factory object used to create the SQL entry panel.
149: *
150: * @return the factory object used to create the SQL entry panel.
151: */
152: ISQLEntryPanelFactory getSQLEntryPanelFactory();
153:
154: /**
155: * Retrieve the application level SQL History object.
156: *
157: * @return the application level SQL History object.
158: */
159: SQLHistory getSQLHistory();
160:
161: /**
162: * Set the factory object used to create the SQL entry panel.
163: *
164: * @param factory the factory object used to create the SQL entry panel.
165: */
166: void setSQLEntryPanelFactory(ISQLEntryPanelFactory factory);
167:
168: /**
169: * Add a hierarchical menu to a menu.
170: *
171: * @param menuId ID of menu to add to. @see #IMenuIDs
172: * @param menu The menu that will be added.
173: */
174: void addToMenu(int menuId, JMenu menu);
175:
176: /**
177: * Add an <TT>Action</TT> to a menu.
178: *
179: * @param menuId ID of menu to add to. @see #IMenuIDs
180: * @param action The action to be added.
181: */
182: void addToMenu(int menuId, Action action);
183:
184: /**
185: * Add component to the main frames status bar.
186: *
187: * @param comp Component to add.
188: */
189: void addToStatusBar(JComponent comp);
190:
191: /**
192: * Remove component to the main frames status bar.
193: *
194: * @param comp Component to remove.
195: */
196: void removeFromStatusBar(JComponent comp);
197:
198: /**
199: * Application startup processing.
200: */
201: void startup();
202:
203: /**
204: * Application shutdown processing.
205: */
206: boolean shutdown();
207:
208: /**
209: * Launches the specified url in the system default web-browser
210: *
211: * @param url the URL of the web page to display.
212: */
213: void openURL(String url);
214:
215: /**
216: * Saves off preferences and all state present in the application.
217: */
218: void saveApplicationState();
219:
220: /**
221: * Persists the specified category of preferences to file.
222: *
223: * @param preferenceType the enumerated type that indicates what category
224: * of preferences to be persisted.
225: */
226: public void savePreferences(PreferenceType preferenceType);
227:
228: }
|