Allow for custom variables in Apex file templates

Issue #430 resolved
Neil Morris created an issue

I noticed that when creating a new File Template with Extension: cls, selecting New->Apex Class now displays my custom template in the 'Kind' dropdown. This is great but, my template leverages custom Velocity variables.

So, right now I am stuck either filling in the custom variable information after using the Apex Class of Kind= My Custom Template or, if I use my template directly, I am required to manually create the respective meta.xml

I see two ways this could be made better but, I am not sure how straightforward either would be in the IntelliJ plugin sphere. 1. Open a subsequent dialog after the Illuminated Cloud New->Apex Class which would be able to request input values for custom Velocity variables the same way the default IntelliJ custom templates work. 2. Provide a way for a custom code template to call the script IlluminatedCloud uses to create the default meta.xml for the new Apex Class.

Let me know your thoughts.

Thanks You!

Comments (3)

  1. Scott Wells repo owner

    Neil, I researched this a little back to see if I could support template-based file creation with both the multiple-templates-per-file-type and custom variables. Unfortunately these two sets of functionality are based on separate inheritance hierarchies in the plugin SDK. If you want to see the full details, see this thread:

    https://intellij-support.jetbrains.com/hc/en-us/community/posts/203363884-CreateFileFromTemplateAction-vs-CreateFromTemplateActionBase-can-I-have-the-best-of-both-worlds-

    which resulted in this enhancement request:

    https://youtrack.jetbrains.com/issue/IDEA-161451

    Once the plugin SDK supports it, I'll definitely make sure IC supports it as well.

  2. Scott Wells repo owner

    I'm going to resolve this for now but will open a new issue when JetBrains addresses things on their side.

  3. Log in to comment