I've invested a fair amount of time creating a code style profile in Eclipse which matches our persnickety code standard. Is there a way to apply this style en masse to many files at once, so I don't have to manually load/format/save each in turn?
+3
A:
You can select multiple files in one of the navigator views and use the "Source > Format" menu option to format them all at once. You can also set up the "Source > Clean Up..." action to format in addition to other cleanup actions.
Mike Daniels
2010-10-16 18:11:45
Correct! For future changes, you can also make a save action that cleans up the code during each save: "Preferences > Java > Editor > Save Actions"
kraftan
2010-10-16 20:00:23
Perfect. Thanks!
Stabledog
2010-10-17 02:19:35
Oddly, when I select multiple files (or even one file!) in the project view, all of the Source menu options are greyed out except "Surround with". Am I failing to understand something?
Stabledog
2010-10-17 03:38:16
@Stabledog, that's odd. Is the editor in focus? Make sure the package/project/whatever explorer is in focus.
Mike Daniels
2010-10-17 03:41:11
Well it's like this: if I select the files in the project tree, the menus are disabled. If I load a file into the editor, select the files in the tree, and then click in the edit window to re-focus, the tree files stay selected, and the menus are enabled. But when I say Source > Format, only the editor file gets treated. If I put the focus back into the tree and re-select the files, the menus go grey again.
Stabledog
2010-10-17 04:09:58
@Stabledog, OK, I see what's happening. The "Project Explorer" context doesn't have the "Source" menu. The "Package Explorer" context does. You'll have to use the "Package Explorer" view instead of the "Project Explorer" in order to invoke this feature.
Mike Daniels
2010-10-17 04:13:55
Ah. I think that might be a Java-specific view. I don't see any Package Explorer available for C++ :(
Stabledog
2010-10-17 14:42:35