Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Forms] Working with TransactionalEditingDomain(Getting exceptions in EMF forms when the editor uses TransactionalEditingDomain)
[EMF Forms] Working with TransactionalEditingDomain [message #1754351] Thu, 16 February 2017 16:08 Go to next message
Pavel Vlasov is currently offline Pavel VlasovFriend
Messages: 23
Registered: December 2015
Junior Member
I use EMF Forms in the following fashion:

ECPSWTViewRenderer.INSTANCE.render(parent, eObject);

It all works good enough when a generated editor uses the default AdapterFactoryEditingDomain. However, I have an editor which uses TransactionalCommandStack and TransactionalEditingDomain because I have actions which use RecordingCommand. In this scenario EMF Forms throw exceptions when I try to manipulate references (attributes are fine):

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.processObjectNotification(TransactionChangeRecorder.java:284)
at org.eclipse.emf.transaction.impl.TransactionChangeRecorder.notifyChanged(TransactionChangeRecorder.java:240)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleEObject.dynamicSet(EStructuralFeatureImpl.java:2744)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(BasicEObjectImpl.java:1127)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1101)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1071)
at org.eclipse.emfforms.internal.editor.ecore.referenceservices.EcoreReferenceService.addModelElement(EcoreReferenceService.java:205)
at org.eclipse.emfforms.internal.editor.ecore.referenceservices.EcoreReferenceService.addExistingModelElements(EcoreReferenceService.java:220)
at org.eclipse.emf.ecp.view.internal.core.swt.renderer.LinkControlSWTRenderer$6.widgetSelected(LinkControlSWTRenderer.java:242)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4418)

By looking at EcoreReferenceService.java:205 (https://github.com/master-mck/ECP/blob/8a4cca028e01ae88a846549917793f4c8140e143/bundles/org.eclipse.emfforms.editor.ecore/src/org/eclipse/emfforms/internal/editor/ecore/referenceservices/EcoreReferenceService.java#L205) I see that for some reason editing domain and command stack are not used, although they are used several lines above.

Any advice how to use EMF Forms with a TransactionalEditingDomain?
Re: [EMF Forms] Working with TransactionalEditingDomain [message #1754391 is a reply to message #1754351] Fri, 17 February 2017 08:10 Go to previous messageGo to next message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 79
Registered: September 2016
Member
Hi,

that look like a bug to me, it actually should use a command. Could you create a Bug Report and ideally a contribution?

Thanks and best regards

Jonas

--
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/


--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMF Forms] Working with TransactionalEditingDomain [message #1754392 is a reply to message #1754391] Fri, 17 February 2017 08:10 Go to previous message
Jonas Helming is currently offline Jonas HelmingFriend
Messages: 79
Registered: September 2016
Member
As a quick work arounf and for testing you could replace the reference service with a fixed version...

--
Jonas Helming
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:[EMFForms]Disable Create and Link button in Table Control
Next Topic:[EMFForms] Support for Nebula's GeoMap widget
Goto Forum:
  


Current Time: Thu Sep 20 08:21:16 GMT 2018

Powered by FUDForum. Page generated in 0.03465 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top