Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Remove single line comment line breaks in java editor
Remove single line comment line breaks in java editor [message #216053] Sat, 01 October 2005 11:42 Go to next message
Eclipse UserFriend
I use the source formatting of Eclipse quite often but have issues when
I have a multiline comment, format, edit the comment, and then reformat
the comment. The problem is that when allowing Eclipse to reformat a
comment it honors line breaks. So if I have a comment like the following:

// Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In
// at diam. Nunc lacinia, neque sed dapibus convallis, mauris
// arcu vulputate est, in blandit odio mauris quis elit. Duis
// tortor. Sed vitae mauris. Curabitur mattis tincidunt massa.
// Etiam pulvinar, orci congue semper viverra, est quam varius
// sem, vitae interdum ligula turpis.

then remove the first 3 words of the third line:

// Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In
// at diam. Nunc lacinia, neque sed dapibus convallis, mauris
// in blandit odio mauris quis elit. Duis
// tortor. Sed vitae mauris. Curabitur mattis tincidunt massa.
// Etiam pulvinar, orci congue semper viverra, est quam varius
// sem, vitae interdum ligula turpis.

When I reformat I get no change even though I'd like for the fourth line
to fill the available space on line 3.

The question is, is there a way in Eclipse to quickly and easily convert
this back to a one line comment and then reformat? I would think the
reason that it doesn't automatically assume that the comments are a part
of one comment because // is suppose to be a single line comment and
making that assumption could combine separate comment statements. I
guess the other option is to use /* */ for my comments but ctrl+/ is
just way to easy and for some reason // just looks better in my code.

Thanks,
Brad
Re: Remove single line comment line breaks in java editor [message #217411 is a reply to message #216053] Thu, 20 October 2005 08:07 Go to previous message
Eclipse UserFriend
In this scenario you should use multi-line comments, which are correctly
handled by the formatter.

Cheers

Toby

"Brad Reynolds" <bradleyjames@gmail.com> wrote in message
news:dhmapt$gjh$1@news.eclipse.org...
>I use the source formatting of Eclipse quite often but have issues when I
>have a multiline comment, format, edit the comment, and then reformat the
>comment. The problem is that when allowing Eclipse to reformat a comment
>it honors line breaks. So if I have a comment like the following:
>
> // Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In
> // at diam. Nunc lacinia, neque sed dapibus convallis, mauris
> // arcu vulputate est, in blandit odio mauris quis elit. Duis
> // tortor. Sed vitae mauris. Curabitur mattis tincidunt massa.
> // Etiam pulvinar, orci congue semper viverra, est quam varius
> // sem, vitae interdum ligula turpis.
>
> then remove the first 3 words of the third line:
>
> // Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In
> // at diam. Nunc lacinia, neque sed dapibus convallis, mauris
> // in blandit odio mauris quis elit. Duis
> // tortor. Sed vitae mauris. Curabitur mattis tincidunt massa.
> // Etiam pulvinar, orci congue semper viverra, est quam varius
> // sem, vitae interdum ligula turpis.
>
> When I reformat I get no change even though I'd like for the fourth line
> to fill the available space on line 3.
>
> The question is, is there a way in Eclipse to quickly and easily convert
> this back to a one line comment and then reformat? I would think the
> reason that it doesn't automatically assume that the comments are a part
> of one comment because // is suppose to be a single line comment and
> making that assumption could combine separate comment statements. I guess
> the other option is to use /* */ for my comments but ctrl+/ is just way to
> easy and for some reason // just looks better in my code.
>
> Thanks,
> Brad
Previous Topic:How to open a IJavaElement
Next Topic:Jface error in eclipse 3.1.x
Goto Forum:
  


Current Time: Thu Jul 17 06:38:36 EDT 2025

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

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

Back to the top