问题
I am learning EA. I did reserve engineering with my java code and generated some class diagrams. Then I changed my code and copy over to EA project (delete the original source code which EA used and put the modified in). Then use Code Engineering -> Synchroize Package with Code to update EA with the modified code, the new reference added was shown up in one of the class diagrams but the old reference which was removed in the updated code was still in one of the class diagrams.
And also the new files added were not shown up in the EA project. I tried reimport source before but my diagrams were lost then.
I tried Synchronize with Code in different level (places) and even modified code locally with View Source Code feature but still the same.
Is there any options I need to set up for this?
The EA version is 8.0.860.
回答1:
The relevant EA options are located in the Options dialog (Tools - Options), under the Source Code Engineering branch.
Under Attribute/Operations, there is an option "On reverse synch, delete model associations not in code" which I think is off by default. Switching that on should fix the dangling association problem. (There are similar options for attributes and methods.)
Conversely, when generating code, the option "On forward synch, prompt to delete code features not in mode (sic)" needs to be set in order for EA to remove stuff from the code which has been deleted from the model.
The normal way to get EA to create UML classes for newly added Java classes is to redo the import from the top level; they're not picked up during a Synchronize Package. No diagrams should be lost this way, unless possibly if you've added diagrams of your own which you shouldn't do in a source model.
来源:https://stackoverflow.com/questions/7795706/enterprise-architect-synchronize-with-code