IntelliJ Platform Plugin SDK
 
IntelliJ Platform Explorer

Using File Templates Programmatically

Edit pageLast modified: 14 May 2024

File templates provided by a plugin can be used during new file creation, in code intention actions, or other plugin features. They can be accessed with the FileTemplateManager service providing methods returning all or single file templates from a given category. For example, to obtain a template from the Code category, pass its name to the getCodeTemplate() method (notice the lack of the .ft extension):

To render a template content, prepare and pass Properties object to the getText() method: