Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Texo/Template Overriding

< Texo
Revision as of 21:18, 7 March 2010 by Unnamed Poltroon (Talk) (Overriding a template)

Introduction

Texo uses different templates for generating different parts of the model code. The templates can be found in the org.eclipse.emf.texo.modelgenerator.templates package in the org.eclipse.emf.texo.modelgenerator plugin. You can find this plugin in CVS or in your eclipse plugins folder (after installing).

Template overriding

When generating model code, Texo checks the project properties to see if a template folder has been set in the Texo project properties. If this is the case, first this folder is checked for templates before using the standard Texo templates.

Note, Texo checks the project properties of the project which contains the model file. So if your model files are in different projects then each project needs such a templates folder set in the project properties. Currently (March 2010) the templates folder must be in the same project as the model file, in future versions it will probably be possible to select a workspace or filesystem folder outside of the project.

Overriding a template

To override one of the template you have to do the following:

  • create a folder in the same project as the model file
  • create a directory structure inside this folder corresponding to the Texo templates package: org/eclipse/emf/texo/modelgenerator/templates
  • create your template file inside the org/eclipse/emf/texo/modelgenerator/templates folder with the exact same name as the template file used by Texo. For example to override the generation of the main model classes you need to create an entity.xpt file (probably copy the original one and adapt it).


Org.eclipse.emf.texo.override.template.png

Back to the top