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);
}
|