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 based on the value from the selected field amongst the available options: 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 page 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 subsections covering each feature (except from the Object ID)
Additional sorting elements help pages:
Tree position update
eaUtils sorting features let you update the elements "Tree Position" value, used by Enterprise Architect to manage their position within the parent element e.g. a package. The default sorting order is by element type and name.
The example below illustrates Enterprise Architect default sorting order: all values in the project database are set to null.
Elements and diagrams can be manually moved up and down in the EA project browser, resulting in a custom sorting order within the modified parent package or element. Once the browser toolbar 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.
Notes:
- eaUtils doesn't process the order of elements such as Notes, Constraints, Boundaries, etc.
- By default, elements are still grouped by type i.e. eaUtils won't achieve the following order in the browser: Class2, Interface2, Class1, Interface3…
- Note: EA preferences include an "Allow Free Sorting" option 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 since this is not available for the content under 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/Specialize > 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.
Legend:
- 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
Example
The following diagram shows the example used to illustrate each type of eaUtils sorting feature in the next help sections. As regards it combines for several element types (class, use case, interface, actor) different values on the following fields: alias, name, stereotype, and tagged value.
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.