In the daily development process in the company, in addition to the need to adhere to the unified coding specifications, but also to write code to do a uniform format,Eclipse provides a format encoding tool, shortcut key is:ctrl+shift+f.
To unify the code style of a project group, it is recommended to use a uniform format profile.
Eclipse supports our custom templates, such as file annotations, class annotations, function annotations, and more. Eclipse has its own template, and we can define it ourselves.
Click:windows-"preference-"java-"code style-"code template, popup the interface shown
Import the custom template by clicking on the Import button, and after the import is successful, review the results in the preview below.
Also select the code template on the left.
Test: Create a new class, such as, be sure to tick generate comments, see the class comments, formatting effects!
2 template references are available:
Format.xml
Datatemplate.xml
Coding style in unified projects (Eclipse Java code format, codetemplate)