Source actions
Source menu commands:
Name
Function
Keyboard Shortcut Comment
Comments out all lines containing the current selection.
Ctrl + / Uncomment
Uncomments all lines containing the current selection.
Ctrl + \ 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.
Tab 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.
Shift + Tab Format
Uses the code formatter to format the current text selection. The formatting options are configured on the Code Formatter preference page (Window > Preferences > Java > Code Formatter)
Ctrl + Shift + F Sort Members
Sorts the members of a type according to the sorting order specified in (Window > Preferences > Java > Appearance > Members Sort Order)
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 Import preference page (Window > Preferences > Java > Organize Import). Organize import 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 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 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 Getter and Setter dialog that allows you to create Getter 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. Add Constructor from Superclass For the currently selected type adds constructors as defined in the super class. Available on types or on a text selection inside a type. Surround with try/catch For the selected statements all exception that have to be caught are evaluated. A try catch block is created around these expressions. You can use Expand Selection to from the Edit menu to get a valid selection range. 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 Strings to Externalize Shows a dialog presenting a summary of number of strings not externalized. Available on projects, source folders and packages. Convert Line Delimiters To Changes all line delimiter in the currently open editor to use line delimiters as used in the following operating systems :
- CRLF (Windows)
- LF (Unix, MacOS X)
- CR (Classic MacOS)
The Java editor is tolerant for a mixed usage of line delimiters. However, many other tools require an OS conform usage of line delimiters or at least line delimiter consistency.
Java editor
String externalization
Java development tools (JDT)
Using the Java editor
Externalizing Strings
Java editor
Java editor preferences
Outline view for Java
Views and editors