Skip to main content



      Home
Home » Eclipse Projects » Sirius » Cannot Modify Resource Set
Cannot Modify Resource Set [message #1849298] Wed, 12 January 2022 02:06 Go to next message
Eclipse UserFriend
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 05:51 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Cannot Modify Resource Set [message #1849310 is a reply to message #1849306] Wed, 12 January 2022 08:10 Go to previous message
Eclipse UserFriend
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 May 07 10:49:57 EDT 2025

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

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

Back to the top