Bug 142115

Summary: Copy/Paste infrastructure should call EcoreUtil#remove() before adding pasted EObjects to new containers
Product: [Modeling] GMF-Runtime Reporter: Nicholas Bennett <nbennett>
Component: GeneralAssignee: Vishy Ramaswamy <vramaswa>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P1 Keywords: contributed
Version: 1.0   
Target Milestone: 1.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch as described in bug none

Description Nicholas Bennett CLA 2006-05-16 19:04:12 EDT
During the paste part of a cut/copy/paste operation, the GMF copy/paste infrastructure adds pasted elements to their new container without first calling EcoreUtil.remove().  For elements that are contained in a feature that supports cross-resource containment, this will correctly set the container of the element at the metamodel level, but will leave it contained within the LoadingEMFResource at the EMF level.  Subsequent post-processing will treat this case as an indication that the paste operation failed and replace the pasted element with a proxy reference.  In the cut/paste scenario, this reference will never be resolvable because the proxy URI refers to the source model for the element, from which it has been removed.  Also, the target resource will have problems saving and reloading because of these dangling hrefs to unresolvable proxies.

Attached is a patch to org.eclipse.gmf.runtime.emf.clipboard.core.ClipboardSupportUtil that fixes this problem.  Please consider applying it.
Comment 1 Nicholas Bennett CLA 2006-05-16 20:36:20 EDT
Created attachment 41681 [details]
patch as described in bug
Comment 2 Vishy Ramaswamy CLA 2006-05-17 10:27:03 EDT
Reviewed and applied patch
Comment 3 Vishy Ramaswamy CLA 2006-05-17 10:31:20 EDT
Committed the patch
Comment 4 Richard Gronback CLA 2008-08-13 13:05:03 EDT
[target cleanup] 1.0 RC3 was the original target milestone for this bug
Comment 5 Eclipse Webmaster CLA 2010-07-19 12:25:03 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime EMF was the original product and component for this bug