Java Format (Text Editor - Options Dialog Box)

   

Provides options for Java source code formatting.

With the Java Format section of the Text editor options you can:

  • Determine if indenting will occur in the editor.

  • Specify the format style for code braces.

  • Specify how various code elements will be indented and aligned.

Options

Indenting

A group of options for determining the type of indentation support for the Text editor. The following is a list of the options available for indentation:

Indentation mode Description
None The Text editor does not automatically add indentation while you are entering code. Text goes to the beginning of the line when a return is entered.
Block The text editor adds indentation but keeps the code on the same indentation level until you change it.
Smart This is the default setting. The Text editor adds indentation and uses the context of the indentation to determine the level automatically.

Separate Smart Indent Actions In Undo List

When this option is selected, Undo commands (accessed by clicking the Undo menu item from the Edit menu or by pressing CTRL+Z on the keyboard) separates the automatic indentation caused by Smart indenting from other keystrokes. This allows you to undo Smart indentation actions without undoing the command that caused the indentation to occur. If the Smart indentation option is not selected, this option is disabled.

Indent Braces With Contained Code

When this option is selected, a brace is indented to be in-line with code that follows the brace. This option is not selected by default.

Format Open Brace

When this option is selected, open brace entries are formatted for you. A list is provided next to this option to allow you to select the style of open brace formatting. The following contains a list of the options for open brace formatting:

Open brace format Description
On separate line When this format is selected, an open brace is automatically positioned on a separate line from the method or code block that the open brace belongs to.
At end of line When this format is selected, an open brace is automatically positioned on the same line as the method or code block that the open brace belongs to.

This option is not selected by default.

Indent Case Labels

When this option is selected, case labels are indented within the case's switch block. This option is not selected by default.

Align Operands In Multi-Line Expressions

When this option is selected, the operands in a multi-line expression are aligned one below the other. For example:

      int total += var1 + var2
                        + var3
                        + var4;

When not selected, continuation lines are indented by one additional tab stop. This option is selected by default.

Align Parameters

When this option is selected, the parameters in a multi-line method declaration or call are aligned with the first parameter in each line of the declaration or call. For example:

      public native void method1 (String arg1, String arg2
                                  String arg3,
                                  String arg4);

When not selected, continuation lines are indented by one additional tab stop. This option is selected by default