summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit Maggi2014-02-18 09:57:09 (EST)
committerVincent Lorenzo2014-03-18 09:56:59 (EDT)
commit26443b04fa317e3a62af884db62af36ca3969553 (patch)
treeed14b9f2952e66eef0907e915de06d9e3817b2e4
parent06a5b224243938ce831e99640be8f65ae871d692 (diff)
downloadorg.eclipse.papyrus-26443b04fa317e3a62af884db62af36ca3969553.zip
org.eclipse.papyrus-26443b04fa317e3a62af884db62af36ca3969553.tar.gz
org.eclipse.papyrus-26443b04fa317e3a62af884db62af36ca3969553.tar.bz2
Bug 290261 : The Copy_of prefix is now only present if there is an
object with the same name on the paste location Signed-off-by: Benoit Maggi <benoit.maggi@cea.fr>
-rw-r--r--plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java
index 9223c88..b7f45fa 100644
--- a/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java
+++ b/plugins/uml/tools/org.eclipse.papyrus.uml.tools.utils/src/org/eclipse/papyrus/uml/tools/utils/NamedElementUtil.java
@@ -86,8 +86,17 @@ public class NamedElementUtil {
@SuppressWarnings("rawtypes")
public static String getDefaultCopyNameWithIncrement(NamedElement namedElement, Collection contents) {
- String newName = NLS.bind(COPY_OF + "_{0}_", namedElement.getName());
- return NamedElementUtil.getDefaultNameWithIncrementFromBase(newName, contents);
+ String rootName = namedElement.getName();
+ for(Object o : contents) {
+ if(o instanceof EObject) {
+ String name = EMFCoreUtil.getName((EObject)o);
+ if (rootName.equals(name)){
+ String newName = NLS.bind(COPY_OF + "_{0}_", rootName);
+ return NamedElementUtil.getDefaultNameWithIncrementFromBase(newName, contents);
+ }
+ }
+ }
+ return rootName;
}
@SuppressWarnings("rawtypes")