[518259] Fix Model Explorer refresh not working for new representations

Creating a new representation now always refresh correctly the model
explorer. It means the corresponding item under its associated model
element is now made visible after creation in all cases.

Bug: 518259
Change-Id: I7923e85fa1e76d3179515ae42a4607bdbd3df997
Signed-off-by: pguilet <pierre.guilet@obeo.fr>
diff --git a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/DAnalysisSessionImpl.java b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/DAnalysisSessionImpl.java
index 66bd7ee..af44309 100644
--- a/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/DAnalysisSessionImpl.java
+++ b/plugins/org.eclipse.sirius/src/org/eclipse/sirius/business/internal/session/danalysis/DAnalysisSessionImpl.java
@@ -1173,6 +1173,13 @@
                 }
             }
 
+            // We initialize the cross referencer and put it as adapter of this session before initializing local
+            // triggers to be sure that RepresentationChangedAdapter will always be after the cross referencer in
+            // adapted objects. It avoids refreshing the Model Explorer listening to the RCA before updating the cross
+            // referencer with new created representations. And thus missing the new created representation under its
+            // associated model element when refreshing Model Explorer.
+            registerResourceInCrossReferencer(sessionResource);
+
             DViewOperations.on(this).updateSelectedViewpointsData(new SubProgressMonitor(monitor, 10));
             initLocalTriggers();