How to get IDE template path in plugin development?
已回答
As shown in the title, I want to develop a custom Intellij plugin to add some code templates for people. Also, where can I get complete api documentation? Any help would be appreciated.
请先登录再写评论。
U can inspect PathManager.java
I'm using:
Please use com.intellij.ide.fileTemplates.FileTemplateManager to access templates, new ones can registered via extension point com.intellij.ide.fileTemplates.FileTemplateGroupDescriptorFactory
How to add description to FileTemplate?
Add corresponding *.html file next to the *.ft template file
The android templates folder path just like: "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 2016.2.4\plugins\android\lib\templates", how to get it ?
Why do you need to achieve the physical path, what are you trying to achieve?
I created a template for the Android MVP framework, for the convenience of dissemination to other people, I want to develop a android-studio plugin, just click the menu in IDE, than the template file (like globals.xml.ftl, recipe.xml.ftl, template.xml and other ftl file) auto extract to this directory.
Indeed, u don't need physical path, just use API like this:
https://github.com/CeH9/PackageTemplates/blob/master/src/global/utils/templates/FileTemplateHelper.java#L12-L28
and this:
https://github.com/CeH9/PackageTemplates/blob/master/src/global/utils/file/FileWriter.java#L113
But i don't sure that the plugin store templates as FileTemplates.
@Arsen, thanks for your answer, but above is not what I want. Look at the pictures below.
And these templates store in this folder.
How to get the folder path?
Please take a look at com.intellij.ide.fileTemplates.actions.CreateFromTemplateActionBase