Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse code formatter: how to remove its effects?

Tags:

java

eclipse

for a mistake i've made eclipse v. 3.4.2 formatting my sourcecode on a single class file. That's really confusing, how can i restore my own original text format?

like image 229
mark Avatar asked Mar 29 '13 21:03

mark


People also ask

What is clean up in Eclipse?

Unnecessary Code Select an application where you want to apply the newly created profile (JBT). Right-click on it and go to Source >> Clean Up. A window will appear as below. Select Project and Profile and click “Finish”. Now you know how to clean up your code with the help of Eclipse.

What is @formatter off?

Eclipse 3.6 allows you to turn off formatting by placing a special comment, like // @formatter:off ... // @formatter:on. The on/off features have to be turned "on" in Eclipse preferences: Java > Code Style > Formatter . Click on Edit , Off/On Tags , enable Enable Off/On tags .


1 Answers

The simplest approach is probably to use Eclipse's Local History. On the context menu for the file, select "Restore from local history." If it's not in the local history, you may need to go back to the previous version in source control... (I assume you're using source control. If you're not, I strongly urge you to do so, right away.)

Of course, another option if you've still got the file open is just to press Ctrl-Z to undo actions - keep doing that until the formatting goes away :)

like image 81
Jon Skeet Avatar answered Oct 05 '22 14:10

Jon Skeet