Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Line wrapping for long field definitions
Line wrapping for long field definitions [message #484962] Wed, 09 September 2009 19:14 Go to next message
Eclipse UserFriend
Originally posted by: rbrewer.lava.net

Hello. I'm encountering a problem getting Eclipse Galileo to wrap Java
source lines the way I want.

I'm attempting to keep all Java source lines less than 100 characters.
I've configured the maximum line width in Preferences->Java->Code
Style->Formatter->Line Wrapping to 100. I've also changed all the
statement types in the scrolling list to "Wrap only when necessary".
Unfortunately, Eclipse will not wrap lines like this:

private ConcurrentMap<String, ConcurrentMap<XMLGregorianCalendar,
SensorData>> source2SensorDatasHash;

(not sure if the newsgroup will wrap that line or not, but it comes to 105
characters)

Even more frustratingly, if I manually add a line break to that line and
then Format the file (Source->Format), Eclipse happily rejoins the line
for me.

Is there a preference I just haven't found that will allow me to make the
Eclipse formatter wrap lines like the one above, or is this really a
feature request?

Thanks!
Re: Line wrapping for long field definitions [message #485271 is a reply to message #484962] Fri, 11 September 2009 02:07 Go to previous messageGo to next message
Eclipse UserFriend
There is no way right now. https://bugs.eclipse.org/bugs/show_bug.cgi?id=284789 tracks this issue.
Re: Line wrapping for long field definitions [message #505443 is a reply to message #484962] Wed, 30 December 2009 11:45 Go to previous messageGo to next message
Eclipse UserFriend
I see the same problem with method invocations. For example:

TDCR_Ambulate ambulateRecord = new TDCR_Ambulate(TimeMachine.getInstance().getUTCTime(), newAmbulate.getLastItemRcvdTime(), pos, newAmbulate.getItemItem().getName(), newAmbulate.getLastFoundedItemID().toString(), newAmbulate.getOldAmbulationionTime(), newAmbulate.getPnlToday(), newAmbulate.getNumItemsSent(), newAmbulate.getLastAmbulance(), newAmbulate.getNumCadavers(), newAmbulate.getLastTimeOfDeath());


is not wrapped - and if I manually insert a line break... poof: it formats away.

Re: Line wrapping for long field definitions [message #505821 is a reply to message #505443] Tue, 05 January 2010 04:37 Go to previous messageGo to next message
Eclipse UserFriend
Ray Schnitzler wrote:
> I see the same problem with method invocations.
Just make sure you have your formatter preferences set as desired.

Dani
> For example:
>
> TDCR_Ambulate ambulateRecord = new
> TDCR_Ambulate(TimeMachine.getInstance().getUTCTime(),
> newAmbulate.getLastItemRcvdTime(), pos,
> newAmbulate.getItemItem().getName(),
> newAmbulate.getLastFoundedItemID().toString(),
> newAmbulate.getOldAmbulationionTime(), newAmbulate.getPnlToday(),
> newAmbulate.getNumItemsSent(), newAmbulate.getLastAmbulance(),
> newAmbulate.getNumCadavers(), newAmbulate.getLastTimeOfDeath());
>
>
> is not wrapped - and if I manually insert a line break... poof: it
> formats away.
>
>
Re: Line wrapping for long field definitions [message #528532 is a reply to message #484962] Tue, 20 April 2010 15:59 Go to previous message
Eclipse UserFriend
There's currently no line wrapping defined for field declarations (bug 284789 was about method declarations), hence please open an enhancement to ask for it.

Using 3.6, since M5, you have the possibility to do your own formatting on this field declaration and surround it with disabling/enabling tags.
Doing that the formatter will not touch the lines you'll have formatted...

You can setup your own tags to disable and enable the formatter in Preferences->Java->Code Style->Formatter->Off/On Tags tab...
(see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=27079)
Previous Topic:Refactoring
Next Topic:ATG Dynamo 5.6.1 debug in Eclipse 3.0 help!
Goto Forum:
  


Current Time: Thu Mar 27 17:20:08 EDT 2025

Powered by FUDForum. Page generated in 0.03493 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top