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

Bug 320898

Summary: CanonicalEditPolicies: Views immutable asynchronously
Product: [Modeling] GMF-Runtime Reporter: Hauke Fuhrmann <haf>
Component: GeneralAssignee: Project Inbox <gmf-runtime-inbox>
Status: NEW --- QA Contact:
Severity: major    
Priority: P3 CC: litaocdl
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Hauke Fuhrmann CLA 2010-07-26 09:42:21 EDT
Build Identifier: 20100617-1415

In all CanonicalEditPolicies the last call in a semanticRefresh() is

CanonicalEditPolicy.makeViewsImmutable(createdViews);

This executes an AsyncCommand *asynchronously* in the UI-Thread. 

The problem is, that the DiagramEventBroker listens to new View creations and decides whether the view gets persisted or not according to its mutable flag. If the flag is not set, the view does not get persisted. 

When the mutable flag is set asynchronously, the DiagramEventBroker.transactionAboutToCommit() usually gets executed *before* the mutable flag gets set. Hence most freshly created views do not get persisted.



Reproducible: Always

Steps to Reproduce:
1. Create fresh diagram file and open Editor
2. Do semantical changes on the model with not changing the views manually (we do with Xtend M2M transformations)
3. save and close Diagram (views are correctly visible)
4. re-open diagram -> Some views are missing and we get

"IRJS0007E Semantic refresh failed."

Looking at the serialized notation model, we find that some of the Shapes that should be there haven't been serialized and hence some of the connections do not find their source and target Shapes.

Another way to reproduce:

1. Create semantics file
2. Initialize Diagram from semantics file (Context Menu Command)
3. Immediately save (no manual editing), close diagram
4. Re-open -> for many GMF generated editors we've tried, the diagram is empty
Comment 1 Hauke Fuhrmann CLA 2010-08-02 06:48:51 EDT
I guess this post to gmf-dev mailinglist is related and another case for this bug:
http://dev.eclipse.org/mhonarc/lists/gmf-dev/msg01601.html
Comment 2 Tao LI CLA 2014-06-04 06:06:08 EDT
I also noticed this behavior in our product (IDA), we have a diagram support persist and transient children. but we noticed some shape new created could not set to persist due to it is mutable, unless we close and reopen the diagram then we can set those shapes to persist, does there any workaround to solve this issue ?