Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » java.lang.IllegalStateException: Cannot modify resource set without a write transaction(How to allow model changes without transactions.)
java.lang.IllegalStateException: Cannot modify resource set without a write transaction [message #1694865] Fri, 08 May 2015 14:28 Go to next message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 94
Registered: May 2010
Member
Hi,

We just started to use Sirius few weeks ago. It is really great. Unfortunately I have trouble to integrate it into an existing project. We have a very huge extensible meta-model that is divided into many extensible sub meta-models. Most parts of the models are changed by the user via the Editor and UI Properties. However, many parts are populated on purpose without using any command stack or editing domain. For these parts, we do not care about undo/redo capabilities. We use for few years the default generated EMF Editor and we do not have any issue. When I use the Model Explorer and try to browse the same EMF model I get IllegalStateExceptions. I know that we must use EditingDomain to change models. But this is not an adequate use case for us mainly because our some parts of the EMF models are connected to non-UI interface modules. This really prevents us to exploit Sirius. Is there a way to fix this.

I am a bit confused and I do not know how to address this fundamental question. If further explanations are required please let me know.

Thanks in advance for any tips

Régent Wink
Re: java.lang.IllegalStateException: Cannot modify resource set without a write transaction [message #1694988 is a reply to message #1694865] Mon, 11 May 2015 08:58 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 267
Registered: July 2009
Senior Member
Le 08/05/2015 16:28, Regent LArcheveque a écrit :
> Hi,

Hi,

> We just started to use Sirius few weeks ago. It is really great.

Thanks.

> Unfortunately I have trouble to integrate it into an existing project.
> We have a very huge extensible meta-model that is divided into many
> extensible sub meta-models. Most parts of the models are changed by
> the user via the Editor and UI Properties. However, many parts are
> populated on purpose without using any command stack or editing domain.
> For these parts, we do not care about undo/redo capabilities. We use
> for few years the default generated EMF Editor and we do not have any
> issue. When I use the Model Explorer and try to browse the same EMF
> model I get IllegalStateExceptions. I know that we must use
> EditingDomain to change models. But this is not an adequate use case
> for us mainly because our some parts of the EMF models are connected to
> non-UI interface modules. This really prevents us to exploit Sirius.
> Is there a way to fix this.
> I am a bit confused and I do not know how to address this fundamental
> question. If further explanations are required please let me know.

Yes, this description is quite too simple to help you. When exactly
occurs the IllegalStateException, on which action?
>
> Thanks in advance for any tips
>
> Régent ;)

Regards,

--
Laurent Redor - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: java.lang.IllegalStateException: Cannot modify resource set without a write transaction [message #1695019 is a reply to message #1694988] Mon, 11 May 2015 12:38 Go to previous messageGo to next message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 94
Registered: May 2010
Member
Hi Laurent,

the problem occurs when I start to dig into the model via the Model Explorer. At that point, we have overloaded getters (using getter<Gen>, getter and generated NOT) that get called. Some getters change the model without using any transaction on purpose. I do not know if these information are enough. I'll try to reproduce my problem with a simple example and I'll post it.

Wink

Re: java.lang.IllegalStateException: Cannot modify resource set without a write transaction [message #1695048 is a reply to message #1695019] Mon, 11 May 2015 15:15 Go to previous messageGo to next message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 267
Registered: July 2009
Senior Member
Le 11/05/2015 14:38, Regent LArcheveque a écrit :
> Hi Laurent,
> the problem occurs when I start to dig into the model via the Model
> Explorer. At that point, we have overloaded getters (using getter<Gen>,
> getter and generated NOT) that get called. Some getters change the
> model without using any transaction on purpose.

:(

> I do not know if these
> information are enough.

I think it's enough. Unfortunately, enough to say, that I not really see
a solution except impacting your code to respect EMFT.

> I'll try to reproduce my problem with a simple
> example and I'll post it.
>

In a first time, could you join the corresponding stack of the
llegalStateException? To confirm that the problem is the
TransactionChangeRecorder that checks the write access before modifying
the model.

> ;)
>
>



--
Laurent Redor - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: java.lang.IllegalStateException: Cannot modify resource set without a write transaction [message #1695187 is a reply to message #1695048] Tue, 12 May 2015 14:31 Go to previous messageGo to next message
Regent LArcheveque is currently offline Regent LArchevequeFriend
Messages: 94
Registered: May 2010
Member
Hi Laurent,

Indeed it is the TransactionChangeRecorder that reports the problem.

Here is the error log stack:

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 ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshMapLayerImpl.setMeshIsDirty(CartesianTriangularMeshMapLayerImpl.java:97)
at ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshURLMapLayerImpl.loadMesh(CartesianTriangularMeshURLMapLayerImpl.java:349)
at ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshURLMapLayerImpl.getMesh(CartesianTriangularMeshURLMapLayerImpl.java:128)
at ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshURLMapLayerImpl.getCurrentMesh(CartesianTriangularMeshURLMapLayerImpl.java:174)
at ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshMapLayerImpl.getAbstractMapLayerNode(CartesianTriangularMeshMapLayerImpl.java:208)
at ca.gc.asc_csa.symphony.environment.impl.MapNodeImpl.addLayer(MapNodeImpl.java:215)
at ca.gc.asc_csa.symphony.environment.impl.MapNodeImpl$1$1.run(MapNodeImpl.java:299)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Re: java.lang.IllegalStateException: Cannot modify resource set without a write transaction [message #1698947 is a reply to message #1695187] Fri, 19 June 2015 06:33 Go to previous message
Laurent Redor is currently offline Laurent RedorFriend
Messages: 267
Registered: July 2009
Senior Member
I have another questions concerning your problem:
- Why is the model modified during the getter calls? What are the reasons?

Another approach is to add the "content" during the initialization
(creation) of each new instance of object (and not to add it during the
getter call).

Le 12/05/2015 16:31, Regent LArcheveque a écrit :
> Hi Laurent,
> Indeed it is the TransactionChangeRecorder that reports the problem.
>
> Here is the error log stack:
>
> 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
> ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshMapLayerImpl.setMeshIsDirty(CartesianTriangularMeshMapLayerImpl.java:97)
>
> at
> ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshURLMapLayerImpl.loadMesh(CartesianTriangularMeshURLMapLayerImpl.java:349)
>
> at
> ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshURLMapLayerImpl.getMesh(CartesianTriangularMeshURLMapLayerImpl.java:128)
>
> at
> ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshURLMapLayerImpl.getCurrentMesh(CartesianTriangularMeshURLMapLayerImpl.java:174)
>
> at
> ca.gc.asc_csa.symphony.environment.impl.CartesianTriangularMeshMapLayerImpl.getAbstractMapLayerNode(CartesianTriangularMeshMapLayerImpl.java:208)
>
> at
> ca.gc.asc_csa.symphony.environment.impl.MapNodeImpl.addLayer(MapNodeImpl.java:215)
>
> at
> ca.gc.asc_csa.symphony.environment.impl.MapNodeImpl$1$1.run(MapNodeImpl.java:299)
>
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


--
Laurent Redor - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Laurent Redor - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Context menu and multiple selection
Next Topic:My tree items collapse when the semantic model is modified
Goto Forum:
  


Current Time: Mon Jan 18 02:38:02 GMT 2021

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

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

Back to the top