|[mdt-papyrus.dev] questions about elements naming strategy and org.eclipse.papyrus.uml.tools.utils.NamedElementUtil.computeDefaultNameWithIncrementFromBase(String, Collection<?>, EObject, String)|
The work about the element’s creation performance has made good progress. I will send an email with our results next week.
To do this work, I look the method org.eclipse.papyrus.uml.tools.utils.NamedElementUtil.computeDefaultNameWithIncrementFromBase(String, Collection<?>, EObject, String) which is not very efficient.
In this method, there are several things I don’t understand:
1. Does someone know in which cases we get elements which are not uml.Element in this method ? I found these points :
- references to ENamedElement
- instanceof on EObject
- calls to org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getName(EObject) (really useful?)
I checked, Table and Diagram creation don’t use this class to be named!
2. Concerning its parameter “Collection<?> contents”, do you know a usecase where this parameter's value is not the owner’s content of the object to name (got using eContents or another UML method)?
3. The method crosses all elements of the "contents" parameter to find a unique name with an index. It is not very efficient but it is safe to get a unique name.
We think the default name is changed just after the element creation most of the time, so this feature is maybe not so useful to the final user. That’s why we propose to change this behavior:
- by default : the increment could be the size of the contents list parameter (it should be unique the most of the time)
- a new preference provides the access to the current behavior
- another new preference to bypass the incrementation step of the naming process.
Please, do you have any suggestions about this point ?
FYI, I attached the concerned class.
CEA Saclay Nano-INNOV
Institut CARNOT CEA LIST
Point Courrier n° 174
91 191 Gif sur Yvette CEDEX
Back to the top