Bug 139049

Summary: Runtime EMF API must be aware of cross-resource containment
Product: [Modeling] GMF-Runtime Reporter: Christian Damus <give.a.damus>
Component: GeneralAssignee: Christian Damus <give.a.damus>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P2 CC: vramaswa
Version: 1.0Keywords: contributed
Target Milestone: 1.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Updates resulting from the sweep none

Description Christian Damus CLA 2006-04-27 15:25:47 EDT
The GMF Runtime EMF APIs must be aware of possible cross-resource containment structures in the models on which they operate.  The following plug-ins should be swept:

  - org.eclipse.gmf.runtime.emf.clipboard.core
  - org.eclipse.gmf.runtime.emf.core

to ensure that no assumptions are made about the object-resource relationships of any objects.  In particular, usages of the following APIs must be revisited:

EObject.eResource() - An EObject and its container do not necessarily have the same resource any more.

EObject.eContainer() - An EObject and its container do not necessarily have the same resource any more.

EObject.eContents() - May include objects from a different resource.

EObject.eAllContents() - May include objects from a different resource.

Resource.getContents() - May include children of objects from a different resource.

Resource.getAllContents() - May include objects from a different resource.
Comment 1 Christian Damus CLA 2006-04-27 15:46:26 EDT
Created attachment 39712 [details]
Updates resulting from the sweep

Attached a patch that addresses some assumptions about the object/resource relationships that are invalidated by cross-resource containment.  In particular:

  - update the clipboard saving resource to save cross-resource contained
    objects in situ, not as proxies
  - update the copying resource to correctly obtain the IDs of objects from
    the resources that actually contain them, and to correctly determine
    whether an object is in the resource being copied or any of its children
  - ensure that an object removed from its container is also removed from
    its resource, if they are in different resources

Also added some comments to explain why, in places, code that would resolve containment proxies is correct to do so.
Comment 2 Christian Damus CLA 2006-04-27 15:47:39 EDT
Adding Vishy to cc: to review and (hopefully) commit the patch.
Comment 3 Vishy Ramaswamy CLA 2006-04-27 20:28:03 EDT
Reviewed and applied patch
Comment 4 Richard Gronback CLA 2008-08-13 13:04:20 EDT
[target cleanup] 1.0 RC was the original target milestone for this bug
Comment 5 Eclipse Webmaster CLA 2010-07-19 12:24:35 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime EMF was the original product and component for this bug