Filter and sort composable elements offered in "New..." context menu
#4290 (closed) integrated the entries from the context menu service to diagram editors. However, independently of that, the "New..." menu still has the following issues:
- Elements are not filtered (w.r.t. to expert mode)
- The order of elements is arbitrary (according to the registration order of prototype providers, which might vary from run to run).
The entries there are fed from PrototypeService.getComposablePrototypes(). In this issue, the method should be changes to return a sorted list whose ordering is based on a new method in IModelElementHandler (in case of a tie: lexicographic ordering of prototype names)
For this one could provide the following default implementation in ModelElementHandlerBase (can be overridden by specific handlers).
if (element instanceof IHierarchicElement) { return 10; } else if (element instanceof IConnector) { return 20; } else if (element instanceof IModelElementSpecification) { return 30; }
It should be noted that this change will also affect the order of the elements shown in the Model Elements view.