Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Extending Code Templates

I think I figured it out. I am pretty sure that I needed a resolver component.


Sorry for jumping the gun on posting.


From: Joseph Henry
Sent: Wednesday, October 23, 2013 9:54 AM
To: CDT General developers list.
Subject: Extending Code Templates




I am in need to distributing some default code templates with our plugin and am having a hard time getting this to work.


I have created an extension in my plugin org.eclipse.ui.editors.templates and created an include child.


For the simple case I want to create a C Source code template similar to org.eclipse.cdt.ui.text.codetemplates.csourcefile But I want it to use our companies default comment header.


I used the file /org.eclipse.cdt.ui/templates/default-codetemplates.xml as an example and was able to create a template using the default variables, but when I tried to create a new variable, it would not work.


How I attempted to create a variable was to define a section in the xml with the variable name, and define its content. I am guessing that is not the right way because it does not work.


I guess my question is: How do you create a substitution variable for a code template? My xml is pasted below.



<?xml version="1.0" encoding="UTF-8"?>



                <template name="sas_c_file_comment" id="" context="org.eclipse.cdt.ui.text.codetemplates.filecomment_context" enabled="true"

                                description="Default comments for a SAS C Source File">


*  Copyright (C), ${year}

*  SAS Institute Inc., Cary, N.C. 27513, U.S.A.  All rights reserved.

* --------------------------------------------------------------------


*  NAME:       {file_name}

*  AUTHOR:     {user}

*  DATE:       {date}

*  SUPPORT:    {user} -

 *  PRODUCT:   


*  SCRIPT:    

 *  PURPOSE:   



*    Defect    Action                        Date        Name

*    ----------------------------------------------------------------


 *    ----------------------------------------------------------------



                <template name="SAS C Source File" id="" description="Default SAS C Source Template" context="org.eclipse.cdt.core.cSource.contenttype_context" enabled="true">             














Back to the top