Book a Demo

Author Topic: Code Template Help  (Read 2755 times)

MikeOrmerod

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
  • Simplyfying building the worlds best biz apps
    • View Profile
Code Template Help
« on: January 25, 2005, 05:41:09 am »
Hi

I'm attempting to add a code template for an un-supported language.  I've created the language and added some data-types.
Now, within the CT Editor I've copied the template from C# for 'File" and from a Class I can generate a text file with the relevant header info. Now my problem.  In the class I've defined a Operation, but I can't seem to be able to find the right template to modify to generate the stub definition of the operation I've added. (does this make sense?)
So my question is which Template do I need to use to produce the operation definition in my text file. (I've tried copying the C# stuff just to get some form of output, but with no success)

TIA

Mike

thomaskilian

  • Guest
Re: Code Template Help
« Reply #1 on: January 25, 2005, 06:26:58 am »
Mike,
I'm shure you should receive full C# code having copied all templates. Make shure each and every template looks like that of the C# analogon.

MikeOrmerod

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
  • Simplyfying building the worlds best biz apps
    • View Profile
Re: Code Template Help
« Reply #2 on: January 25, 2005, 07:00:12 am »
Ok, I think I may have worked it out.  I copied all the definitions from the C# templates to my new language and I got some output :-)  I then removed the NameSpace templates and got an empty file other than the header.  But on closer inspection there is a line %list="Namespace" in the C# file template, so changing this to %list="Class" now works (as the language I'm working with doesn't use namespaces.
Thanks
Mike

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Code Template Help
« Reply #3 on: January 26, 2005, 01:12:53 pm »
Hi Mike,

Just a point that you may want to consider.  If you use namespace templates at all then you may have problems generating code from deeply nested packages in EA.  This is because EA will assume that they represent namespaces and they and the classes in them aren't being touched.

The solution to this would be to set every package to a "Namespace Root", or to use a namespace template, it doesn't have to generate anything though.  Just use something like the following in the Namespace template.

Code: [Select]
%list="Namespace" @separator="\n\n"%
%list="Class" @separator="\n\n"%


That will make EA recurse into each namespace and generate the classes out of it.

I hope this prevents any problems with this that you may otherwise have.

Simon