Skip to content
Snippets Groups Projects
Commit 0b9e76b5 authored by Sergey Zverlov's avatar Sergey Zverlov
Browse files

partial fix of the issue (cf. issue description) during the gui sprint

refs 2347
parent 3d0dc67f
No related branches found
No related tags found
No related merge requests found
......@@ -200,7 +200,8 @@ public class CopyPasteUtils {
if(copy instanceof INamedElement) {
String copyName = ((INamedElement)copy).getName();
int iterator = 0;
for(EObject o : target.eContents()) {
EList<EObject> contentsAtTwoLevels = getContentsAtTwoLevels(target);
for(EObject o : contentsAtTwoLevels) {
// check class types
if(o.getClass().isInstance(copy) && o instanceof INamedElement) {
INamedElement contained = (INamedElement)o;
......@@ -238,4 +239,19 @@ public class CopyPasteUtils {
((INamedElement)copy).setName(newName);
}
}
/**
* Creates a @{link {@link EList} of the eContents of the current {@link EObject} and the
* eConents of its container.
*/
private static EList<EObject> getContentsAtTwoLevels(EObject target) {
EList<EObject> containtsOfContainer = target.eContainer().eContents();
EList<EObject> contents = target.eContents();
EList<EObject> allContents = new BasicEList<EObject>();
allContents.addAll(containtsOfContainer);
allContents.addAll(contents);
return allContents;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment