From cdd8be15a6787f5536a9d462b722152c4fb9aabb Mon Sep 17 00:00:00 2001 From: Vincent Lorenzo Date: Thu, 25 Jan 2018 10:55:47 +0100 Subject: bug 530155: [Performance] NamedElementUtil.computeDefaultNameWithIncrementFromBase must be improved and provide a naming strategy - implements a preference - add the documentation - update JUnit tests to force concerned tests to use the previous behavior Change-Id: I5e68fafc37299ffc4c1a0e18f4b1960e7ce8f010 Signed-off-by: Vincent Lorenzo --- plugins/doc/org.eclipse.papyrus.uml.doc/plugin.xml | 16 ++++++++++++++++ .../NamingStrategyPreferencePage.png | Bin 0 -> 86876 bytes .../resource/namingStrategy-devDoc-main-toc.xml | 8 ++++++++ .../resource/namingStrategy-devDoc.mediawiki | 21 +++++++++++++++++++++ .../resource/namingStrategy-userDoc-main-toc.xml | 7 +++++++ .../resource/namingStrategy-userDoc.mediawiki | 13 +++++++++++++ 6 files changed, 65 insertions(+) create mode 100644 plugins/doc/org.eclipse.papyrus.uml.doc/resource/images/nameStrategy-userDoc/NamingStrategyPreferencePage.png create mode 100644 plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc-main-toc.xml create mode 100644 plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc.mediawiki create mode 100644 plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc-main-toc.xml create mode 100644 plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc.mediawiki (limited to 'plugins/doc') diff --git a/plugins/doc/org.eclipse.papyrus.uml.doc/plugin.xml b/plugins/doc/org.eclipse.papyrus.uml.doc/plugin.xml index 02c10a7fe7c..c273d3be375 100644 --- a/plugins/doc/org.eclipse.papyrus.uml.doc/plugin.xml +++ b/plugins/doc/org.eclipse.papyrus.uml.doc/plugin.xml @@ -11,6 +11,22 @@ file="target/generated-eclipse-help/PapyrusStarterGuide-toc.xml" primary="false"> + + + + + + + + diff --git a/plugins/doc/org.eclipse.papyrus.uml.doc/resource/images/nameStrategy-userDoc/NamingStrategyPreferencePage.png b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/images/nameStrategy-userDoc/NamingStrategyPreferencePage.png new file mode 100644 index 00000000000..ee5ffd2d64d Binary files /dev/null and b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/images/nameStrategy-userDoc/NamingStrategyPreferencePage.png differ diff --git a/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc-main-toc.xml b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc-main-toc.xml new file mode 100644 index 00000000000..156ccccc173 --- /dev/null +++ b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc-main-toc.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc.mediawiki b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc.mediawiki new file mode 100644 index 00000000000..15f245e7900 --- /dev/null +++ b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-devDoc.mediawiki @@ -0,0 +1,21 @@ +=Naming Strategies= +==History== +Until Papyrus Oxygen.3, the created NamedElement were automatically named. The name was found according to the element's UML Metaclass, suffixed by an index. This index was found crossing all the elements in the owner until to build a unique name (''Metaclass' name + index''). This strategy cost many time for huge model and most of the time, the found name is replaced by the user just after the element's creation. + +Since Papyrus Oxygen.3, we implement new strategies, to reduce the time consumption. +*'''no index''': the created element is named according to its Metaclass. We have no warranty about the uniqueness of its name. +*'''quick index''': the created element is named according to its Metaclass. This name is suffixed by an index (typically, the number of the elements already contained by its parent +1). We don't check the unicity of the name. +*'''unique index''': the initial Papyrus strategy + + +==How does it work?== +Papyrus uses the '''quick index''' strategy by default. +*The preference key to use to get the behavior to implements is : '''org.eclipse.papyrus.uml.tools.utils.internal.preferences.NameElementNamingStrategyPreferenceInitializer.NAMED_ELEMENT_INDEX_INITIALIZATION''' has been created to allow to the user to choose the naming. +*All the code providing the preferences is in the plugin '''org.eclipse.papyrus.uml.tools.utils'''. +*The class in charge of the calculus of the name is and using the preference is '''NamedElementUtil'''. +*Excepted some classes (which should probably be refactored), we think that the call to the methods used to get the new element's name must provide to an ''EditHelperAdvice''. +*The best example of clean usage is '''org.eclipse.papyrus.uml.service.types.helper.advice.NamedElementInitializerHelperAdvice''' which call '''NamedElementUtil''' + + + + diff --git a/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc-main-toc.xml b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc-main-toc.xml new file mode 100644 index 00000000000..ee4e13612b2 --- /dev/null +++ b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc-main-toc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc.mediawiki b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc.mediawiki new file mode 100644 index 00000000000..c6a543e7ce4 --- /dev/null +++ b/plugins/doc/org.eclipse.papyrus.uml.doc/resource/namingStrategy-userDoc.mediawiki @@ -0,0 +1,13 @@ +=Naming Strategies= +Until Papyrus Oxygen.3, the created NamedElement were automatically named. The name was found according to the element's UML Metaclass, suffixed by an index. This index was found crossing all the elements in the owner until to build a unique name (''Metaclass' name + index''). This strategy cost many time for huge model and most of the time, the found name is replaced by the user just after the element's creation. + +Since Papyrus Oxygen.3, we implement new strategies, to reduce the time consumption. +*'''no index''': the created element is named according to its Metaclass. We have no warranty about the uniqueness of its name. +*'''quick index''': the created element is named according to its Metaclass. This name is suffixed by an index (typically, the number of the elements already contained by its parent +1). We don't check the unicity of the name. +*'''unique index''': the initial Papyrus strategy + + +Papyrus uses the '''quick index''' strategy by default. + +A preference has been created to allow to the user to choose the naming. To change it, go into '''Window > Preferences > Papyrus > UML Naming Strategy'''. +[[Image:images/nameStrategy-userDoc/NamingStrategyPreferencePage.png]] -- cgit v1.2.3