Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run Eclipse save actions on every file in a project

Tags:

eclipse

We are using Eclipse save actions to strip trailing white-space, organize imports and some rudimentary code formatting. This was not always so, and the project is quite big and old so many times when we edit a file we get a lot of source control changes that are not immediately relevant to the commit. What we often do then is that we commit the formatting without the code change separately and then the code change on top of that.

It would be very convenient to be able to just run the save actions on every Java file in our project and then commit that once and for all, but I haven't been able to figure out a way to do that. How can this be achieved?

like image 443
einarmagnus Avatar asked Jan 21 '14 10:01

einarmagnus


People also ask

How to enable Save Actions in Eclipse?

The Save Actions Preferences page is accessed from Window | Preferences | PHP | Editor | Save Actions . To configure Save Actions: Mark the 'remove trailing whitespace' checkbox to enable the removal of whitespace after every save.

How do I save all in eclipse?

Under preferences General->Workspace, there's an "Save automatically before build" option.


1 Answers

Right click on the project, choose Source -> Clean up... to run the save actions, and under Source you will also have Organize imports and Format.

like image 191
einarmagnus Avatar answered Sep 20 '22 09:09

einarmagnus