pe4enko
pe4enko

Reputation: 354

Eclipse format or clean up changed files

In Intellij Idea I can open Local Changes tab select files and invoke formatting code. How i can do this in Eclipse?

How can I format and clean up ONLY changed files in Eclipse?

I can get list of changed files on "Git Staging" view, but select files on this view don't allow me to invoke Source/Clean Up... or Source/Format operation.

Upvotes: 3

Views: 1616

Answers (2)

Amr Eladawy
Amr Eladawy

Reputation: 4358

  1. Go to Window > Preferences > Java > Editor > Save Actions.
  2. Select Perform the selected actions on save.
  3. Select Format Source code.
  4. Select Format edited lines.
  5. Click Ok, edit some code, save it and watch Eclipse format it automatically.

More Details are here, and also check the official help.

enter image description here

Upvotes: 0

Fabrice TIERCELIN
Fabrice TIERCELIN

Reputation: 983

  1. Select all in Git Staging view
  2. Right-click on the files
  3. Click on Show in > Package explorer <code>Show in</code> > <code>Package explorer</code>
  4. Right-click on the selected files in the Package explorer
  5. Click on Source > Clean Up... ou Format <code>Source</code> > <code>Clean Up...</code>

PS: you can do this for former commits:

  1. Show git history in History
  2. Select your commit
  3. Select all the files on the right
  4. Right-click on the files
  5. Click on Show in > Package explorer
  6. Right-click on the selected files in the Package explorer
  7. Click on Source > Clean Up... ou Format

Upvotes: 1

Related Questions