How can I create custom Live Templates with an Intellij plugin

。_饼干妹妹 提交于 2019-12-21 04:25:37

问题


I want to create a custom Live Template that will be available with my plugin. I know how to create custom Live Templates using the Settings dialog, but I want to be able to distribute the Live Template as part of my plugin:

  • How is the Live Template defined within the plugin?
  • Where is the entry point to register it with the application?

Thanks.


回答1:


using 12.1.5 I was able to accomplish this after looking at the groovy plugin source.

  1. Go ahead and create your template using the settings dialog. It will store the resulting xml file somewhere under %home%/.Ideawhatever/config/templates in group_name.xml

  2. Copy this file into project/resources/liveTemplates

  3. Create an implementation of DefaultLiveTemplatesProvider and implement as follows:

     @Override
     public String[] getDefaultLiveTemplateFiles()
      {
         return new String[] {"liveTemplates/group_name"};
      }
    
  4. add the following under extensions in your plugin.xml

    defaultLiveTemplatesProvider implementation="com.tridium.intellij.NiagaraTemplatesProvider"
    


来源:https://stackoverflow.com/questions/19256640/how-can-i-create-custom-live-templates-with-an-intellij-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!