Cannot Modify Resource Set [message #1849298] |
Wed, 12 January 2022 02:06  |
Eclipse User |
|
|
|
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 #1849310 is a reply to message #1849306] |
Wed, 12 January 2022 08:10  |
Eclipse User |
|
|
|
Glenn Plouhinec wrote on Wed, 12 January 2022 10:51Hi 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.
|
|
|
Powered by
FUDForum. Page generated in 0.06275 seconds