eclipse-sirius / sirius-desktop

Sirius Desktop: desktop-based graphical modelers for dedicated DSLs
https://eclipse.dev/sirius/
Eclipse Public License 2.0
14 stars 11 forks source link

Populate the diagram variable before configuring diagram background color #132

Closed vrichard12 closed 10 months ago

vrichard12 commented 1 year ago

Usage of a computed color on a diagram background doesn't work in every case when the RGB value expressions of the computed color make use of the diagram variable.

Most of the time, the diagram variable is set, but it seems it is due to a side effect. There is no guarantee that the value is set to the active diagram. In some conditions, the variable is set to another diagram. When the Sirius session has just been opened before opening a diagram, the diagram variable is not set at all.

The following workaround has been done in Information System Designer : https://github.com/ObeoNetwork/InformationSystem/commit/0876af41c05fc1abfd5a5c155cfc7ae82611b69d to override the DDiagramEditPart to make the diagram variable set in the configureBackground method.

This workaround would not be necessary if Sirius were handling the case.

Attached to this ticket is a sample project to experience this limitation on ObeoDesigner-Community-11.8.

When opening the representation for the first time, the diagram shows an intense blue background, which is not normal. Adding or removing an element on the diagram has the effect of declaring the diagram variable and makes the control of the background color work as expected. The more elements the diagram contains, the more intense the blue color is. The background color should be white when no elements are present on the diagram.

Close and reopen the modeling project to reproduce the wrong behavior.

vrichard12 commented 1 year ago

The attachments :

lredor commented 10 months ago

The above PR #190 fixes the problem and adds a corresponding test.

Steps to validate (based on initial Vincent's data):