Reputation: 4649
As we know IntelliJ support code template
Settings path: Editor > Code Style > File and Code Templates
it's easy to generate some default file header comments via the IntelliJ predefined variables,
${PACKAGE_NAME} name of the package in which the new file is created
${USER} current user system login name
${DATE} current system date
${TIME} current system time
etc ...
My question is how to generate current class file full name while creating new file? e.g.
/**
* Created on 1/11/15.
* Class: MyApp.java
*/
Upvotes: 1
Views: 2901
Reputation: 97148
Change the Class template to something like this:
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
/**
* Created on ${DATE}.
* Class: ${NAME}.java
*/
public class ${NAME} {
}
(As a personal remark, I don't see any use in that, because when you open a file, you already know its name; there is no reason to duplicate this information in the comment.)
Upvotes: 1