Create new file



I would like to create new file with a custom file template.

What is the best way to do this. For example, the PHP plugin can create file with file template.


In a custom plugin, it's the best way too?

It's possible to create custom code template in a plugin and hide them in the settings Code templates section?


There is a doc about live template ( but the docs for file templates doesn't exists.





You can add additional file templates via FileTemplateGroupDescriptorFactory.


Thank you. And how to hide them in the settings preferences? (if it's possible)l

By the way, it's possible to create a folder in the code template which contains the code templates?


Can I create a file or mulitple files with PSI without file templates?


The file templates are a good idea but I do not want to allow templates to be deleted by the user in the settings > File and code templates section.


I want to create multiple file from a different template and replace the variable in these files.


The purpose of my demand is too create a new file like the New PHP class dialog (get the namespace context of my position in the project tree view,...)

So I need to create a dialog after the click on an AnAction and create the file in the disk.


Please sign in to leave a comment.