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!"
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?
Aha, solution is in implementing DefaultLiveTemplatesProvider.
Answer's closed.
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.
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
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?