3 comments
Comment actions Permalink

Aha, solution is in implementing DefaultLiveTemplatesProvider.

Answer's closed.

0
Comment actions Permalink

Hello Valeriy,

Unless I'm mistaken in understanding your goal, the DefaultLiveTemplatesProvider
has nothing to do with live template contexts. To provide a custom live template
context, you need to extend TemplateContextType and register it as liveTemplateContext
extension.

Aha, solution is in implementing DefaultLiveTemplatesProvider.

Answer's closed.


--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Hi, 

Actually, I did not get how to use the class which extends "TemplateContextType" for getting own live template context using code.

In my plugin, I have a text and checkbox same as the android live template to add the template in IntelliJ but did not get how to set the template context using code.

I use hardcoded code like this 

====================================

final TemplateContextType contextTypeTemp = ContainerUtil.findInstance(TemplateContextType.EP_NAME.getExtensions(), JavaCodeContextType.class); ((TemplateImpl) template).getTemplateContext().setEnabled(contextTypeTemp, true);

====================================

for java context, but what about others and dynamic scenario?

0

Please sign in to leave a comment.