Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Cannot Modify Resource Set
Cannot Modify Resource Set [message #1849298] Wed, 12 January 2022 07:06 Go to next message
Hakan  Yüksek is currently offline Hakan YüksekFriend
Messages: 22
Registered: October 2021
Junior Member
Hi everyone, I have a sirius project and I am struggling to change a property of the node from service class.

When the user double clicked to node in the diagram , my service methods will be called. In my service methods open a new window and it gets input from the user. After that, the one property of the node which was double clicked, is setted according to the user input. But in there, I have a problem. When I am trying to set property of the node in the my service method, it gives the following exception.

java.lang.IllegalStateException: Cannot modify resource see without a write transaction

How can I solve this problem? What should I do?

Re: Cannot Modify Resource Set [message #1849306 is a reply to message #1849298] Wed, 12 January 2022 10:51 Go to previous messageGo to next message
Glenn Plouhinec is currently offline Glenn PlouhinecFriend
Messages: 22
Registered: April 2020
Junior Member
Hi Hakan,

I seem to have faced a similar problem recently. From memory, you need to execute a RecordingCommand like this:
        session.getTransactionalEditingDomain().getCommandStack().execute(new RecordingCommand(session.getTransactionalEditingDomain()) {
            @Override
            protected void doExecute() {
                // do something...
            }
        });

This code snippet is inspired by one of our test org.eclipse.sirius.tests.unit.api.refresh.ChangeIdAndLabelTests.testModificationOfIdOfSirius(), it may help you.

Best regards,
Glenn


Glenn Plouhinec - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Cannot Modify Resource Set [message #1849310 is a reply to message #1849306] Wed, 12 January 2022 13:10 Go to previous message
Hakan  Yüksek is currently offline Hakan YüksekFriend
Messages: 22
Registered: October 2021
Junior Member
Glenn Plouhinec wrote on Wed, 12 January 2022 10:51
Hi Hakan,

I seem to have faced a similar problem recently. From memory, you need to execute a RecordingCommand like this:
        session.getTransactionalEditingDomain().getCommandStack().execute(new RecordingCommand(session.getTransactionalEditingDomain()) {
            @Override
            protected void doExecute() {
                // do something...
            }
        });

This code snippet is inspired by one of our test org.eclipse.sirius.tests.unit.api.refresh.ChangeIdAndLabelTests.testModificationOfIdOfSirius(), it may help you.

Best regards,
Glenn


Hi Glenn, I have solved my problem. Thank you for your response.
Previous Topic:ELK Auto Layout - Get Class names of ELKNodes
Next Topic:How to enable "jump" feature for all edges in new Diagram by default?
Goto Forum:
  


Current Time: Wed Sep 28 16:34:17 GMT 2022

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

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

Back to the top