Create new file

Hi,

 

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 (https://www.jetbrains.org/intellij/sdk/docs/tutorials/live_templates.html) but the docs for file templates doesn't exists.

 

Thx.

 

0
3 comments

You can add additional file templates via FileTemplateGroupDescriptorFactory.

0

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?

0

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.

1

Please sign in to leave a comment.