Recipe 3.13 Automatically Wrapping Strings

     

3.13.1 Problem

Your text strings are getting too long for the width of the screen, and you're getting tired of scrolling to the ends of the strings to edit them.

3.13.2 Solution

Let Eclipse break the strings for you. Just position the cursor in the quoted text to break, and press Enter.

3.13.3 Discussion

Eclipse handles breaking strings in Java code well. Say you have the following text string:

 String text = "This is a long string of text."; 

You can put the cursor caret in the middle of the string and press Enter; Eclipse will do the right Java thing by splitting up the quoted text like so:

 String text = "This is a long " +     "string of text."; 

You can customize this behavior in the Typing page, which you access by selecting Window Preferences Java Editor Typing.




Eclipse Cookbook
Inside XML (Inside (New Riders))
ISBN: 596007108
EAN: 2147483647
Year: 2006
Pages: 232
Authors: Steve Holzner

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net