Community
Participate
Working Groups
In Sirius documentation we can read : Decoration display update The decorations can be manually and automatically refreshed. - Manually, when the user clicks on the refresh button in the diagram tool bar. Automatically, according to semantic changes when: - the target semantic element of the DDiagramElement ( DSemanticDecorator_Target feature) is changed, - the semantic elements of the DDiagramElement ( DRepresentationElement_SemanticElements feature) are changed. They are defined with Associated Elements Expression on the mapping. It means that a specifier that defined decorations can not add new “semantic element”, dedicated to decorations, that would be listened to for the automatic refresh. My decoration does not match the second case (automatic refresh) but when I do a manual refresh the decoration is not refreshed at all.
As seen with Laurent Fasani, I've tried to programmatically refresh the decorations by using : new DecorationHelper(diagram).updateDecorations(layersToRefresh); This does not work because : - I need to run this code inside an EMF Transaction (easily solvable from my side) - in org.eclipse.sirius.diagram.business.internal.helper.decoration.DecorationHelperInternal.addDecoration(DDiagramElement, DecorationDescription) the following test makes the method return without updating my decoration. Indeed, the decoration is the same object, the precondition still evaluates to True but the image expression will return a different result. for (final Decoration decoration : element.getTransientDecorations()) { if (EcoreUtil.equals(decorationDescription, decoration.getDescription())) { return; } }
As seen with Laurent, we should not have a problem with EMF Transaction as long as we change only transient objects.
Created attachment 271975 [details] Reproduction sample Steps to reproduce : - import the two projects from the attached zip in your runtime - open the "new EPackage" diagram - activate the "transient layer" - a green car decoration (or ...) appears on each right side of the displayed nodes - select the abstract EPackage in the Model Explorer - change its name to "aaaaaa" (must not contains "abstract") - nothing is done on the diagram (auto refresh) : ok the changed element is not a semantic element of the diagram - click on the refresh button in the tabbar - KO decorations are not update - close and reopen the diagram or disable and reenable the "TransientDecoration" layer - OK the decorations have been changed to a yellow car