RE: [Squirrel-sql-develop] app.getActiveSessions()[0].getSQLPanel API(this).setEntireSQLScript(strS
A Java SQL client for any JDBC compliant database
Brought to you by:
colbell,
gerdwagner
From: Colin B. <Col...@as...> - 2004-02-05 05:47:42
|
Hi Ruffin, If your Action implements ISessionAction then setSession will be called whenever a session is made active. E.G. One of the Actions from the scripts plugin. public class CreateDataScriptAction extends SquirrelAction implements ISessionAction { /** Current session. */ private ISession _session; /** Current plugin. */ private final SQLScriptPlugin _plugin; public CreateDataScriptAction(IApplication app, Resources rsrc, SQLScriptPlugin plugin) { super(app, rsrc); _plugin = plugin; } public void actionPerformed(ActionEvent evt) { if (_session != null) { new CreateDataScriptCommand(_session, _plugin).execute(); } } /** * Set the current session. * * @param session The current session. */ public void setSession(ISession session) { _session = session; } } Col > -----Original Message----- > From: ru...@co... [mailto:ru...@co...] > Sent: Thursday, 5 February 2004 5:04 > To: squ...@li... > Subject: [Squirrel-sql-develop] > app.getActiveSessions()[0].getSQLPanelAPI(this).setEntireSQLSc > ript(strSq > l); > > > In those recently released, horribly alpha quality plugins I > sent, I'm having some issues with this line: > > app.getActiveSessions()[0].getSQLPanelAPI(this).setEntireSQLSc > ript(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).setEntireSQLSc > ript(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 > Squ...@li... > https://lists.sourceforge.net/lists/listinfo/squirrel-sql-develop > |