How to update an Eclipse template variable on the fly?

I added the following new Eclipse template through an extension point. It simply adds a template for the sample testTag tag.

<!-- Add code template --> <extension point="org.eclipse.ui.editors.templates"> <template autoinsert="true" contextTypeId="html_tag" description="[Description] Template populated by Snippet values ***" id="org.eclipse.jst.jsf.ui.newHtmltag" name="testTag"> <pattern> <![CDATA[ <testTag style="background: ${color}"></testTag> ]]> </pattern> </template> <resolver contextTypeId="html_tag" type="src" class="TestTagTemplateVariableResolver"> </resolver> </extension> 

What I cannot understand is to change the value of the $ (color) variable at runtime. More specifically, when the user presses Ctrl + Space (or the equivalent to support the content) and types in "testTag" and presses Enter - instead of the text text "color", I would like it to be replaced with another text value that I have in another class. How to do it?

+2
eclipse plugins templates eclipse-plugin eclipse-pde
source share
1 answer

This email chain since 2004 says this may not be possible:

The Java editor chooses not to respect the fact that resolvers contributed their two types of context ("java" and "javadoc"), but only built-in converters are recognized.

The html editor you are working with may have a similar limitation.

+1
source share

All Articles