Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Is Line Break the only difference between "Correct Indentation" and "Format"(Trying to verify my understanding so far)
Is Line Break the only difference between "Correct Indentation" and "Format" [message #662412] Wed, 30 March 2011 15:06 Go to next message
androidev is currently offline androidevFriend
Messages: 15
Registered: August 2010
Junior Member
I still consider myself an Eclipse newbie. It's HUGE and I am learning new things every day... Cool

I just discovered the wonders of 'Context menu > Source > Format' and 'Context menu > Source > Correct Indentation' and my observation is that the only difference is that 'Format' breaks lines that are longer than some setting while 'Correct Indentation' doesn't.

Are there any other differences that I missed?
Re: Is Line Break the only difference between "Correct Indentation" and "Format" [message #662465 is a reply to message #662412] Wed, 30 March 2011 17:36 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 30-Mar-11 09:06, androidev@gmx.com wrote:
> I still consider myself an Eclipse newbie. It's HUGE and I am learning
> new things every day... 8)
> I just discovered the wonders of 'Context menu > Source > Format' and
> 'Context menu > Source > Correct Indentation' and my observation is that
> the only difference is that 'Format' breaks lines that are longer than
> some setting while 'Correct Indentation' doesn't.
>
> Are there any other differences that I missed?

I'm not completely certain what you're after here, but I'll take a stab.

In Preferences -> Java -> Code Style -> Formatter, you can change the
default way source code is formatted by shipping Eclipse, save those
changes to an XML file of your own, and/or import your own or another's
saved file.

Then, when you do [ Context menu -> ] Source -> Format, that fixes up
the file (or, if "context menu", the highlighted block) to conform to
the code style in force.

So, what happens when you choose to "reformat" your code depends on a)
what the source code looked like to begin with and b) what the
formatting rules in effect have to say about it.

I use this feature because, like many, I have religious preferences and,
unlike most, what Eclipse ships with doesn't come close to what I want.
When I collaborate, however, I don't change any formatting because that
wrecks havoc in whatever source code-control system I'm using.

Is this helpful?
Re: Is Line Break the only difference between "Correct Indentation" and "Format" [message #662609 is a reply to message #662412] Thu, 31 March 2011 09:35 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 30.03.2011 17:06, androidev@gmx.com wrote:
> I still consider myself an Eclipse newbie. It's HUGE and I am learning
> new things every day... 8)
> I just discovered the wonders of 'Context menu > Source > Format' and
> 'Context menu > Source > Correct Indentation' and my observation is
> that the only difference is that 'Format' breaks lines that are longer
> than some setting while 'Correct Indentation' doesn't.
'Format' can also un-break lines depending on your formatter settings.

Dani
>
> Are there any other differences that I missed?
>
Previous Topic:eclipse not running .java file
Next Topic:Using gdb
Goto Forum:
  


Current Time: Thu Apr 25 13:49:22 GMT 2024

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

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

Back to the top