[Squirrel-sql-commits] sql12/app/src/net/sourceforge/squirrel_sql/client/session ISession.java,1.17,
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
From: Gerd W. <ger...@us...> - 2005-04-21 16:11:11
|
Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28274/app/src/net/sourceforge/squirrel_sql/client/session Modified Files: ISession.java Session.java Log Message: Created API for Plugins to work with the multi session window framework and fixed plugins. Index: ISession.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/ISession.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ISession.java 19 Apr 2005 16:30:10 -0000 1.17 --- ISession.java 21 Apr 2005 16:10:31 -0000 1.18 *************** *** 34,37 **** --- 34,38 ---- import net.sourceforge.squirrel_sql.client.gui.session.SessionPanel; import net.sourceforge.squirrel_sql.client.gui.session.BaseSessionInternalFrame; + import net.sourceforge.squirrel_sql.client.gui.session.SessionInternalFrame; import net.sourceforge.squirrel_sql.client.plugin.IPlugin; import net.sourceforge.squirrel_sql.client.session.mainpanel.IMainPanelTab; *************** *** 118,127 **** void closeSQLConnection() throws SQLException; ! /** ! * Set the session sheet for this session. ! * ! * @param sheet Sheet for this session. ! */ ! void setSessionSheet(SessionPanel child); /** --- 119,123 ---- void closeSQLConnection() throws SQLException; ! void setSessionInternalFrame(SessionInternalFrame sif); /** *************** *** 139,142 **** --- 135,140 ---- SessionPanel getSessionSheet(); + SessionInternalFrame getSessionInternalFrame(); + // JASON: // SQLFilterClauses getSQLFilterClauses(); *************** *** 218,222 **** /** ! * Add the passed action to the session toolbar. * * @param action Action to be added. --- 216,220 ---- /** ! * Add the passed action to the toolbar of the sessions main window. * * @param action Action to be added. *************** *** 225,229 **** /** ! * TODO: Javadoc */ IParserEventsProcessor getParserEventsProcessor(); --- 223,233 ---- /** ! * The code in any SQLEditor is parsed in the background. You may attach a listener to the ParserEventsProcessor ! * to get to know about the results of parsing. The events are passed synchron with the event queue ! * (via SwingUtils.invokeLater()). At the moment events are produced for errors in the SQLScript ! * which are highlighted in the syntax plugin and for aliases of table names which are used in the ! * code completion plugin. ! * <p> ! * If you want the ParserEventsProcessor to produce further events feel free to contact ger...@us.... */ IParserEventsProcessor getParserEventsProcessor(); *************** *** 231,235 **** --- 235,268 ---- void setActiveSessionWindow(BaseSessionInternalFrame activeActiveSessionWindow); + /** + * Hint for plugins: + * When ISessionPlugin.sessionStarted is called the active session window is + * always the SessionInternalFrame which provides an SQLPanelAPI. This might help to simplyfy + * the code in the sessionStarted() method of a plugin. + */ BaseSessionInternalFrame getActiveSessionWindow(); + /** + * Hint for plugins: + * When ISessionPlugin.sessionStarted is called the active session window is + * always the SessionInternalFrame which provides an SQLPanelAPI. This might help to simplyfy + * the code in the sessionStarted() method of a plugin. + * + * @throws IllegalStateException if ActiveSessionWindow doesn't provide an SQLPanelAPI + * for example if it is an ObjectTreeInternalFrame + */ + ISQLPanelAPI getSQLPanelAPIOfActiveSessionWindow(); + + /** + * + * Hint for plugins: + * When ISessionPlugin.sessionStarted is called the active session window is + * always the SessionInternalFrame which provides an SQLPanelAPI. This might help to simplyfy + * the code in the sessionStarted() method of a plugin. + * + * @throws IllegalStateException if ActiveSessionWindow doesn't provide an IObjectTreeAPI + * for example if it is an SQLInternalFrame + */ + IObjectTreeAPI getObjectTreeAPIOfActiveSessionWindow(); + } Index: Session.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/Session.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Session.java 19 Apr 2005 16:30:10 -0000 1.23 --- Session.java 21 Apr 2005 16:10:31 -0000 1.24 *************** *** 47,52 **** import net.sourceforge.squirrel_sql.fw.util.log.LoggerController; import net.sourceforge.squirrel_sql.client.IApplication; ! import net.sourceforge.squirrel_sql.client.gui.session.SessionPanel; ! import net.sourceforge.squirrel_sql.client.gui.session.BaseSessionInternalFrame; import net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand; import net.sourceforge.squirrel_sql.client.plugin.IPlugin; --- 47,51 ---- import net.sourceforge.squirrel_sql.fw.util.log.LoggerController; import net.sourceforge.squirrel_sql.client.IApplication; ! import net.sourceforge.squirrel_sql.client.gui.session.*; import net.sourceforge.squirrel_sql.client.mainframe.action.OpenConnectionCommand; import net.sourceforge.squirrel_sql.client.plugin.IPlugin; *************** *** 127,130 **** --- 126,130 ---- private BaseSessionInternalFrame _activeActiveSessionWindow; + private SessionInternalFrame _sessionInternalFrame; /** *************** *** 466,470 **** } ! /** * Reconnect to the database. */ --- 466,470 ---- } ! /** * Reconnect to the database. */ *************** *** 545,548 **** --- 545,569 ---- } + public synchronized void setSessionInternalFrame(SessionInternalFrame sif) + { + _sessionInternalFrame = sif; + + // This is a reasonable default and makes initialization code run well + _activeActiveSessionWindow = sif; + + _sessionSheet = sif.getSessionPanel(); + final ListIterator it = _statusBarToBeAdded.listIterator(); + while (it.hasNext()) + { + addToStatusBar((JComponent)it.next()); + it.remove(); + } + } + + public SessionInternalFrame getSessionInternalFrame() + { + return _sessionInternalFrame; + } + public SessionPanel getSessionSheet() { *************** *** 679,682 **** --- 700,712 ---- } + /** + * The code in any SQLEditor is parsed in the background. You may attach a listener to the ParserEventsProcessor + * to get to know about the results of parsing. The events are passed synchron with the event queue + * (via SwingUtils.invokeLater()). At the moment events are produced for errors in the SQLScript + * which are highlighted in the syntax plugin and for aliases of table names which are used in the + * code completion plugin. + * <p> + * If you want the ParserEventsProcessor to produce further events feel free to contact ger...@us.... + */ public IParserEventsProcessor getParserEventsProcessor() { *************** *** 694,697 **** --- 724,778 ---- } + /** + * + * @throws IllegalStateException if ActiveSessionWindow doesn't provide an SQLPanelAPI + * for example if it is an ObjectTreeInternalFrame + */ + public ISQLPanelAPI getSQLPanelAPIOfActiveSessionWindow() + { + ISQLPanelAPI sqlPanelAPI; + if(_activeActiveSessionWindow instanceof SessionInternalFrame) + { + sqlPanelAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); + } + else if(_activeActiveSessionWindow instanceof SQLInternalFrame) + { + sqlPanelAPI = ((SQLInternalFrame)_activeActiveSessionWindow).getSQLPanelAPI(); + } + else + { + throw new IllegalStateException("SQLPanelApi can only be provided for SessionInternalFrame or SQLInternalFrame"); + } + + return sqlPanelAPI; + } + + /** + * + * @throws IllegalStateException if ActiveSessionWindow doesn't provide an IObjectTreeAPI + * for example if it is an SQLInternalFrame + */ + public IObjectTreeAPI getObjectTreeAPIOfActiveSessionWindow() + { + IObjectTreeAPI objectTreeAPI; + if(_activeActiveSessionWindow instanceof SessionInternalFrame) + { + objectTreeAPI = ((SessionInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); + } + else if(_activeActiveSessionWindow instanceof ObjectTreeInternalFrame) + { + objectTreeAPI = ((ObjectTreeInternalFrame)_activeActiveSessionWindow).getObjectTreeAPI(); + } + else + { + throw new IllegalStateException("ObjectTreeApi can only be provided for SessionInternalFrame or ObjectTreeInternalFrame"); + } + + return objectTreeAPI; + } + + + + private class SQLConnectionListener implements PropertyChangeListener { |