Friday, January 25, 2008

NetBeans plugin for copying text between Java and SQL/XML/HTML/...

You've been there: you want to write a SQL query, test it, and then paste it into Java. But Java requires a string that is concatenated with '+' for readability. What a pain to have to go back and forth between the query editor and the Java editor.

Wade Chandler (our hero again) has written a nice plugin that let's you convert back and forth between "Java-style" string-concatenated text and "plain style" of SQL and other plain text editors. Wade explains this more in this email.

Here's an example. I start with a nice long query in the query editor that does what I want it to do...

SqlEditor.jpg

Then I use Wade's plugin to paste into Java:

JavaCopyAndPaste1.jpg

et voila!

PastedText.jpg

2 comments:

Lance Andersen said...

David, This would be a great to see this or something similar integrated into Netbeans...

thanks for sharing.

Unknown said...

Hi, Lance. Yes, I know, it would be cool. Take a look at these specs
I put together.

http://wiki.netbeans.org/TestQuerySpec
http://wiki.netbeans.org/SQLCompleteInCodeEditor

I want to get this in soon, but have to prioritize with other
features. I hope to use Wade's work as a base for the TestQuery
feature.

Dear readers: feel free to post comments on the specs to the bottom of the spec pages.

David