Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[mdt-papyrus.dev] CSS diagram refresh interaction with CanonicalEditPolicy

Hi, Team,

I have a small problem with the implementation of diagram refresh when CSS styles are changed (in particular, adding a stylesheet to a diagram or adding a style class to a view). The problem is that the refresh is performed asynchronously. Consequently, the CanonicalEditPolicy will do its refresh (creating child views and connections) in a non-undoable context (an unprotected write transaction).

If, instead, the refresh were done synchronously in the context of the command execution that added the stylesheet or style class, then the CanonicalEditPolicy would take advantage of that transaction and let its changes be recorded for undo/redo.

    Why is the diagram refresh run asynchronously by the CSSEngine?

Ordinarily, the unprotected nature of canonical changes isn’t a problem because undoing and redoing edits in the semantic model will be detected by the CanonicalEditPolicy and it will make the corresponding changes in the diagram. However, in this case, there are some non-trivial problems:

  • undo the CSS change leaves possibly very significant updates to the diagram intact, but it undoes the activation of the CanonicalEditPolicy
  • subsequent undo of creation of semantic elements that were shown in the diagram by CanonicalEditPolicy will not delete views created by CanonicalEditPolicy because that edit policy is no longer active
  • the end result is that we can get stale views (circle-X or worse) in the diagrams

Any suggestions how I can resolve this problem? Would it be safe to make the CSS-triggered diagram refresh synchronous?

Thanks,

Christian



Back to the top