Section 1. Sort elements from a Package or an Element: introduction, tree position information, settings
eaUtils add-in lets you sort elements from a package or an element either by the Alias, Stereotype, Name, Tagged Value, or Object ID (creation). This feature can be executed by selecting the package or element to process from the project browser.
This help article covers the following topics:
- Tree position update
- Illustration with a simple example
- eaUtils Sort By settings
- Combination of sorting settings
- Example used in the associated articles covering each feature (except from the Object ID):
Tree position update
eaUtils sorting features let you update the elements "Tree Position" value. Enterprise Architect default sorting order is by type and by element name, having all elements' Tree Position value set to null.
The example below illustrates Enterprise Architect default sorting order.
Enterprise Architect project browser makes it possible to move these elements up or down resulting in a custom sorting order within the modified package or element. Once the corresponding green arrow buttons have been used (see below), the elements "TreePosition" are populated with values starting from 1.
Below is the updated tree position values after the custom order has been applied.
- Elements that aren’t displayed in the Project Browser, such as Notes, Constraints, don’t have their tree position value updated.
- By default, elements are still grouped by type i.e. eaUtils won't achieve the following order in the browser: Class2, Interface2, Class1, Interface3…
- EA project browser options include a "Allow Free Sorting" which can be enabled on each EA client.
- Once a custom sorting order is set within a package, the default order can be re-applied with Enterprise Architect via a right click > Contents > Reset Sort Order. However as this is not available for an element (e.g. a use case that contains activities), eaUtils provides this feature via a right click > Extensions or Specialize > eaUtils > [Browser] Apply default order (help section).
A simple example to start with
The following example illustrates a package that contains 10 classes with the default order i.e. by name (note that Class10 is considered before Class2 as Enterprise Architect sorts names based on the string value).
- Select the package Classes from the project browser.
- Right click and select Extensions > eaUtils > [Browser] Sort elements.
- In the popup window, select the Alias sorting option and run the sorting.
Result: elements in the project browser are sorted by the alias value (note: the order shown in the diagram has been manually modified to show the expected order based on the Alias values).
eaUtils Sort By Settings
eaUtils settings include a tab dedicated to the Sort By features. Open eaUtils settings from its menu [eaUtils] eaUtils Settings, and select the Sort By tab:
Further information about eaUtils settings is available here.
Combination of sorting settings
eaUtils sort by settings provide a number of options which can be combined. The table below clarifies the sorting results associated with most of the allowed combinations (Object ID option is not covered).
The table is organised by :
- the sorted element type i.e. Alias, Tagged Value, Stereotype or Name,
- having the element Alias, Tagged Value, Stereotype or name empty,
- having eaUtils Case Sensitive sorting setting enabled or disabled,
- and having eaUtils extract integer values from string sorting setting enabled or disabled.
- A: Enterprise Architect default sorting order i.e. by name string value, case sensitive (for identical values, elements are sorted by the created date/time)
- B: sorted by name string value, case insensitive
- C: sorted by name string value (case sensitive) or by the extracted integer/numeric value when present
- D: sorted by name string value (case insensitive) or by the extracted integer/numeric value when present
- E: sorted by Alias, Stereotype, or Tagged Value string value (case sensitive) or by the extracted integer/numeric value when present
- F: sorted by Alias, Stereotype, or Tagged Value string value (case insensitive) or by the extracted integer/numeric value when present
- G: sorted by Alias, Stereotype, or Tagged Value string value (case sensitive)
- H: sorted by Alias, Stereotype, or Tagged Value string value (case insensitive)
- I: sorted by the element created date/time (oldest to most recent)
- CS 1/0: "Case sensitive values" setting enabled or disabled
- ExtractInt 1/0: "Identify and sort integers within string values" setting enabled or disabled
The following diagram shows the example used to illustrate each type of sorting alternative available. As regards it combines element types (class, use case, interface, actor), alias values, names, stereotype values, and tagged values.
Note that the element "Use Case0" is composite i.e. it has a diagram and elements, so that sorting elements within an element can be illustrated.