Formatting files or portions of code
To format Java code:
-
Use the Code Formatting Preferences page (Window > Preferences > Java > Code Style > Formatter) to
specify your preferences for code formatting.
-
Open a Java file and select the code you want to format. If nothing is selected, then all of the editor content is formatted.
-
Format the code by either
-
Selecting Source > Format from the editor's pop-up menu or
-
Pressing Ctrl+Shift+F or
-
Selecting Source > Format from the menu bar.
Java development tools (JDT)
Java editor
Using the Java editor
Formatting Java code
Setting code formatting preferences
Source menu
Code Formatter preferences