Eclipse Code Cleanup Code formatting code comments

Source: Internet
Author: User

The code style consists of two aspects: cleanup, code normalization. Code cleanup can be consulted:

http://www.ibm.com/developerworks/cn/opensource/os-eclipse-clean/

Code cleanup Process:

Go to Eclipse menu: Window > Preferences > Java > Code Style > Clean up, click Import above the interface, select the Eclipse installation in the popup box

Eclipse/cleanup-profile.xml under the path, click

Open, click Apply in the lower right corner to make it effective.

Code formatting process:

Go to Eclipse menu: Window > Preferences > Java > Code Style > Formatter, import eclipse/formatter-profile.xml using a method similar to the above, and

Make it effective.

Set the implementation time for code formatting, which is usually automatically formatted when saved:

Go to Eclipse menu: Window > Preferences > Java > Editor > Save Actions, tick on perform the selected actions under Save for Mat

source code, and select Format all lines, tick on organize imports, click Apply in the lower right corner to make it effective.

Add comments in Eclipse

(1) Add a comment to the method:

On the top line of the method,/**, then enter.

(2) Add comments to the file header:

Use shortcut keys to alt+shift+j. The added annotation format can be modified by opening the parameter Settings panel from the menu window->preference and selecting: Java-

Code Style, Code Templates, select Comments on the right, select the types entry, and then choose Edit on the right to enter the editing mode. Enter edit mode

Custom annotations can be customized. You can also insert some variables, such as year, date, and so on. Finally, make sure that the Code-and New Java files

There are: "${filecomment}".


If you do not find Cleanup-profile.xml and formatter-profile.xml, you can search the Internet for a bit.

A template for the company now:

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.