I am working with an EMF-model and its generated editor. In this model/editor, there is a connection between Element "Unit"(U) and "Specification"(S). My goal is to have a specific CSS style for S if at least one U satisfies S. Unfortunately, I have not found a way to achieve this using Selectors in a CSS Stylesheet for Papyrus.
To address this issue, I added a new Property for S called "Mapped" (which should be true when at least one U satisfies S, otherwise false). I attempted to set the "Mapped" property programmatically when connections were added like so:
notifier.setMapped(true);
However, I encountered an error:
IllegalstateException: Cannot modify resource set without a write transaction
An alternative approach resulted in a different Exception but had the same outcome:
ed.getCommandStack().execute(SetCommand.create(ed, notifier,
xyzPackage.Literals.SPECIFICATION__MAPPED, true));
This also led to an exception:
java.lang.IllegalStateException: Cannot activate read/write
transaction in read-only transaction context
If anyone has insights on how to handle these Exceptions or has a clever workaround, I would greatly appreciate it. The ultimate objective is for the CSS file to detect changes in the "Mapped" property.
Thank you :)