Eclipse Tips and Tricks

Generating constructors

  1. Right click in the editor window. Select Source → Generate constructors using fields.
  2. Select the fields to be initialised in the constructor.
  3. Click the checkbox to Omit the 'super' call to parent class.
  4. Click finish.

Generate Constructor

Code Formatting

  1. Go to Window→Preferences→Java→Code Style→Formatter
  2. Click on 'New' button to create a new customized profile. Enter the profile name.
  3. Check the general settings under the indentation tab. You can set a tab policy and Tab size.
  4. Under the 'Braces' tab, you can select the brace positions such as on the same line, the next line, etc. for various declarations, including method declaration, constructor declaration etc.

Code Formatter