Book a Demo

Author Topic: How to persist edits of code generation templates  (Read 4007 times)

stigb

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
How to persist edits of code generation templates
« on: October 03, 2007, 06:17:03 am »
Hi!

I am fairly new to EA and have found out how I can edit the code generation templates on a per project bases, but when I start a new project I once again have to edit the code generation template for the new project.

Can anyone tell me how I can persist the changes to the code generation template so that I do not have to redefine them for each new project?

Thanks! stigb
« Last Edit: October 03, 2007, 06:23:07 am by stigb »

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to persist edits of code generation templa
« Reply #1 on: October 03, 2007, 06:44:36 am »
You can export and import these as reference data. Open a project that has some of your customized templates, then from the main menu choose Tools | Export Reference Data and then choose the types of reference data you need to export. You can choose multiple types at once; play around a bit to get the idea.

From a new project you need to follow the same pattern. You will identify the file you exported to in the above stage. EA will offer you the types of reference data present in the file, and you can select some or all types for import. Be aware that the reference data you select will overwrite what is already in the target project; it will not merge the two.

Following this process you can store a standard set of templates, then import them as required.

If you want to have a template set in every project you can edit the EABase project in the EA installation directory. This project is the 'seed' for each new project EA creates.

HTH, David
No, you can't have it!

stigb

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How to persist edits of code generation templa
« Reply #2 on: October 03, 2007, 12:54:28 pm »
Thanks a lot  :) Start playing straight away! stigb

It works just fine..! Thanks again.
« Last Edit: October 03, 2007, 01:02:56 pm by stigb »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to persist edits of code generation templa
« Reply #3 on: October 03, 2007, 01:04:44 pm »
You can also store them in an MDG technolgy file.  See http://www.sparxsystems.com.au/EAUserGuide/index.html?addingcodemodulesinmdgtec.htm

This file can then be stored under your install directory, another configured directory or you can point a url for EA to get it from.  See http://www.sparxsystems.com.au/EAUserGuide/index.html?deploying_mdg_technologies.htm

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: How to persist edits of code generation templa
« Reply #4 on: October 03, 2007, 01:12:33 pm »
Yes, of course...

I like Simon's idea better than mine. Perhaps it is worth revisiting.

David
No, you can't have it!

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: How to persist edits of code generation templa
« Reply #5 on: October 03, 2007, 03:54:15 pm »
On this topic, I've had problems getting the Code Generation Templates to work after importing them as reference data. I've traced this to the absence of types defined for my language.

In other words, if there is no language X defined in the "Programming Languages Datatypes" dialog (Settings - Code Datatypes...), language X does not appear in the Language dropbox the Code Template Editor (top left).

Defining a single type for language X resolves the issue. The Code Generation Templates do not need to be reimported.

Has anyone else had this problem? I'm using 7.0.815.
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: How to persist edits of code generation templa
« Reply #6 on: October 03, 2007, 06:09:50 pm »
It's not that there is a problem with the templates imported.  It's just that EA doesn't show templates if there are no datatypes.

If you're exporting templates for new languages as reference data you will also want to include 'Model Data Types - Code and DDL'.

Of course, even better is including both in the MDG technology file.

stigb

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: How to persist edits of code generation templa
« Reply #7 on: October 04, 2007, 02:27:48 am »
Thanks to you all for your feed back and enthusiasm.

I will try out your solution too, simonm, it seems to be a one time job only, I like that. I'll see if I can cope with the descriptions in the links or else get back to you like this   ???

stigb

Have tried it out for the code templates. Cool..! Thanks..!  8)
« Last Edit: October 04, 2007, 02:39:41 am by stigb »