eclipse-sirius / sirius-desktop

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

Transient layers are not activated when diagram is reopened #431

Open peransin-obeo opened 4 months ago

peransin-obeo commented 4 months ago

When opening an existing diagram for the first time after loading a session, transient layer is not activated.

This is not conform with documentation: https://eclipse.dev/sirius/doc/specifier/diagrams/Diagrams.html#Transientlayer

The behavior occurs while executing: https://github.com/eclipse-sirius/sirius-desktop/blob/33b42e3fe183b833af4bd05fe6514d18f6711454/plugins/org.eclipse.sirius.diagram.ui/src-diag/org/eclipse/sirius/diagram/ui/tools/internal/editor/DDiagramEditorImpl.java#L598

The 'transientLayersToActivate' list contains the same layers twice. As activation is performed by a toggling command, layer is activated the desactivated.

The simplest fix is to check the getInitialActiveLayers method does not provide the same layer twice by adding a containment verification in this loop: https://github.com/eclipse-sirius/sirius-desktop/blob/33b42e3fe183b833af4bd05fe6514d18f6711454/plugins/org.eclipse.sirius.diagram/src/org/eclipse/sirius/diagram/business/internal/metamodel/helper/LayerHelper.java#L373

Tested in version 7.1.0