Idea uses live template to add groovy scripts to methods, classes, JS methods to add comments (reproduced)

Source: Internet
Author: User
Tags groovy script

Idea Add live Template:

File->setting->editor->live Templates

Abbreviation:

*

Template text:

* * $context $ */  

Set context content:

Edit variables->default Value

Groovyscript ("c:\\ideacommentlivetemplate.groovy", Currentpackage (), ClassName (), MethodName (), Jsmethodname (), Methodparameters (), Methodreturntype (), Date ("yyyy-mm-dd" ), Time ("HH:mm:ss"))

Ideacommentlivetemplate.groovy Script content:

def packagename = _1;def ClassName = _2;def MethodName = _3;def Jsmethodname = _4;def methodparameters = _5;def Methodretu Rntype = _6;def Date = _7;def time = _8;//fixed, the default is falsedef confirmeddatetime = false;def confirmeddatetimestring = "201 7-06-15 12:20:40 ";//Can be modified to its own relevant information def author =" YZ ";d ef projectName =" ";d EF Version =" V1.0.0 ";d ef copyright =" YZ All rig HTS reserved. "; def outputparams = ""; for (param in methodparameters) {outputparams + = "* @param" + param + ": \ n";} def outputreturntype = "", if (methodreturntype! = "void") {outputreturntype = "* @return:" + methodreturntype + "\ n ";} def outputmethodname = "* @Method:" + methodName + "\ n";d ef outputdesc = "* @Description: \ n"  ;d EF outputauthor = "* @author:" + author + "\ n";d ef outputdatetime = "* @CreateDate:" + Date  + "" + Time + "\ n", if (confirmeddatetime) {outputdatetime = "* @CreateDate:" + confirmeddatetimestring + "\ n";} def OutputproJectname = "* @Project:" + projectName + "\ n";d ef outputpackagename = "* @Package:" + PackageName + "\ N ";d EF outputclass =" * @Class: "+ className +" \ n ";d ef outputversion =" * @version: "+ ve Rsion + "\ n";d ef outputclassotherinfo = "* @Copyright:" + Copyright + "\ n"; Outputclassotherinfo + = "* @Review       Ed: "+" \ n "; Outputclassotherinfo + =" * @UpateLog: Name Date reason/contents\n "; outputclassotherinfo    + = "*---------------------------------------\ n"; Outputclassotherinfo + = * * * * * * *  \ n ";d ef outputjsmethodname =" * @Method: "+ jsmethodname +" \ n ";d ef outputjsparams =" * @param \ n ";d ef outputjsreturntype =" * @return: \ n ";d ef result ="; result + = "\ n"; if (methodName) {result +    = Outputmethodname;    result + = Outputdesc;    result + = Outputparams;    result + = Outputreturntype;    result + = Outputauthor; Result + = outPutdatetime;}    else if (jsmethodname) {result + = Outputjsmethodname;    result + = Outputdesc;    result + = Outputjsparams;    result + = Outputjsreturntype;    result + = Outputauthor; result + = Outputdatetime;}    else {result + = Outputprojectname;    result + = Outputpackagename;    result + = Outputclass;    result + = Outputdesc;    result + = Outputauthor;    result + = Outputdatetime;    result + = Outputversion; result + = Outputclassotherinfo;} Result + = "*"; return result;

Set up Apps

Content reprinted from: http://www.cnblogs.com/xzjxylophone/p/7060035.html

Idea uses live template to add groovy scripts to methods, classes, JS methods to add comments (reproduced)

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.