Remove

Controls whether and what types of comments should be removed during formatting.

Single-line comments

When enabled, removes all single-line comments found in a source file that matches certain criteria. To customize what single-line comments should be removed, you can use the Customize... button to specify the desired behavior (since 1.1).

Figure 2.63. Configure single-line comment removal

Configure single-line comment removal

You can choose whether all single-comments should be removed or specify a regular expression (regex) to match only certain comments. Note that the regex defines a pattern that is contained in a comment - it must not match exactly.

You can either enter the regex directly into the provided text field or craft one with the help of a little tool that lets you interactively test the validity of your regex. You can invoke the regex helper via the Change... button. Note that the Remove custom radio box must be selected in order to be able to change the regex. The specified regular expression is only matched against the contents of comments, not any surrounding code elements! The regex helper is explained in detail below, see the section called “Regular expression tester” for more information.

Multi-line comments

When enabled, removes all multi-line comments (sometimes called block comments) found in a source file that matches certain criteria. To customize what multi-line comments should be removed, you can use the Customize... button to specify the desired behavior (since 1.1).

Figure 2.64. Configure multi-line comment removal

Configure multi-line comment removal

You can choose whether all multi-comments should be removed or specify a regular expression (regex) to match only certain comments. Note that the regex defines a pattern that is contained in a comment, it must not match exactly.

You can either enter the regex directly into the provided text field or craft one with the help of a little tool that lets you interactively test the validity of your regex. You can invoke the regex dialog via the Change... button. Note that the Remove custom radio box must be selected in order to be able to change the regex. The specified regular expression is only matched against the contents of comments, not any surrounding code elements! The regex tester is explained in detail below, see the section called “Regular expression tester” for more information.

Javadoc comments

When enabled, removes all Javadoc comments found in a source file that matches certain criteria. This may prove useful in conjunction with the Javadoc auto-generation capabilities to build Javadoc from scratch. To customize what Javadoc comments should be removed, you can use the Customize... button to specify the desired behavior (since 1.1).

Figure 2.65. Configure Javadoc comment removal

Configure Javadoc comment removal

You can choose whether all single-comments should be removed or specify a regular expression (regex) to match only certain comments. Note that the regex defines a pattern that is contained in a comment, it must not match exactly.

You can either enter the regex directly into the provided text field or craft one with the help of a little tool that lets you interactively test the validity of your regex. You can invoke the regex dialog via the Change... button. Note that the Remove custom radio box must be selected in order to be able to change the regex. The specified regular expression is only matched against the contents of comments, not any surrounding code elements! The regex tester is explained in detail below, see the section called “Regular expression tester” for more information.

Regular expression tester

The regular expression tester lets you interactively craft a valid regular expression that contains a certain test string.

Figure 2.66. Regular expression tester

Regular expression tester

Regex

The Regex text field is where you have to insert the regular expression. This text field initially contains the current pattern for the comment type that is under construction. Jalopy uses Java’s build-in regular expression engine which is roughly equivalent with Perl 5 regular expressions. The syntax is explained here: http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html. For a more precise description of the behavior of regular expression constructs consult Mastering Regular Expressions [Friedl97].

String

The String text field is where you have to enter a string that should be matched by the specified regular expression. This text field is initially empty. Once you have edited the two text fields you may want to use the Test button to perform a pattern matching test in order to make sure that the specified pattern matches as desired. If testing is successful, a green-colored message appears, to indicate that fact.

Figure 2.67. Successful regex test

Successful regex test

Otherwise a red-colored message is displayed, and you may want to change your pattern and/or test string and restart the procedure.

Figure 2.68. Failed regex test

Failed regex test

When you are done editing the regular expression, you can press the Apply button to take over (note that you are not required to perform any testing, the regex is accepted even when invalid!). You can always use the Cancel button to cancel editing at any time. The dialog will be closed and no changes applied.