Naming

Lets you specify the naming constraints for different Java source file elements. These constraints are naturally expressed with regular expressions. Note that you have to enable both the Code Inspector and the naming convention check in order to see naming checks performed. See the section called “Adhere to custom naming conventions” for more information.

Figure 2.98. Code Inspector Naming settings page

Code Inspector Naming settings page

The list component displays all provided naming checks along with their current regular expression.

Selecting an item in the list and either pressing the Edit... button or double-clicking the item will open a dialog that lets you change the regular expression.

Change Naming Pattern

The Change Naming Pattern dialog lets you interactively craft a valid regular expression for a naming check.

Figure 2.99. Change Naming Pattern

Change Naming Pattern

Regex

The Regex text field is where you have to insert the regular expression. This text field initially contains the current pattern for the list item 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]. The defined pattern must match exactly.

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.

Test

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 regex matches as desired. You will be informed about the match status and can decide whether you want to alter your pattern and/or test string and restart the procedure.

Figure 2.100. Successful regex test

Successful regex test

Figure 2.101. Failed regex test

Failed regex test

Change

If you are finished editing the regular expression, you can press the Change button to take over.

Cancel

You can always use the Cancel button to cancel editing at any time. The dialog will be closed and no changes applied to the list.