cancel
Showing results for 
Search instead for 
Did you mean: 

How to format the code?

Former Member
0 Kudos

Hi experts

how can I customize the code formatter (Windows -> Preferences -> Java -> Code Formatter) so that empty spaces are not removed?

I want to format the code like this:

e.g.

int a = 1;

int text = 2;

ind ccSomeThingElse = 3;

but the code fomatter do this:

int a = 1;

int text = 2;

ind ccSomeThingElse = 3;

How can I change this?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

closed

chander_kararia4
Contributor
0 Kudos

Hello SAPUser,

Use the key combination

CtrlShiftF

That will format your code in standard way. Thanks,

By the way, could you explain the difference in the example you have given. I am not getting.

Best Regards

Chander Kararia

Edited by: Chander Kararia on Sep 23, 2009 3:21 PM

Former Member
0 Kudos

The different is that if I write this by my one:

int a = 1;

int text = 2;

ind ccSomeThingElse = 3;

...and press left mouse in nwds and source -> format I get this:

int a = 1;

int text = 2;

ind ccSomeThingElse = 3;

but the code formatter should not delete my empty spaces!

chander_kararia4
Contributor
0 Kudos

Hi SAPUser,

Frankly speaking, still cannot find out what was the difference between the two, they appear to me 100% same.

well, let it be.

You might not be able to do customization on this, but you may add leave white blank lines in between two lines. The formatter does not remove this.

Best Regards

Chander Kararia

Former Member
0 Kudos

Hi,

Yes it is true, both the codes are looking same.

I could not get why are you bothering about the format, if the technical objective is achieved?

Regards

Raghu

Former Member
0 Kudos

Hi,

In NWDS under Windows -> Preferences -> Java -> Code formatter you can change some settings for formatting your code pressing Ctrl-Shift-F.

If you do not like any of the possibilities given here, do not press Ctrl-Shift-F and format your code manually.

Regards,

Alain.

former_member192434
Active Contributor
0 Kudos

probably you need to do it manually, bez we don't have that kind(As suggested above) facility in NWDS