# Source Actions

Source menu commands:

Name | Function | Keyboard Shortcut
Toggle Comment | Comment or uncomment all lines containing the current selection. | Ctrl + /
Add Block Comment | Adds a block comment around all lines containing the current selection. | Ctrl + Shift + /
Remove Block Comment | Removes a block comment from all lines containing the current selection. | Ctrl + Shift + \
Generate Element Comment | Adds a comment to the selected element. See the Code templates preference page to specify the format of the generated comments. Available on types, fields, constructors, and methods. | Alt + Shift + J
Shift Right | Increments the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line. |
Shift Left | Decrements the level of indentation of the currently select lines. Only activated when the selection covers multiple lines or a single whole line. |
Correct Indentation | Corrects the indentation of the lines denoted by the current text selection. | Ctrl + I
Format | Uses the code formatter to format the current text selection. The formatting options are configured on the Code Formatter preference page. | Ctrl + Shift + F
Format Element | Uses the code formatter to format the Java element comprising the current text selection. The Format Element action works on method and type level. The formatting options are configured on the Code Formatter preference page. |
Add Import | Creates an import declaration for a type reference currently selected. If the type reference if qualified, the qualification will be removed if possible. If the referenced type name can not be mapped uniquely to a type of the current project you will be prompted to specify the correct type. Add Import tries to follow the import order as specified in the Organize Import preference page | Ctrl + Shift + M
Organize Imports | Organizes the import declarations in the compilation unit currently open or selected. Unnecessary import declarations are removed, and required import declarations are ordered as specified in the Organize Imports preference page. Organize imports can be executed on incomplete source and will prompt you when a referenced type name can not be mapped uniquely to a type in the current project. You can also organize multiple compilation units by invoking the action on a package or selecting a set of compilation units. | Ctrl + Shift + O
Sort Members | Sorts the members of a type according to the sorting order specified in the Member Sort Order preference page |
Clean Up | Performs various changes in order to clean up your code according to the settings specified in the Clean Up preference page |
Override/Implement Methods | Opens the Override Method dialog that allows you to override or implement a method in the current type. Available on types or on a text selection inside a type. |
Generate Getter and Setter | Opens the Generate Getters and Setters dialog that allows you to create Getters and Setters for fields in the current type. Available on fields and types or on a text selection inside a type. |
Generate Delegate Methods | Opens the Generate Delegate Methods dialog that allows you to create method delegates for fields in the current type. Available on fields and types with fields. |
Generate hashCode() and equals() | Opens the Generate HashCode and Equals dialog that allows you to start and control the generation of hashCode and equals methods in the current type. |
Generate toString() | Opens the Generate toString() dialog that allows you to start and control the generation of a toString() method in the current type. |
Generate Constructor using Fields | Adds constructors which initialize fields for the currently selected types. Available on types, fields or on a text selection inside a type. |
Add Constructor from Superclass | Adds constructors as defined in the super class for the currently selected types. Available on types or on a text selection inside a type. |
Surround With | Surround the selected statements with a code template. Create your own templates on the Template preference page. Further, you can use Expand Selection to from the Edit menu to get a valid selection range. | Alt + Shift + Z
Externalize Strings | Opens the Externalize strings wizard. This wizards allows you to replace all strings in the code by statements accessing a property file. |
Find Broken Externalized Strings | Searches for broken externalized strings in a selected property file, package, project or set of projects. |

Java editor
String externalization
Java development tools (JDT)

Externalizing strings

Java editor
Java editor preferences
Java outline
Views and editors