How to automatically add comments and custom annotation styles in eclipse

Source: Internet
Author: User
Tags comments doxygen

In any project, the annotations are indispensable, the type and style of annotations are very many, each company has its own set of standards, the medium and large projects are generally written in order to automatically generate documents easy maintenance, such as Java with the Javadoc, More powerful features use a wider range of Doxygen (Doxygen automated document generation tools for integration and use in eclipse), and more. The task of the annotation is actually very heavy, always thought oneself is doing the meaningless thing, each repetition writes the unified annotation style to be time-consuming laborious. Eclipse is very familiar to know that some of the annotation style in eclipse, but does not necessarily apply to your standards, so how to customize the annotation style and then automatically add it seems very meaningful, let us save time and effort.

1. How to automatically add comments

There are three ways to automatically add comments:

(1) Enter "/**" and return.

(2) Alt+shift+j with shortcut keys (select a method, class name, or variable name first).

(3) Select "Source > Generate elementcomment" In the right-click menu.

2. How to customize the annotation style

Note formats that you don't necessarily like or do not conform to your company's standards, you can do so through the following methods to modify.

(1) window->preference Open the parameter Setup Panel and select: Java-> Code Style-> codetemplates

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Java/

You can see the following series of comments Java code components (for files, variables, methods, constructs, overloaded functions, and so on), such as I want to customize the annotation style of the Java file, then select the file item in comments on the right, click Edit to enter edit mode So that you can customize the annotation. You can insert variables such as date, file name, author, and so on.

>

3. Import/Export Code format template

If you have worked hard to customize your code style, and then changed machines to operate or reload eclipse, do you want to reconfigure it again? The answer, of course, is no, and Eclipse provides the export and import features, and you can export your own templates for use on other machines.

Author: csdn Blog Lanxuezaipiao

Related Article

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.