I have an EMF-model and the generated editor. In the model/editor, it is possible to connect Element "Unit"(U) with "Specification"(S). Now, I want to have a specialized CSS-style for S if at least one U satisfies S. But (to the best of my knowledge) there is no way to accomplish this (with Selectors, for example) in a CSS-Stylesheet for Papyrus.
For this reason, I added an additional Property for S, called "Mapped" (should be true, when at least one U satisfies S, otherwise it is false). Then, I tried to set the "Mapped"-Property out of code, when one / more connections were added (in the handleNotification - Method):
notifier.setMapped(true);
with excception:
IllegalstateException: Cannot modify resource set without a write transaction
The second solution resulted in another Exception, but with the same semantical result:
ed.getCommandStack().execute(SetCommand.create(ed, notifier,
xyzPackage.Literals.SPECIFICATION__MAPPED, true));
with exception:
java.lang.IllegalStateException: Cannot activate read/write
transaction in read-only transaction context
Does anyone know how to handle these Exceptions or have a good workaround? The main aim is that the CSS-File recognizes the change of the "Mapped"-Property.
Thanks a lot :)