eaUtils - Sparx Enterprise Architect add-in

Utilities for your EA models: sort elements, generate alias, diagram breadcrumb navigation...

Page d'accueil (version francaise)TwitterVideos UMLChannel SparxSystems EA YouTubeLinkedIn

Section 8. Sort elements from a package according to their layout in a diagram

sort elements by their layout order in the diagram

This help article explains how to use eaUtils to sort elements within a package according to their position in a diagram.

 

This feature runs from the active diagram.

Example

The following diagram shows various elements defined in the same package. The current feature can be illustrated by sorting elements according to their position in the diagram from top to bottom, or from left to right.

eautils sorting example

External elements

Process prevented by external elements (default setting)

By default, this sorting feature requires that all elements from the opened diagram belong to the same package so that only elements from a single package are sorted. If any external element is found, the following error message is displayed:

sort elements by diagram order in sparx enterprise architect project browser

This constraint has been applied to keep this feature simple and to prevent any unwanted updates. The following arguments also support this:

  • It makes sense to order only elements from the same context i.e. a package.
  • The locking control would become overcomplicated.

Note: a specific diagram can be created solely to fit the purpose of sorting elements based on their layout (a diagram can be copied and all external elements removed).

External elements can be ignored

However, eaUtils settings let you update this rule so that external elements are ignored (see eaUtils Settings help).

This setting can be changed directly on this screen by clicking on Edit Settings, enabling Ignore external elements in a diagram sorting checkbox, and click on Save Settings.

edit settings in eautils sort by diagram position

Example: this setting makes it possible to sort use cases in a diagram that also shows the actors maintained in a separate package, without having to remove actors from this diagram.

Sort elements within a package based on their layout in the selected diagram

Start by saving the diagram (Ctrl + S).

Option 1: default settings

Right click in the active diagram.

Open the menu Specialize > eaUtils > [Diagram] Sort elements (diagram position).

sort elements by diagram layout from top to bottom or left to right

Select the direction (top to bottom or left to right), and confirm that you would like to proceed (click on OK):

eautils sort by diagram order in sparx enterprise architect addin

Result:

eautils sort by diagram order in sparx enterprise architect addin result

The elements are sorted in the package as illustrated below, matching the position in the diagram:

eautils sort by diagram order top to bottom sparx ea project browser result

Note: as illustrated above, elements are grouped by type in the Browser (actors, use cases, classes, etc.). This result can be changed by enabling EA "Free Sorting" Preference (Ctrl+F9), leading to the following result:

eautils sort by diagram order top to bottom sparx ea project browser result with Free Sorting preference