You can invoke the Reformat Code action (Ctrl+Alt+L by default, I think) from the Project view. This will cause all files under the currently selected item to be reformatted. So you just need to do this when the root project node is selected, in order to achieve what you want.