Is there a way to change “all” Java related “File and Code” Templates in ONE place?

柔情痞子 提交于 2020-02-25 06:09:31

问题


By convention, our java files need our company copyright header as first entry in the file.

With IntelliJ, you can turn to Preferences->File and Code Templates, and then, in the Includes tab, there is an entry "File Header" where you can drop such copyright information. All fine.

But: in the "Files" list that defines the various applicable "types", each type has its own "rule", like:

As you can see, that "rule" puts the package name first, so I have to go and change that rule to:

#parse("File Header.java")
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
public class ${NAME} {
}

But, as said: there are multiple "types" that need the very same setup (Class, Interface, Enum, Annotation).

Is there a way to have all Java-related "types" use the same rule, without me going in and updating each entry manually, individually?

来源:https://stackoverflow.com/questions/57375531/is-there-a-way-to-change-all-java-related-file-and-code-templates-in-one-pla

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!