Book a Demo

Author Topic: Change source code generation indentation from tabs to spaces  (Read 7296 times)

jepessen

  • EA User
  • **
  • Posts: 106
  • Karma: +1/-1
    • View Profile
Hi.
I want to generate c# code from UML classes. I want to generate classes using two spaces instead of a tab for indenting.

I've seen that in Code Template Editor when selecting a section like "Namespace Body" I see in text something like

Code: [Select]
@indent="\t"
Should I replace all these pieces of code with

Code: [Select]
@indent="  "
where I put two spaces inside double quotes? And, if yes, I must replace manually all entries or there's a easier way?

Last but not last, if I want to export these settings and import them into another PC with EA installed, what I should do?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change source code generation indentation from tabs to spaces
« Reply #1 on: June 07, 2016, 08:06:48 am »
Replacing the \t it probably the way to go. Now, after not having used this feature for years, I looked up, how to export the macros. The help states:
Quote
n the 'Export Reference Data' dialog, in the 'Name' list, select the templates to export.

The list includes any standard Code Generation or Transformation templates that have been changed, and any customized templates that you have created or changed.

You can select one or more templates to be exported to a single XML file, by pressing Ctrl or Shift as you click on the template names.
Well, the Name list has no code templates listed at all. Maybe only if you have modified code templates?

q.

jepessen

  • EA User
  • **
  • Posts: 106
  • Karma: +1/-1
    • View Profile
Re: Change source code generation indentation from tabs to spaces
« Reply #2 on: June 08, 2016, 01:56:40 am »
In fact here documentation says:

Quote
If you edit a base Code Generation or Transformation template, or create a customized template, you can copy them from one project to another as Reference Data.

I must try to modify and then save it.

Thanks for the help.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Change source code generation indentation from tabs to spaces
« Reply #3 on: June 08, 2016, 04:04:31 am »
Yes, you can only export your own changed templates, not the standards ones. (which makes sense since the standard templates are already available in every model)

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change source code generation indentation from tabs to spaces
« Reply #4 on: June 08, 2016, 05:38:44 am »
It would confuse less, if that were written in the help. Roy, do you hear me?

q.

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Change source code generation indentation from tabs to spaces
« Reply #5 on: June 08, 2016, 10:48:46 am »
Well, there is a Help topic devoted to Exporting code and transformation templates, and it states:

(From) the 'Name' list, select the templates to export. The list includes any standard Code Generation or Transformation templates that have been changed, and any customized templates that you have created or changed.

But as my hearing is exceptional, I have added a bit of text to the start of the procedure to say that you can...

... export customized templates, which includes those that you or other users have created and updated, and base (standard) templates that have been tailored. You do not need to export base templates that have not been changed, as these are available in every installation of Enterprise Architect.

Is that sufficiently plain?
Best Regards, Roy

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Change source code generation indentation from tabs to spaces
« Reply #6 on: June 08, 2016, 04:54:26 pm »
Excellent! Thanks :-)

q.