Is there any way to run the Eclipse cleanup rules on a whole set of classes/packages instead of individual classes?
(Preferences > Java > Code Style > Clean Up)
I right-click on the class and invoke Source-Clean Up, but it sure would be nice to invoke it on a set of classes.
I'm not sure from your question if you're right clicking in the Editor or in one of the other views. However, if you select multiple multiple source files or folders in the Package Explorer you can right click in the Package Explorer and do Source -> Clean Up. The title in the first page of the Clean Up wizard should indicate how many files are going to be cleaned (e.g. "Cleaning up 20 files in 1 project")
I suspect what you really want to do is apply a "code cleanup" to ALL of your java source files, not just ones that you selected manually.
Here's how:
1) In the Packages view (or the Package Explorer view) change your "Package Presentation" from "hierarchical" to "flat". There's a little upside down triangle in the top right corner of each view that lets you change this setting.
2) Now when you navigate to your source code directory you should see ALL the packages and sub packages and sub sub packages that contain your java source files, all presented together in one (possibly huge) list.
3) Of course, when you have a huge list like this, you can easily select all the packages (left-click the first one, then shift left-click the last one).
4) Then, right click on the selection, and go to "Source->Clean Up..." (or any other "Source" submenu item, like "Organize Imports") and the dialog that pops up will tell you how many source files it is about to change.
Hope that helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With