Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » EEF and a transactional editing domain.
EEF and a transactional editing domain. [message #639386] Tue, 16 November 2010 06:05 Go to next message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 866
Registered: July 2009
Senior Member
Hi,

When using a transactional editing domain, EEF has to be adapted to have
all model mutations executed through the command stack of that editing
domain with commands.

The EEFTreeMasterPart class writes to the model directly, which results
in the exception further below.


This is the code fragment for the "add" button on the MasterPart.

EList<EObject> list = (EList<EObject>)
modelRoot.eGet(commandParameter.getReference());

list.add(EcoreUtil.create(commandParameter.geteClass()));
try {
modelRoot.eResource().save(Collections.EMPTY_MAP);

} catch (IOException e1) {
e1.printStackTrace();
}
I would like to adapt this to use a command. Would this be any benefit
for the project? Are any changes planned in this area?


java.lang.IllegalStateException: Cannot modify resource set without a
write transaction
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:348)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:302)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:284)
at
org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:240)
at
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:380)
at
org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(E coreEList.java:255)
at
org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:300)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList. java:307)
at
org.eclipse.emf.eef.runtime.ui.widgets.masterdetails.tree.EE FTreeMasterPart$2$1.widgetSelected(EEFTreeMasterPart.java:28 5)
at
Re: EEF and a transactional editing domain. [message #639406 is a reply to message #639386] Tue, 16 November 2010 06:52 Go to previous message
Goulwen Le Fur is currently offline Goulwen Le Fur
Messages: 124
Registered: July 2009
Senior Member
Hi Chrisophe,

You're right, we should use a command to perform this operation. You can
provides a patch to correct it.

Thanks !

--
Goulwen Le Fur - goulwen.lefur@obeo.fr

Le 16/11/2010 12:05, Christophe Bouhier a écrit :
> Hi,
>
> When using a transactional editing domain, EEF has to be adapted to have
> all model mutations executed through the command stack of that editing
> domain with commands.
>
> The EEFTreeMasterPart class writes to the model directly, which results
> in the exception further below.
>
>
> This is the code fragment for the "add" button on the MasterPart.
>
> EList<EObject> list = (EList<EObject>)
> modelRoot.eGet(commandParameter.getReference());
>
> list.add(EcoreUtil.create(commandParameter.geteClass()));
> try {
> modelRoot.eResource().save(Collections.EMPTY_MAP);
>
> } catch (IOException e1) {
> e1.printStackTrace();
> }
> I would like to adapt this to use a command. Would this be any benefit
> for the project? Are any changes planned in this area?
>
>
> java.lang.IllegalStateException: Cannot modify resource set without a
> write transaction
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ssertWriting(TransactionChangeRecorder.java:348)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.a ppendNotification(TransactionChangeRecorder.java:302)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.p rocessObjectNotification(TransactionChangeRecorder.java:284)
>
> at
> org.eclipse.emf.transaction.impl.TransactionChangeRecorder.n otifyChanged(TransactionChangeRecorder.java:240)
>
> at
> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify (BasicNotifierImpl.java:380)
>
> at
> org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(E coreEList.java:255)
>
> at
> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUniq ue(NotifyingListImpl.java:300)
>
> at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList. java:307)
> at
> org.eclipse.emf.eef.runtime.ui.widgets.masterdetails.tree.EE FTreeMasterPart$2$1.widgetSelected(EEFTreeMasterPart.java:28 5)
>
> at
Previous Topic:Model Refactoring using EMF Refactor
Next Topic:EMF Compare into plug-in eclipse
Goto Forum:
  


Current Time: Mon Apr 21 03:11:16 EDT 2014

Powered by FUDForum. Page generated in 0.04016 seconds