Eclipse Automatic completion function and Automatic Generation of author, date annotation and other function settings
I used to add code author information, but I don't know how to implement it. Today I finally found a solution on the Internet.
Eclipse automatically generates author, date comments, and other function settings
When you use Eclipse to write Java code, the automatically generated annotation information is generated according to the preset format.
Modify author and date annotation formats: choose Windows> Preferences> Java> Code Style> Code Templates, and click Comments in the window on the right. You can see many options, you can edit the annotation template.
For example, we want to set the author information and date information at the beginning of a Java file.
Select Types and click Edit to set
/**
* @ Author $ {user}
* $ {Tags}
*/
Change $ {user} to the name you want to display. Delete $ {tags}, click Insert Variable, and select Date. The Date information is automatically generated. Click Sources-> Ganarate Element Comment where you want to add comments, or use the shortcut key Alt + Shift + J, eclipse automatically adds comments to the class.
The annotations are as follows:
File annotation Tag:
/**
*
Title: $ {file_name}
*
Description:
*
Copyright: Copyright (c) 2007
*
Company: LTGames
* @ Author linrz
* @ Date $ {date}
* @ Version 1.0
*/
Type annotation label (class annotation ):
/**
*
Title: $ {type_name}
*
Description:
*
Company: LTGames
* @ Author linrz
* @ Date $ {date}
*/
Field annotation label:
/** $ {Field }*/
Constructor Tag:
/**
*
Title:
*
Description:
* $ {Tags}
*/
Method label:
/**
*
Title: $ {enclosing_method}
*
Description:
* $ {Tags}
*/
Override method label:
/* (Non-Javadoc)
*
Title: $ {enclosing_method}
*
Description:
* $ {Tags}
* $ {See_to_overridden}
*/
Method label:
/**
* $ {Tags}
* $ {See_to_target}
*/
Getter method label:
/**
* @ Return $ {bare_field_name}
*/
Setter method label:
/**
* @ Param $ {param} the $ {bare_field_name} To be set}
*/
Eclipse auto-completion full-function settingsBy default, a code prompt is displayed when you type ".". Otherwise, you can only press "Alt +. You can use the following settings to display code prompts as needed.
1) directly set
Open Eclipse-> Window-> Perferences-> Java-> Editor-> Content Assist. An Auto activation triggersor for Java option appears on the right, only one ". "exists. Indicates that only the input ". "Then there will be code prompts, this is the place to modify, we directly in". ", enter" abcdefghigklmnopqrstuvwxyz ". "or any letter will prompt the code. If you are not addicted, enter "0123456789" or
May use characters such as "_", and click "OK.
2) implemented through the Import and Export file functions of Eclipse
Open File-> Export-> General-> Preferences, click "next", check "Export all", select the Save path, and finish. Use NotePad to open the exported file with the suffix ". epf.
[Html]View plaincopy
- /Instance/com. android. ide. eclipse. ddms/emulatorControl. track. name = 141
- /Instance/com. android. ide. eclipse. ddms/threadPanel. stack. col4 = 51
- /Instance/org. eclipse. jdt. ui/content_assist_autoactivation_triggers_java =.
- /Instance/com. android. ide. eclipse. ddms/threadPanel. stack. col3 = 49
- /Instance/com. android. ide. eclipse. ddms/threadPanel. stack. col2 = 350
- /Instance/com. android. ide. eclipse. ddms/threadPanel. stack. col1 = 121
The last "." In the third line above is the place to be modified. You only need to enter the characters you want to enter after. Save the changes and Open File> Import> General-
> Preferences: select the file you modified and check "Import all", and click "finish.
You can also set other parameters as needed.