Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » How to add custom code templates to my plugin?
How to add custom code templates to my plugin? [message #670307] Fri, 13 May 2011 09:26 Go to previous message
Dwight Johnson is currently offline Dwight Johnson
Messages: 19
Registered: March 2011
Junior Member

Hello,

I am working on a plugin myplugin that supports a custom webproject and perspective.

XHTML, CSS en .JS have an adapted syntax.

Code templates need to be provided that must be stored in the plugin in templates/templates.xml.

In templates.xml resides:

   <templates>
      <template autoinsert="true"
             contextTypeId="html_tag"
             description="[Description]"
             id="org.eclipse.jst.jsf.ui.newHtmltag"
             name="testTag" 
             enabled="true" 
             context="html_tag"  >
		Some template content...
     </template>
   </templates>


In plugin.xml we have:

     <extension
       point="org.eclipse.ui.editors.templates">
       <include file="templates/templates.xml"/>
     </extension>


This template does indeed show up in Preferences > Web > HTML files > Editor > Templates under context=HTML Tag.

What I do not understand is: how can I introduce a new HTML context 'CE_HTML' where my new templates will reside under? Changes/additions allowed only in myplugin.

I tried this in plugin.xml:

    <!-- Templates -->
	<extension point="org.eclipse.ui.editors.templates">
		<contextType
			name="%CE_HTML_context_type_Extension_Element.name"
			class="org.eclipse.wst.html.ui.internal.templates.TemplateContextTypeHTML"
			id="html_ce">
		</contextType>
		<include
			file="templates/htmldefault-templates2.xml"
			translations="$nl$/templates/htmldefault-templates.properties">
		</include>
	</extension>

with templates in htmldefault-templates2.xml but nothing shows up.

Any suggestion would be much appreciated.


 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic:Web Services, top-down
Next Topic:CustomCompletionProposal
Goto Forum:
  


Current Time: Sun May 19 22:31:52 EDT 2013

Powered by FUDForum. Page generated in 0.01770 seconds