Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 346202

Summary: [serializer] for model-copies, allow delegation to original model to access nodemodel
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Moritz Eysholdt CLA 2011-05-18 05:32:40 EDT
For refactoring-operations, the serializer might not be invoked on the original model, but on a smaller *copied* version of a subtree of the model. This is reasonable to have a fast an robust mechanism to calculate the text-changes that will eventually be applied by the refactoring.

serializer 1.0 (ParseTreeConstructor) has no API to support this.

in serializer 2.0, the SemanticNodeProvider could need a mechanism to supply a copiedEObject-to-originalEObject mapping.

workaround: subclass the SemanticNodeProvider. Furthermore it needs to be ensured that all other components of the serializer only traverse the node model but don't access the node adapters or node.getSemanticObject().
Comment 1 Sebastian Zarnekow CLA 2011-05-18 05:38:09 EDT
Since EObject's equality is based on identity, this sounds like a very errorprone approach to me. Utilities such as NodeModelUtils make assumptions on the invariants of the node model such as the node is an adapter for the EObject that's returned by #getSemanticEObject if #hasDirectSemanticElement is true etc.

I think the approach that is followed by the refactoring framework is more promising. That is, perform the modification on an own resource set.
Comment 2 Sven Efftinge CLA 2012-11-21 05:11:21 EST
See comment 1 also IMHO this kind of problem should be handled specifically.