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