Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Contributing my own templates to

> 
> Hello folks,
> 
> I am trying the re-written code templates in CDT 3.0 (weekly build from
> April 25 - org.eclipse.cdt.sdk-3.0.0-I200504251446-win32.x86.zip,
> eclipse is eclipse-SDK-3.1M6-win32.zip).
> I would like to contribute some of my own templates to the
> org.eclipse.cdt.ui.text.templates.c context type id. From the
> documentation I found I thought this would be as simple as
> 
> - Adding an extension to the point org.eclipse.ui.editors.templates to
> my plugin.xml.
> - Adding a template definition to this extension which references
> org.eclipse.cdt.ui.text.templates.c as context type id.
> - Writing my template as the body of this template element.
> 
> Now when I start a runtime workbench without my extension I see the
> usual standard templates in Window / Preferences / C/C++ / Editor /
> Templates.
> When I add my extension the list of templates is compeletely empty.
> 
> Has anybody ventured into these lands? What should I do?
> 
> For more clarity I am adding a snippet from my plugin.xml
> 
> Thanks for any hints,
> 

Try this instead:

 <extension
       point="org.eclipse.ui.editors.templates">
    <template
          contextTypeId="org.eclipse.cdt.ui.text.templates.c"
          description="How to create a binary semaphore"
			id="de.siemens.rmos.crossdevel.templates.RmCreateBinSemaphore"
          name="RmCreateBinSemaphore">
         <pattern>
       /* I'm not sure how to do this :-) */ ${cursor}
       	</pattern>
    </template>
 </extension>

Check out the documentation that comes with Editor/Templates for more details
on the extension point(or RTFM, F for Fine).

I have to agree, the implementation is fragile, if a third plugin do something
bad ... nothing works.




Back to the top