FileTemplates and fileTemplateManager Follow
Hi there!
I'm trying to delevop a simple IntelliJ IDEA plugin that will create different classes to skip boilerplating.
Once my fileTemplates are correctly registered with the FileTemplateGroupDescriptorFactory and plugin.xml and when I'm trying to get the file template like this :
final FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance();
FileTemplate fileTemplate = fileTemplateManager.getJ2eeTemplate(templateName);
the second line keeps returning me : template not found when I run the plugin action.
Note : when I go in File>Settings>FileTemplate>"MyTemplateGroup">templateName, the fileTemplate exists but the body is empty.
Please sign in to leave a comment.
Please make sure that *.ft is includes in Settings | Compiler | Resource file patterns.
Already done..!
I currently do this like the following code and it seems to work but I know that this isn't the clear way to do this. I still don't understand why the body of my J2ee templates are empty after registering.
It seems to work but the getJ2eeTemplate still throws : template not found
Once this part of the action is exectuded, a new template appear in the Settings>File Templates> but in the templates tab and not in the Java EE which I guess it's normal.
This shouldn't be necessary at all; if you place the .ft file in the correct directory (corresponding to the package "fileTemplates.j2ee", all you need to do is call addTemplate() in your implementation of FileTemplateGroupDescriptorFactory.getFileTemplatesDescriptor(). The text will be loaded automatically.
It was my first step, so it's already done to..
here is the code
Remember that the fileTemplates are correctly added but their body are empty...
I'm getting the same problem, the templates are added but without content.
Also I found that adding the files to "fileTemplates" package (not fileTemplates.j2ee) with .ft extension and adding the .ft to the compiler options, the template is added automatically (and with content) to the "Templates" tab, even more, I don't need the extension point.
I think I can live with that workaround, but it would be nice to have a custom tab and a custom group with custom icons, etc (hence, use the extension point...)