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

Bug 338385

Summary: Save process of EMTLResource should work with EMF Transaction
Product: [Modeling] Acceleo Reporter: Mariot Chauvin <mariot.chauvin>
Component: CoreAssignee: Project Inbox <acceleo-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: stephane.begaudeau
Version: 3.0.0Flags: mariot.chauvin: indigo+
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Mariot Chauvin CLA 2011-02-28 05:13:31 EST
Currently save process of EMTLResource do a model modification in its save method. This is not expected by EMF Transaction and it's not advised in a general way

See http://dev.eclipse.org/newslists/news.eclipse.tools.emf/msg31691.html

Here is the stacktrace :

java.lang.IllegalStateException: Cannot modify resource set without a write transaction
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.assertWriting(TransactionChangeRecorder.java:348)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.appendNotification(TransactionChangeRecorder.java:302)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.processResourceNotification(TransactionChangeRecorder.java:272)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.notifyChanged(TransactionChangeRecorder.java:238)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatchNotification(NotifyingListImpl.java:267)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:300)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
at org.eclipse.acceleo.model.mtl.resource.EMtlResourceImpl.getPositions(EMtlResourceImpl.java:252)
at org.eclipse.acceleo.model.mtl.resource.EMtlResourceImpl.doSave(EMtlResourceImpl.java:95)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1406)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.saveOnlyIfChangedWithFileBuffer(ResourceImpl.java:1017)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:976)
Comment 1 Stephane Begaudeau CLA 2011-03-08 08:59:45 EST
Thanks to a piece of code from cbrun (eSetDeliver(false); ... eSetDeliver(true);) this should not be a problem anymore. I will test it with Acceleo 3.1 M6 next week.
Comment 2 Stephane Begaudeau CLA 2011-04-11 11:44:25 EDT
Acceleo does not send any notifications during the saving process anymore. The fix will be available in Acceleo 3.1.0M7.