Surround with quotation marks

Solution 1:

Maybe this is not what you mean but...

If I'm on a line in Eclipse and I enter double quotation marks, then inside that paste a multiline selection (like your xyz example) it will paste out like this:

"xxxx\n" +   
"yyyy\n" +  
"zzz"

Then you could just find/replace in a selection for "\n" to "", if you didn't intend the newlines.

I think the option to enable this is in Window/Preferences, under Java/Editor/Typing/, check the box next to "Escape text when pasting into a string literal". (Eclipse 3.4 Ganymede)

Solution 2:

Find/Replace with the regex option turned on. Find:

^(.*)$

Replace with:

"$1" +

Well, the last line will have a surplus +, you have to delete it manually.