Altova UModel 2024 Professional Edition

When importing program code into a UModel project, you may need to set or change the options listed below. These options are available on the dialog box which appears when you run the menu command Project | Import Source Project or Project | Import Source Directory.

um_dlg_import_source_project

Import Source Project dialog box

Most of the options on the dialog box above can also be changed at any time later, see Code Synchronization Settings.

 

The following options are applicable to all project types, regardless of the language or platform:

 

Option

Description

Import project relative to UModel project file

By default, this option is selected, which means that a relative path dependency will be established between the UModel project and the imported source code project.

 

After source code is imported, a UML component is generated automatically in the UModel project (it is available in the Model Tree, as a child of "Component View"). This component realizes the interfaces or classes to be engineered; it also specifies the code engineering options, including the path to the source project or directory. This will be a relative path if Import project relative to UModel project file is selected; otherwise, it will be an absolute path.

Merge Code into Model / Overwrite Model according to Code

If Merge... is selected, potential name conflicts (such as package or class names) will be resolved by appending a number to the element that is being imported.

 

If Overwrite... is selected, and if there are name conflicts, the imported element will take precedence over (overwrite) the one existing in the project.

Enable diagram generation

Optionally, select this check box if you want to generate Class and Package diagrams from the imported classes. When this check box is selected, the import wizard includes additional steps which enable you to customize the look of the generated diagrams.

 

The following options are applicable only to C# and VB.NET projects:

 

Option

Description

DocComments as Documentation

Select this check box to convert comments found in the C# code into UModel element documentation (see also Documentation).

Resolve aliases

 

 

 

This check box is enabled by default. If your C# or VB.NET code contains namespace or class aliases like in the code listing below, it is recommended to keep this check box selected. Otherwise, associations and dependencies involving aliased classes and namespaces in your code may not be detected automatically by UModel during the import (and thus would not be present in the model).

 

using Q = System.Collections.Generic.Queue<String>;
Q myQueue;

Example of an alias in C# code

During the source code import, any potentially conflicting aliases are added to the "Unknown externals" package of the UModel project if their use is unclear.

 

When you update the code back from the model (round-trip engineering), aliases will be retained as they exist in the generated code.

 

The Resolve aliases option can be changed at any time later, see Code Synchronization Settings. If you enable this option after (not before) the import operation, UModel prompts you to update the project from the code again, since the option also has consequences for forward engineering.

Defined symbols

If your C# or VB.NET code includes symbols that are defined through preprocessor directives such as #if, #endif, you can instruct UModel to take them into account while reverse engineering code.

 

#if DEBUG        

       static void DisplayMessage()

       {

           Console.WriteLine("Please wait...");            

       }

#endif

Example of a conditional compilation symbol in C# code

For example, if you reverse engineer the code above, the method DisplayMessage() will only be imported into the model if you specified the DEBUG symbol.

 

To specify conditional compilation symbols, enter them in the "Defined symbols" text box, delimited by a semicolon.

 

During the reverse engineering process, UModel outputs all symbols used in the source code in the Messages window.

 

The following option is applicable only to Java projects:

 

Option

Description

JavaDocs as Documentation

Select this check box to convert JavaDocs-style comments found in the code into UModel element documentation (see also Documentation).

 

Note: Only comments applicable for Java classes, interfaces, operations, and properties are converted.

© 2017-2023 Altova GmbH