Comments

Lets you control the behavior of the separator comments. When the sorting of class elements is enabled, separator comments may be inserted before every element section to make it easier to identify the different parts of a source file.

A separator comment usually starts with a leading //~ followed by the specified description text of a section and a certain number of fill characters to take up the rest of the space. But the style of the comments is fully configurable as well.

Example 2.712. Separator comment

//~ Methods ------------------------------------------------------------------

Figure 2.56. Comments Separator settings page

Comments Separator settings page
Insert

Controls when separator comments should be inserted.

Between sections

Enables the insertion of separator comments between the different code sections of a compilation unit. You can control the appearance of the comments as described in the section called "Separator Comment Descriptions" and the section called "Separator Comment Style".

Example 2.713. Separator comments

public class Foo {

    //~ Static fields/initializers ---------------------------------------

    static final String LABELED_BY_PROPERTY = "labeledBy";

    //~ Instance fields --------------------------------------------------

    private Icon defaultIcon = null;

    //~ Constructors -----------------------------------------------------

    public Foo(String text, Icon icon) {
        ...
    }

    public Foo(String text) {
        ...
    }

    //~ Methods ----------------------------------------------------------

    public Icon getDisabledIcon() {
        ...
    }

    public Icon getIcon() {
        ...
    }

    //~ Inner Classes ----------------------------------------------------

    protected class FooContainer {
      ...
    }
}

Please note that this option requires the "Sort class elements" option to be enabled in order to take effect!

Between sections of inner classes

The insertion of separator comments for inner classes/interfaces may lead to confusion, therefore you can control it here separately.

Example 2.714. Separator comments

public class Foo {

    //~ Static fields/initializers -----------------------------------

    static final String LABELED_BY_PROPERTY = "labeledBy";

    //~ Instance fields ----------------------------------------------

    private Icon defaultIcon = null;

    //~ Constructors -------------------------------------------------

    public Foo(String text, Icon icon) {
        ...
    }

    public Foo(String text) {
        ...
    }

    //~ Methods ------------------------------------------------------

    public Icon getDisabledIcon() {
        ...
    }

    public Icon getIcon() {
        ...
    }

    //~ Inner Classes ------------------------------------------------

    protected class FooContainer {

        public Component getParent() {
            ...
        }

        //~ Methods --------------------------------------------------

        public int getComponentCount() {
            ...
        }
    }
}

Please note that this option requires the "Sort class elements" option to be enabled in order to take effect!

Between methods

When enabled, separator comments are inserted between method declarations.

Since 1.3

Example 2.715. Method comment separator

/**
 * Returns the value of the disabledIcon property if it's been set
 *
 * @return The value of the disabledIcon property.
 */
public Icon getDisabledIcon() {
    ...
}

//~ ----------------------------------------------------------------

/**
 * Return the keycode that indicates a mnemonic key.
 *
 * @return int value for the mnemonic key
 */
public int getDisplayedMnemonic() {
    ...
}

Please note that this option requires the "Sort class elements" option to be enabled in order to take effect!

Between methods of inner classes

When enabled, separator comments are inserted between method declarations of inner classes.

Since 1.7

Example 2.716. Method comment separator of inner classes

public class Foo {

    ...

    static class Item { 

        /**
         * Returns the value of the disabledIcon property if it's been
         * set
         *
         * @return The value of the disabledIcon property.
         */
        public Icon getDisabledIcon() {
            ...
        }

        //~ //////////////////////////////////////////////////////////

        /**
         * Return the keycode that indicates a mnemonic key.
         *
         * @return int value for the mnemonic key
         */
        public int getDisplayedMnemonic() {
            ...
        }
    }
}

Please note that this option requires the "Sort class elements" option to be enabled in order to take effect!