[Squirrel-sql-commits] sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel SQLPanel.
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
From: Gerd W. <ger...@us...> - 2005-07-16 12:15:14
|
Update of /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12722/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel Modified Files: SQLPanel.java SQLTab.java Log Message: First version of "View selected object in Object Tree" Index: SQLPanel.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/SQLPanel.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** SQLPanel.java 27 May 2005 22:46:36 -0000 1.29 --- SQLPanel.java 16 Jul 2005 12:15:00 -0000 1.30 *************** *** 76,79 **** --- 76,80 ---- import net.sourceforge.squirrel_sql.client.session.action.RedoAction; import net.sourceforge.squirrel_sql.client.session.action.UndoAction; + import net.sourceforge.squirrel_sql.client.session.action.ViewObjectAtCursorInObjectTreeAction; import net.sourceforge.squirrel_sql.client.session.event.*; import net.sourceforge.squirrel_sql.client.session.properties.SessionProperties; *************** *** 172,175 **** --- 173,182 ---- private RedoAction _redoAction; + /** + * true if this panel is within a SessionInternalFrame + * false if this panle is within a SQLInternalFrame + */ + private boolean _inMainSessionWindow; + /** *************** *** 181,188 **** * Thrown if a <TT>null</TT> <TT>ISession</TT> passed. */ ! public SQLPanel(ISession session) { super(); ! setSession(session); createGUI(); propertiesHaveChanged(null); --- 188,196 ---- * Thrown if a <TT>null</TT> <TT>ISession</TT> passed. */ ! public SQLPanel(ISession session, boolean isInMainSessionWindow) { super(); ! _inMainSessionWindow = isInMainSessionWindow; ! setSession(session); createGUI(); propertiesHaveChanged(null); *************** *** 337,373 **** } - /** - * Add a listener listening for events on result tabs. - * - * @param lis Listener - * - * @throws IllegalArgumentException - * If a null <TT>IResultTabListener</TT> passed. - */ - // public synchronized void addResultTabListener(IResultTabListener lis) - // { - // if (lis == null) - // { - // throw new IllegalArgumentException("null IResultTabListener passed"); - // } - // _listeners.add(IResultTabListener.class, lis); - // } - - /** - * Remove a listener listening for events on result tabs. - * - * @param lis Listener - * - * @throws IllegalArgumentException - * If a null <TT>IResultTabListener</TT> passed. - */ - // public synchronized void removeResultTabListener(IResultTabListener lis) - // { - // if (lis == null) - // { - // throw new IllegalArgumentException("null IResultTabListener passed"); - // } - // _listeners.remove(IResultTabListener.class, lis); - // } /** --- 345,348 ---- *************** *** 388,407 **** } - /** - * Remove a listener for events in this sql panel executer tabs. - * - * @param lis Listener - * - * @throws IllegalArgumentException - * If a null <TT>IResultTabListener</TT> passed. - */ - // public synchronized void removeResultTabListener(ISQLResultExecuterTabListener lis) - // { - // if (lis == null) - // { - // throw new IllegalArgumentException("ISQLResultExecuterTabListener == null"); - // } - // _listeners.remove(ISQLResultExecuterTabListener.class, lis); - // } public synchronized void removeExecuterTabListener(ISQLResultExecuterTabListener lis) --- 363,366 ---- *************** *** 414,476 **** } - // public ISQLEntryPanel getSQLEntryPanel() - // { - // return _sqlEntry; - // } - - // public void executeCurrentSQL() - // { - // String sql = getSQLEntryPanel().getSQLToBeExecuted(); - // if (sql != null && sql.length() > 0) - // { - // executeSQL(sql); - // } - // else - // { - // _session.getMessageHandler().showErrorMessage("No SQL selected for execution."); - // } - // } - - // public void executeSQL(String sql) - // { - // if (sql != null && sql.trim().length() > 0) - // { - // SQLExecuterTask task = new SQLExecuterTask(this, _session, sql); - // _session.getApplication().getThreadPool().addTask(task); - // } - // } - - /** - * Close all the Results frames. - */ - // public synchronized void closeAllSQLResultFrames() - // { - // List tabs = (List)_usedTabs.clone(); - // for (Iterator it = tabs.iterator(); it.hasNext();) - // { - // ResultTabInfo ti = (ResultTabInfo) it.next(); - // if (ti._resultFrame != null) - // { - // ti._resultFrame.dispose(); - // ti._resultFrame = null; - // } - // } - // } - - /** - * Close all the Results tabs. - */ - // public synchronized void closeAllSQLResultTabs() - // { - // List tabs = (List)_usedTabs.clone(); - // for (Iterator it = tabs.iterator(); it.hasNext();) - // { - // ResultTabInfo ti = (ResultTabInfo) it.next(); - // if (ti._resultFrame == null) - // { - // closeTab(ti._tab); - // } - // } - // } public ISQLEntryPanel getSQLEntryPanel() --- 373,376 ---- *************** *** 479,486 **** } - // void selected() - // { - // // Empty body. - // } public void runCurrentExecuter() --- 379,382 ---- *************** *** 581,671 **** } ! fireSQLEntryAreaInstalled(); ! } ! /** ! * Close the passed <TT>ResultTab</TT>. This is done by clearing ! * all data from the tab, removing it from the tabbed panel ! * and adding it to the list of available tabs. ! * ! * @throws IllegalArgumentException ! * Thrown if a <TT>null</TT> <TT>ResultTab</TT> passed. ! */ ! // public void closeTab(ResultTab tab) ! // { ! // if (tab == null) ! // { ! // throw new IllegalArgumentException("Null ResultTab passed"); ! // } ! // s_log.debug("SQLPanel.closeTab(" + tab.getIdentifier().toString() + ")"); ! // tab.clear(); ! // _tabbedResultsPanel.remove(tab); ! // ResultTabInfo tabInfo = (ResultTabInfo) _allTabs.get(tab.getIdentifier()); ! // _availableTabs.add(tabInfo); ! // _usedTabs.remove(tabInfo); ! // tabInfo._resultFrame = null; ! // fireTabRemovedEvent(tab); ! // } ! /** ! * Create an internal frame for the specified tab and ! * display the tab in the internal frame after removing ! * it from the tabbed pane. ! * ! * @param tab <TT>ResultTab</TT> to be displayed in ! * an internal frame. ! * ! * @throws IllegalArgumentException ! * Thrown if a <TT>null</TT> <TT>ResultTab</TT> passed. ! */ ! // public void createWindow(ResultTab tab) ! // { ! // if (tab == null) ! // { ! // throw new IllegalArgumentException("Null ResultTab passed"); ! // } ! // s_log.debug("SQLPanel.createWindow(" + tab.getIdentifier().toString() + ")"); ! // _tabbedResultsPanel.remove(tab); ! // ResultFrame frame = new ResultFrame(_session, tab); ! // ResultTabInfo tabInfo = (ResultTabInfo) _allTabs.get(tab.getIdentifier()); ! // tabInfo._resultFrame = frame; ! // _session.getApplication().getMainFrame().addInternalFrame(frame, true, null); ! // fireTabTornOffEvent(tab); ! // frame.setVisible(true); ! // ! // // There used to be a frame.pack() here but it resized the frame ! // // to be very wide if text output was used. ! // ! // frame.toFront(); ! // frame.requestFocus(); ! // } - /** - * Return the passed tab back into the tabbed pane. - * - * @param tab <TT>Resulttab</TT> to be returned - * - * @throws IllegalArgumentException - * Thrown if a <TT>null</TT> <TT>ResultTab</TT> passed. - */ - // public void returnToTabbedPane(ResultTab tab) - // { - // if (tab == null) - // { - // throw new IllegalArgumentException("Null ResultTab passed"); - // } - // - // s_log.debug("SQLPanel.returnToTabbedPane(" + tab.getIdentifier().toString() + ")"); - // - // ResultTabInfo tabInfo = (ResultTabInfo) _allTabs.get(tab.getIdentifier()); - // if (tabInfo._resultFrame != null) - // { - // addResultsTab(tab); - // fireTornOffResultTabReturned(tab); - // tabInfo._resultFrame = null; - // } - // } ! public void setVisible(boolean value) { super.setVisible(value); --- 477,496 ---- } ! createStandardEntryAreaMenuItems(); ! fireSQLEntryAreaInstalled(); ! } ! private void createStandardEntryAreaMenuItems() ! { ! if(_inMainSessionWindow) ! { ! Action vioAction = _session.getApplication().getActionCollection().get(ViewObjectAtCursorInObjectTreeAction.class); ! _sqlEntry.addToSQLEntryAreaMenu(vioAction); ! } ! } ! public void setVisible(boolean value) { super.setVisible(value); *************** *** 686,722 **** } - /** - * Display the next tab in the SQL results. - */ - // public void gotoNextResultsTab() - // { - // final int tabCount = _tabbedResultsPanel.getTabCount(); - // if (tabCount > 1) - // { - // int nextTabIdx = _tabbedResultsPanel.getSelectedIndex() + 1; - // if (nextTabIdx >= tabCount) - // { - // nextTabIdx = 0; - // } - // _tabbedResultsPanel.setSelectedIndex(nextTabIdx); - // } - // } - - /** - * Display the previous tab in the SQL results. - */ - // public void gotoPreviousResultsTab() - // { - // final int tabCount = _tabbedResultsPanel.getTabCount(); - // if (tabCount > 1) - // { - // int prevTabIdx = _tabbedResultsPanel.getSelectedIndex() - 1; - // if (prevTabIdx < 0) - // { - // prevTabIdx = tabCount - 1; - // } - // _tabbedResultsPanel.setSelectedIndex(prevTabIdx); - // } - // } /** --- 511,514 ---- *************** *** 812,877 **** } - // protected void fireTabAddedEvent(ResultTab tab) - // { - // // Guaranteed to be non-null. - // Object[] listeners = _listeners.getListenerList(); - // // Process the listeners last to first, notifying - // // those that are interested in this event. - // ResultTabEvent evt = null; - // for (int i = listeners.length - 2; i >= 0; i -= 2) - // { - // if (listeners[i] == IResultTabListener.class) - // { - // // Lazily create the event: - // if (evt == null) - // { - // evt = new ResultTabEvent(_session, tab); - // } - // ((IResultTabListener)listeners[i + 1]).resultTabAdded(evt); - // } - // } - // } - - // protected void fireTabRemovedEvent(ResultTab tab) - // { - // // Guaranteed to be non-null. - // Object[] listeners = _listeners.getListenerList(); - // // Process the listeners last to first, notifying - // // those that are interested in this event. - // ResultTabEvent evt = null; - // for (int i = listeners.length - 2; i >= 0; i -= 2) - // { - // if (listeners[i] == IResultTabListener.class) - // { - // // Lazily create the event: - // if (evt == null) - // { - // evt = new ResultTabEvent(_session, tab); - // } - // ((IResultTabListener) listeners[i + 1]).resultTabRemoved(evt); - // } - // } - // } - - // protected void fireTabRemovedEvent(ResultTab tab) - // { - // // Guaranteed to be non-null. - // Object[] listeners = _listeners.getListenerList(); - // // Process the listeners last to first, notifying - // // those that are interested in this event. - // ResultTabEvent evt = null; - // for (int i = listeners.length - 2; i >= 0; i -= 2) - // { - // if (listeners[i] == IResultTabListener.class) - // { - // // Lazily create the event: - // if (evt == null) - // { - // evt = new ResultTabEvent(_session, tab); - // } - // ((IResultTabListener) listeners[i + 1]).resultTabRemoved(evt); - // } - // } - // } protected void fireTabTornOffEvent(ResultTab tab) --- 604,607 ---- *************** *** 959,1051 **** } - // void setCancelPanel(final JPanel panel) - // { - // SwingUtilities.invokeLater(new Runnable() - // { - // public void run() - // { - // _tabbedResultsPanel.addTab("Executing SQL", null, panel, "Press Cancel to Stop"); - // _tabbedResultsPanel.setSelectedComponent(panel); - // } - // }); - // } - - // void addResultsTab(SQLExecutionInfo exInfo, ResultSetDataSet rsds, - // ResultSetMetaDataDataSet mdds, final JPanel cancelPanel, - // IDataSetUpdateableTableModel creator) - // { - // final ResultTab tab; - // if (_availableTabs.size() > 0) - // { - // ResultTabInfo ti = (ResultTabInfo)_availableTabs.remove(0); - // _usedTabs.add(ti); - // tab = ti._tab; - // s_log.debug("Using tab " + tab.getIdentifier().toString() + " for results."); - // } - // else - // { - // tab = new ResultTab(_session, this, _idFactory.createIdentifier(), exInfo, creator); - // ResultTabInfo ti = new ResultTabInfo(tab); - // _allTabs.put(tab.getIdentifier(), ti); - // _usedTabs.add(ti); - // s_log.debug("Created new tab " + tab.getIdentifier().toString() + " for results."); - // } - // - // try - // { - // tab.showResults(rsds, mdds, exInfo); - // SwingUtilities.invokeLater(new Runnable() - // { - // public void run() - // { - // _tabbedResultsPanel.remove(cancelPanel); - // addResultsTab(tab); - // _tabbedResultsPanel.setSelectedComponent(tab); - // fireTabAddedEvent(tab); - // } - // }); - // } - // catch (DataSetException dse) - // { - // _session.getMessageHandler().showErrorMessage(dse); - // } - // } - - // void removeCancelPanel(final JPanel cancelPanel) - // { - // SwingUtilities.invokeLater(new Runnable() - // { - // public void run() - // { - // _tabbedResultsPanel.remove(cancelPanel); - // } - // }); - // } - - // private void addResultsTab(ResultTab tab) - // { - // _tabbedResultsPanel.addTab(tab.getTitle(), null, tab, tab.getViewableSqlString()); - // } - - // private String modifyIndividualScript(String sql) - // { - // // Guaranteed to be non-null. - // Object[] listeners = _listeners.getListenerList(); - // // Process the listeners last to first, notifying - // // those that are interested in this event. - // for (int i = listeners.length - 2; i >= 0; i -= 2) - // { - // if (listeners[i] == ISQLExecutionListener.class) - // { - // sql = ((ISQLExecutionListener) listeners[i]).statementExecuting(sql); - // if (sql == null) - // { - // break; - // } - // } - // } - // - // return sql; - // } private void appendSQL(String sql) --- 689,692 ---- *************** *** 1230,1233 **** --- 871,879 ---- } + public boolean isInMainSessionWindow() + { + return _inMainSessionWindow; + } + /** * Listens for changes in the execution jtabbedpane and then fires Index: SQLTab.java =================================================================== RCS file: /cvsroot/squirrel-sql/sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/SQLTab.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SQLTab.java 16 Aug 2004 07:07:41 -0000 1.4 --- SQLTab.java 16 Jul 2005 12:15:00 -0000 1.5 *************** *** 72,76 **** if (_comp == null) { ! _comp = new SQLPanel(getSession()); } return _comp; --- 72,76 ---- if (_comp == null) { ! _comp = new SQLPanel(getSession(), true); } return _comp; |