archi icon indicating copy to clipboard operation
archi copied to clipboard

model tree doesn't sort relationships of the same time alphabetically

Open lvmm opened this issue 8 months ago • 3 comments

Archi Version

5.5.0

Operating System

windows 10

Archi Plug-ins

No response

Description

It appears that relationship description in parentheses is ignored when sorting the model tree, and all relationships of the same type are sorted by the time of creation, not alphabetically, which makes rather difficult to find the one you need when there are lots of them.

Steps to reproduce

  1. create this model, create serving relationships in the following order: (3-2), (3-1), (1-2) Image
  2. model tree looks like this Image

Expected sort order for Serving relationships is {(1-2), (3-1), (3-2)}, not {(3-2), (3-1), (1-2)}

lvmm avatar Mar 20 '25 07:03 lvmm

It appears that relationship description in parentheses is ignored when sorting the model tree

Correct.

and all relationships of the same type are sorted by the time of creation, not alphabetically

Not exactly. They're sorted alphabetically purely on name.

https://github.com/archimatetool/archi/blob/c4f813c5a460f90d823240438ebd0eb52846dfae/com.archimatetool.editor/src/com/archimatetool/editor/views/tree/TreeModelViewer.java#L108-L149

No plans to change this.

(Notes - it's easy to use the label text with the "from-to" part in the ViewerComparator (same as in ModelTreeViewerLabelProvider), but the tricky part is handling name changes to source/target and reconnections in TreeModelView to update and re-sort the contents of the Relations folder. For every rename of an object we have to also update its connected relations and re-sort the parent folder of these relation(s). Similarly for every reconnection of source/target. This is expensive and will be slow).

Phillipus avatar Mar 20 '25 07:03 Phillipus

No plans to change this.

Why? Lists should be arranged in a way that makes finding things easier, not more difficult as it is with the current absence of sort. What's the value in sorting the list the current way?

lvmm avatar Mar 20 '25 07:03 lvmm

Why?

Because I'm busy doing other things. Also, there are reasons to do with optimisations in refreshing the Models Tree when one end of a relationship is renamed.

See https://github.com/archimatetool/archi/compare/master...sort-relations-source-target-labels for POC.

Phillipus avatar Mar 20 '25 07:03 Phillipus