epic_antihero
epic_antihero

Reputation: 862

Eclipse code formatter: Perform a single action

How can I perform a single action in Eclipse Java code formatter? For example I want to clean up every occurrence of

if (bla) {
...
}
else {
...
}

To this

if (bla) {
...
} else {
...
}

But nothing else. I need this to clean up specific findbugs issues. If I'd run the whole code formatter actions on the project, it would lead us into merge hell. So I want to handle such findbugs issues one by one and therefore It would be great to just execute such a single rule. The Version of Eclipse wouldn't matter, right now I tried with the latest Luna.

Upvotes: 0

Views: 50

Answers (1)

Chetan Kinger
Chetan Kinger

Reputation: 15212

A quick way to do this would be to use the search and replace option in eclipse. Go to Search menu->File

Search for : \}\s+\n\s+else\s+\{

Replace with : } else {

Upvotes: 1

Related Questions