I added the following new Eclipse template through an extension point. It simply adds a template for the sample testTag tag.
<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?
eclipse plugins templates eclipse-plugin eclipse-pde
Plaguehammer
source share