Book a Demo

Author Topic: generating code from model  (Read 6481 times)

viki

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
generating code from model
« on: October 24, 2011, 08:23:00 pm »
I'm using EA ver 9.0.904 and I'm trying to generate C++ code from the UML.

I have a few questions:

1. When I generate code using "always synchronize with existing file" I come across a problem in the following scenario:
    a. generate code for class
    b. delete a member functions from the class (in UML model)
    c. save
    d. generate code for class
The problem is that while the function doesn't exist in the UML it still exists in the code. (the same problem happens with deleted members)

2. Is there a way to add @return to the generated javadoc?

3. If I set a function parameter direction as "output" EA adds a "*" before the parameter in the function signature.
The "*" is not added in the code so the signatures are different. How do I disable the added "*"?

4. How can I change the default appearance settings?

5. How can I change the "Attribute Specifications"  for all classes?

Thanks in advance,
Viki :)
« Last Edit: October 26, 2011, 08:11:34 pm by viki86 »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: generating code from model
« Reply #1 on: October 25, 2011, 08:44:17 am »
1. There's an option (Tools | Options | Source Code Engineering | Attribute/Operations) to allow EA to prompt to delete these. EA will not delete them without prompting.

2. The easiest way is to add @return to your notes.

3. This is just a visual representation on the diagram. Look at the group of options (Tools | Options | Objects | Feature reference indicator)

4 & 5. Sorry, not sure what you're asking.


viki

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: generating code from model
« Reply #2 on: October 26, 2011, 12:18:27 am »
I already found 4 & 5 so thanks for your answers.

Another problem I have is that all words inside notes are appearing like spelling mistakes. the word "class" appears OK but with underlining.

I didn't had this problem in a prior version - how do I fix this?

Thanks,
Viki.
« Last Edit: October 26, 2011, 03:55:27 am by viki86 »

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: generating code from model
« Reply #3 on: October 26, 2011, 09:47:00 am »
ALL words? Or specific words? If the underline is in blue, it probably indicates that the word is a term defined in your project glossary. Try double-clicking on the underlined word and see if it displays a definition.
Best Regards, Roy

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: generating code from model
« Reply #4 on: October 26, 2011, 11:08:35 am »
Maybe you have the wrong spell checking language set? Tools > Spelling Tools > Spelling Options.

(Or you could just be really bad at spelling? ;) )
The Sparx Team
[email protected]

viki

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: generating code from model
« Reply #5 on: October 26, 2011, 07:56:58 pm »
All words appear as spelling mistakes...

from "help" I found:
Set the language of the main dictionary used to check spelling; the drop-down list shows only languages for which dictionaries are installed on your system
To check spelling in a different language, select the language in the list

my list is empty - how do I get the English dictionary ?

viki

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: generating code from model
« Reply #6 on: October 26, 2011, 08:14:19 pm »
Another issue:

1. Class A has a member pointer to class B:
class A {
public:
      A();
      virtual ~A();
private:      
      B* mpB;
};

2. I imported A and B src code to EA and made a class diagram : EA created an Association connection from A to B with "B role : mpB"

3. I deleted mpB from A using EA ( the problem accrues also if I delete mpB from the code -> sync model from code)

4. mpB disappeared from the class in the model but the connector with mpB remained - so if I generate code mpB is not deleted from the code. Only after I delete the connector from the model code generation deletes mpB from the code...
(same problem if I use B mB)

how can I make the connector to be deleted automatically when I delete the class member? Or is there any other solution to this problem?

Thanks  :)
« Last Edit: October 26, 2011, 08:56:32 pm by viki86 »

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: generating code from model
« Reply #7 on: October 27, 2011, 08:49:35 am »
There's an option (Tools | Options | Source Code Engineering | Attributes/Operations)

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: generating code from model
« Reply #8 on: October 27, 2011, 10:03:44 am »
Spelling dictionaries - the three English dictionaries should be there by default.

Here is a quote from an email that Sparx Support sent to another user who reported a similar problem to yours:

-----------------------------------------------------
Have you previously had the EA Trial edition installed on your machine?

There was a known issue in early builds of EA 9 where the registered
version of Enterprise Architect was still looking for dictionaries in
the EA Trial edition's Program Files directory.

Please perform the following steps:

- Close any running instances of Enterprise Architect
- Run regedit
- Find and delete the following registry key:
  [HKEY_CURRENT_USER\Software\Sparx Systems\EA400\SSCE]
- Restart EA

When you restart EA, the "SSCE" registry key should be automatically
created again with default values.  Does this appear to make any
difference when trying to select your dictionaries again?

You should also be able to resolve this issue by updating to the latest
build of EA (currently EA 9.1, build 910).

------------------------------------------------------------------------------

I hope that this helps, but if it doesn't please send a bug report to Sparx Support (link at the foot of this forum page). They will have a deeper insight!

Best Regards, Roy

viki

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: generating code from model
« Reply #9 on: October 27, 2011, 10:40:00 pm »
@Simon m: thanks, it solved the problem for reverse engineering, but what about the case in which I want to delete the attribute using EA and then generate code? (because deleting the attribute doesn't delete the association connector)

@RoyC : I just updated to ver 9.1 and the problem was solved, thanks anyway.