When having a URCap in HTML, PolyScope calls into the URCap code using the annotated callbacks, when a user interacts with a program node.
Before calling the annotated callback in the URCap Contribution, PolyScope buffers the DataModel for the node.
When the callback returns, the updated DataModel is compared to the old one.
Any changes happened to the DataModel within this time, will be grouped into one “Undoable Action” and will be placed on the Undo Stack.
In that sense, PolyScope handles the View-domain and UndoRedoManager for you automatically, by using HTML.
In Swing, the complete interaction between View and Contribution happens inside the URCap itself.
Therefore PolyScope does not have the ability to check what changes should be grouped together as a single Undoable Action.
That is why the UndoRedoManager has been added to the Swing framework, so the URCap can group related changes as a single undoable change.
The reason for grouping the changes is, that one single user interaction, could potentially cause multiple changes to the DataModel.
If the changes are not grouped, this can cause an inconsistent state, when the user clicks “Undo” or “Redo” buttons in PolyScope.
From PolyScope 3.6 and 5.0, we will now throw an exception, if the DataModel is altered outside of the scope of either of the two scenarios mentioned above.
If the DataModel is changes asynchronously, and the user clicks undo, this could revert the last value from the DataModel. And would cause odd, and in-transparent issues to the user.
Note, that all of the above is only applicable to Program Nodes.
Since Installation domain is not covered by Undo-Redo functionality, this restriction does not apply to Installation Nodes.
A worksround for your issue could be to use the Installation Node to perform this check, where the program nodes can later call this value from the Installation nodes DataModel, to check the value there.
It also alleviates you from having to do this check for each node in the program, but only one time in the Installation node.