Paste a multi-line Java String in Eclipse

eclipse, java, multiline, multilinestring

Solution

Okay, I just found the answer (on Stackoverflow, no less).

Eclipse has an option so that copy-paste of multi-line text into String literals will result in quoted newlines:

Preferences/Java/Editor/Typing/ "Escape text when pasting into a string literal"

Problem

Unfortunately, Java has no syntax for multi-line string literals. No problem if the IDE makes it easy to work with constructs like ``` String x = "CREATE TABLE TEST ( \n" + "A INTEGER NOT NULL PRIMARY KEY, \n" ... ``` What is the fastest way to paste a multi-line String from the clipboard into Java source using Eclipse (in a way that it automatically creates code like the above).

Original source

Related problems