Ruffin,

I don't know if this will help you much but I have been developing support for multiple SQL Panels attached to a session  and as such have had to remove the (singular) ISession.getSQLPanelAPI() method call.

I have implemented a ISQLAction interface so the Actions within the ActionCollection that deal with ISQLPanelAPI's, implement this interface and then they get automatically updated with the current "active" ISQLPanelAPI.

Note that my patch isn't completely finished, but I plan to post it shortly and hopefully it will be accepted.

Anyhow to perhaps answer your question (I don't have squirrel code in form of me), Have a look at the DesktopManager class in MainFrame(?) this seems to be a class that deals with the internal frames activating, maybe you can hook into this somehow, otherwise you might need to add an InternalFrameListener to all SessionFrames(?) as they are created.


Jason

-----Original Message-----
From: rufbo1@comcast.net [mailto:rufbo1@comcast.net]
Sent: Thursday, 5 February 2004 4:34 AM
To: squirrel-sql-develop@lists.sourceforge.net
Subject: [Squirrel-sql-develop] app.getActiveSessions()[0].getSQLPanelAPI(this).setEntireSQLScript(strSql);

In those recently released, horribly alpha quality plugins I sent, I'm having some issues with this line:

app.getActiveSessions()[0].getSQLPanelAPI(this).setEntireSQLScript(strSql);

I wasn't able to [quickly] figure out how to determine which SQLPanel the user had focused at the time the plugin's action was being called, and am currently cheesing out and just grabbing the first one for the time being.

Any pointers?  Code in more context pasted below.

Thanks,

Ruffin Bailey

(The Whitespace plugin seems to be fookin' on me anywhere *but* the box where I developed it.  I'll look into that before too long.  Print seems to be working fairly well, however)


public void initialize() throws PluginException {
         IApplication app = getApplication();

         String strActionText = "Insert SQL Whitespace (Ruffin's way)";
         Action actGo = new AbstractAction(strActionText)   {
                         public void actionPerformed(ActionEvent e)  {
                                 getAndCleanSql();
                         }
         };

         app.addToMenu(IApplication.IMenuIDs.SESSION_MENU, actGo);

}


 public void getAndCleanSql()    {
         IApplication app = getApplication();
         String strSql = app.getActiveSessions()[0].getSQLPanelAPI(this).getEntireSQLScript();
         SqlWhitespaceEngine engine = new SqlWhitespaceEngine();
         strSql = engine.cleanSqlStatement(strSql);
         app.getActiveSessions()[0].getSQLPanelAPI(this).setEntireSQLScript(strSql);
}


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Squirrel-sql-develop mailing list
Squirrel-sql-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop


--------------------------------------------------------------------------------------------------------------------
This e-mail (including attachments) is confidential information of Australian Submarine Corporation Pty Limited (ASC). It may also be legally privileged. Unauthorised use and disclosure is prohibited. ASC is not taken to have waived confidentiality or privilege if this e-mail was sent to you in error. If you have received it in error, please notify the sender promptly. While ASC takes steps to identify and eliminate viruses, it cannot confirm that this e-mail is free from them. You should scan this e-mail for viruses before it is used. The statements in this e-mail are those of the sender only, unless specifically stated to be those of ASC by someone with authority to do so.