Trigger a Sirius refresh on specific graphical changes


In automatic refresh mode, representations are refreshed as soon as at least one semantic change is done. Graphical changes are not considered as they are not impacting the mapping precondition. In some cases, the mapping can depend on the graphical state. A typical example is the “collapse” state of a region to change the mapping according to it. Since Sirius 6.1.3, it is possible to register a new graphical change to trigger a Sirius refresh.

Register a new graphical change to trigger a Sirius refresh

The<Notification>) allows to consider some graphical modifications as requiring a refresh. This method is called through the pre-commit listener So it is called only if you are in automatic refresh mode or if the “forceRefresh” mode has been activated ( with the corresponding representation to refresh (
For the specific case of collapse/expand, current representation is automatically added as a force refresh representation. So the collapse/expand of a region automatically launch a refresh, even in manual refresh mode.


// Register a predicate to consider Collapse/Expand changes as impacting in diagram of kind "MyDiagramDescriptionName".
RefreshHelper.registerImpactingNotification(new Predicate<Notification>() {
    public boolean test(Notification notification) {
        if (notification != null) {
            if (NotationPackage.eINSTANCE.getDrawerStyle_Collapsed().equals(notification.getFeature())) {
                if (notification.getNotifier() instanceof EObject) {
                    Option<DDiagram> optionalDDiagram = new EObjectQuery((EObject) notification.getNotifier()).getParentDiagram();
                    if (optionalDDiagram.some()) {
                        return "MyDiagramDescriptionName".equals(optionalDDiagram.get().getDescription().getName);
        return false;

Unregister a previously register graphical changes

You can use<Notification>) to unregister a previously registered predicate.


The RefreshEditorsPrecommitListener is called after each changes. So each predicate added through registerImpactingNotification() will be called on each notification (until one is considered as impacting). These predicates must be efficient.