Set a comment template for MyEclipse and a comment template for myeclipse

Source: Internet
Author: User

Set a comment template for MyEclipse and a comment template for myeclipse


Previously, when using Visual Studio, You can automatically generate unified style comments for classes and methods. Since "unified style", you can abstract them into a set of templates. Annotations can also be automatically generated in MyEclipse.


There are only two steps:


1. Set a template


Windows-Preference-Java-Code Style-Code Templates


In the figure, for each annotation type in Configure generated code and comments, you can preview the annotation template in the following Pattern. If you need to modify the template, click edit in the upper-right corner to modify the format.

At the time of modification, the content following @ is the content that needs to be displayed in the original base. The content in $ {} is a system-defined function, which is used to display the type name -- $ {type_name }, displays the current date $ {date}, current time -- $ {time}, custom content -- $ {tags}, and so on.

 

If you select the bottom Automatically add comments for new metnods and types, the Class header annotation is Automatically generated when you create a new class.


2. generate comments in the code


As mentioned above, after setting the template, you can set it to automatically generate comments when creating a class, but the newly added methods, fields, and other fields will not be automatically commented out, manual intervention is required ":

Input /**

In Visual Studio, if it is a C # language, input // in the upper part of the class or method; if it is VB. NET, enter '''. You can generate a set annotation template for the class or method.

In MyEclipse, enter/** in the upper part of the code area (such as a class or method) to be annotated, and press enter to generate a set annotation template for the class or method.


Shortcut Key

If you have a good habit of using shortcuts, This method is of course the best: move the cursor to the top of the Code area (such as a class or method) to be commented out, the shortcut key is Shift + Alt + j.


Generate comments for setter and getter

To Generate multiple setter and getter methods in a class, you can select Generate method comments in the setter and getter generation window to Generate comments:


Finally, we will use the class annotation template in the first chapter to show the annotations automatically added to the class after a class is created:



Feelings: not only do these programming languages communicate with each other, but their existing IDES are similar. They share the same idea and design.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.