Update Package Contents

In addition to generating and importing code, Enterprise Architect provides the option to synchronize the model and source code, creating a model that represents the latest changes in the source code and vice versa. You can use either the model as the source, or the code as the source.

The behavior and actions of synchronization depend on the settings you have selected on the Attributes and Operations page of the Options dialog. These settings enable you to either protect or automatically discard information in the model that is not present in the code, and to prompt for a decision on code features that are not in the model. In the following two examples, the appropriate checkboxes have been selected for maximum protection of data:

You generated some source code, but made subsequent changes to the model. When you generate code again, Enterprise Architect adds any new attributes or methods to the existing source code, leaving intact what already exists. This means developers can work on the source code and then generate additional methods as required from the model, without having their code overwritten or destroyed.
You might have made changes to a source code file, but the model has detailed notes and characteristics you do not want to lose. By synchronizing from the source code into the model, you import additional attributes and methods but do not change other model elements.

 

Using the synchronization methods, it is simple to keep source code and model elements up to date and synchronized.

Access    Project Browser Package context menu | Code Engineering | Synchronize Package With Code     (Ctrl+Alt+M) or
Tools | Source Code Engineering | Synchronize Package Contents

Synchronize package contents against source code

Field/Button

Action

See also

Update Type

Select the radio button to either Forward Engineer or Reverse Engineer the package Classes, as appropriate.

 

 

Include child packages in generation

 

Select the checkbox to include child packages in the synchronization.

 

 

OK

Click on the button to start synchronization.

Enterprise Architect uses the directory names specified when the project source was first imported/generated and updates either the model or the source code depending on the option chosen. IF:

Performing forward synchronization AND
There are differences between the model and code AND
The On forward synch, prompt to delete code features not in model checkbox is selected in the Options - Attributes and Operations dialog

THEN the Synchronize Element <package name>.<element name> dialog displays.

Otherwise, no further action is required.

 

 

 

 

 

 

 

Synchronize Model and Code

Notes

Code synchronization does not change method bodies; behavioral code cannot be synchronized, and code generation only works when generating the entire file
In the Corporate, Business and Software Engineering, System Engineering and Ultimate editions of Enterprise Architect, if security is enabled you must have Generate Source Code and DDL permission to synchronize source code with model elements

Learn more

Learning Center topics

(Alt+F1) | Enterprise Architect | Software Engineering | Generate Code | Update Packages