Please note : This help page is for an older version of Enteprise Archtiect. The latest help can be found here.

Namespaces

Languages such as Java support Package structures or namespaces. In Enterprise Architect you can specify a Package as a namespace root, which denotes where the namespace structure for your Class model starts; all subordinate Packages below a namespace root will form the namespace hierarchy for contained Classes and Interfaces.

To define a Package as a namespace root, right-click on the Package in the Project Browser and select 'Code Engineering | Set as Namespace Root'. The Package icon in the Project Browser changes to show a colored corner indicating this Package as a namespace root.

Generated Java source code, for example, will automatically add a Package declaration at the beginning of the generated file, indicating the location of this Class in the Package hierarchy below the namespace root.

To clear an existing namespace root, right-click on a namespace root Package in the Project Browser and select 'Code Engineering | Clear Namespace Root'.

To view a list of namespaces, select the 'Project | Settings | Namespace Roots' menu option; the 'Namespaces' dialog displays. If you double-click on a namespace in the list, the Package is highlighted in the Project Browser; alternatively, right-click on the namespace and select the 'Locate Package in Browser' option. You can also clear the selected namespace root by selecting the 'Clear Namespace Attribute' option.

To omit a Package from a namespace definition, select the 'Code Engineering | Suppress Namespace' context menu option; to include the Package in the namespace again, select the 'Code Engineering | Show Namespace' context menu option.

Notes

  • When performing code generation, any Package name that contains whitespace characters is automatically treated as a namespace root

Learning Center topics

  • Alt+F1 | Enterprise Architect | Software Engineering | Generate Code | Namespaces