Open the context menu of the project -> Properties -> Java Code Style -> Formatter. Check "Enable Project specific settings" and configure the profile.
All the important Java related settings are available on a per project base and you should never modify Java related settings through Window -> Preferences, if you share the project with others. Project properties are saved in your project (and therefore shared with all), preferences are stored far away and unrelated to your project.