|
Sometimes you will want to enable/disable select comments. In some cases, you will want to change the attributes of certain comments. This chapter tells you how to customize JStyle comment generation to suit your project. Enabling and Disabling Comments It is possible to exclude certain comments from being used by JStyle. It is also possible to exclude a set of files for commenting, even if they are part of the current project. Select Settings->Comment Generation (CTRL+M) from the main menu. This pops up a dialog as shown below:
Fig. 3.1 The Module Select tab allows you to specify the names of files to be included for commenting. Selected files appear at the bottom of the display. The Comment Select tab is useful for excluding some comments from the commenting process. See the figure below.
Fig. 3.2 This dialog provides a convenient means of selecting the comments to be included for commenting. To select a comment, click in the corresponding check box. Double clicking on a column header groups comments as per that column and displays them in ascending/descending order. After making the necessary changes click OK button. The new settings will be effective from the next cycle of comment generation. A similar dialog appears for Report Generation settings. The options that you specify in this dialog will be used during the report generation phase. Changing the Attributes of Comments Some comments are customizable. Take the example of class prefix string. Your company might follow a naming convention that says that names of all classes must begin with a string ZZ_. This prefix string might vary from project to project and from one company to another. Another example is the order in which class members are declared. One company might use a rule that private members must appear before public members, whereas in another company the rule might be exactly the reverse. See the figure below.
Fig. 3.3 Javadoc Comments Javadoc comments with well-defined tags have become a part of professional Java programming. JStyle makes it possible for you to enforce Javadoc comments at class, method and field level. Select Settings->Java Doc Comment from the main menu. The following dialog appears:
Fig. 3.4 For each category, you can specify the tag that must be found in the source. JStyle recognizes a class comment as the comment preceding the class definition. Similarly a method comment precedes a method and field comment precedes a field. For the respective category, JStyle checks for the existence of the tags selected in the settings dialog.
|