Synchronizing the Model and Source Code
You can synchronize the model and code in either direction, and at different levels (for example, project, package or class).
When UModel (Enterprise or Professional) runs as an Eclipse or Visual Studio plug-in, synchronization between model and code takes place automatically. Manual synchronization is possible at the project level; the option to update individual classes or packages is not available.
When you right-click an element in the Model Tree (for example, a class), the context menu displays the code synchronization or merging commands under the Code Engineering menu item:
•Merge Program Code from UModel ***
•Merge UModel *** from Program Code
*** is a Project, Package, Component, Class, and so on, depending on your current selection.
Depending on the settings you have defined from Project | Synchronization Settings, the alternative name of these two commands may be:
•Overwrite Program Code from UModel ***
•Overwrite UModel *** from Program Code
To update the entire project (but not classes, packages, or other local elements), you can also use the following commands on the Project menu of UModel:
•Merge (or Overwrite) Program Code from UModel Project
•Merge (or Overwrite) UModel Project from Program Code
For convenience, any of the commands listed above will be generically referred to as "code synchronization commands" further in this topic.
To synchronize at the project or Root package level, do one of the following:
•Right-click the Root package in the Model Tree, and select the required code synchronization command.
•On the Project menu, click the required code synchronization command.
To synchronize at package level:
|1.||Use Shift, or Ctrl + Click to select the package(s) you want to merge.|
|2.||Right-click the selection, and select the required code synchronization command.|
To synchronize at class level:
|1.||Use Shift, or Ctrl + Click to select the classes(s) you want to merge.|
|2.||Right-click the selection, and click the required code synchronization command.|
To avoid undesired results when synchronizing the model and code, consider the following scenarios:
On the Project menu, click Overwrite UModel Project from Program Code.
•This checks all directories (project files) of all different code languages you have defined in your project.
•New files are identified and added to the project.
•An entry "Collecting source files in (...)" appears in the Messages window.
Right-click a class or interface in the Model Tree and select Code Engineering | Overwrite UModel Class from Program Code.
•This updates only the selected class (interface) of your project.
•If the source code contains classes that are new or modified classes since the last synchronization, those changes will not be added to the model.
Right-click a Component in the Model Tree (within the Component View package) and select Code Engineering | Overwrite UModel Component from Program Code.
•This updates the corresponding directory (or project file) only.
•New files in the directory (project file) are identified and added to the project.
•An entry "Collecting source files in (...)" appears in the Message window.
|Note:||When synchronizing code, you might be prompted to update your UModel project before synchronization. This occurs when you open UModel projects created before the latest release. Click Yes to update your project to the latest release format, and save your project file. The notification message will not occur once this has been done.|