I am working on a Java project where code was written by different programmers. There are about 50 packages with 1-10 classes per package.
In some code, the methods and if statements, for example, are declared as follows –
public void setValue(int value) {
this.value = value;
}
if(value==0) {
System.out.println("value is 0");
}
And in other code, the methods and if statements, for example, are declared as follows-
public void setValue(int value)
{
this.value = value;
}
if(value==0)
{
System.out.println("value is 0");
}
The difference is in the alignment of parenthesis. Is it possible in Eclipse to at once change all of the former types of alignments into the latter?
First configure the Formatter:
Then apply the format to a class selecting the code and doing:
You can do it over all classes in a package or source folder doing right click over the element and selecting: