java - More compact Eclipse autocomplete code -
eclipse great in suggesting standard pieces of code when needed , helping in autocompleting hints code.
for example, in adt, if write piece of code:
runnable r = new
if press ctrl-space get, automatically:
runnable r = new runnable() { @override public void run() { // todo auto-generated method stub } };
it's fantastic! generally, after this, spend little of time compact waste of space , make this:
runnable r = new runnable() { @override public void run() { }};
now question is: there way instruct eclipse make more compact code, similar latest one? there option, or there code can change?
obviously example, not complaining runnable() autocomplete code in itself, , it's not complain, eclipse behave differently in any similar case.
thank you
you can following 2 steps:
step 1
create java formatting rules.
to edit code formatting style go preferences> java> code style> formatting. starting built in style create own.
in particular may interested in new lines, blank lines , control statement tabs have liberty of changing many settings.
step 2.
go preferences> java> editor> save actions , enable perform selected actions on save , check format source code.
formatting immediately:
in case don't want wait save command apply format:
- any java template can inserted in editor formatting rules applied. make sure use code formatter checked every template. best solution question
- you can apply formatting ctrl+shift+f
- you can force save all when building, practically, every time build, format.
Comments
Post a Comment