Expose diagramHints for customization 22/3922/1
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 10 Mar 2020 11:21:21 +0000 (13:21 +0200)
committerMarko Luukkainen <marko.luukkainen@semantum.fi>
Tue, 10 Mar 2020 11:36:12 +0000 (11:36 +0000)
gitlab #494

Change-Id: I7545e9ff469cc819a07b48bbdfe3e781c8455b5d
(cherry picked from commit 59504249e01a0d803c5c4fdd4ba581d8272fee18)

bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java

index d3170b9506270350f5dde298d7e1285bee0f2d1a..1db2ba151c972dccd2c52bd5f92e95d40c2a73bf 100644 (file)
@@ -348,13 +348,7 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi
         }
 
         try {
-
-            IModelingRules modelingRules = Simantics.getSession().syncRequest(DiagramRequests.getModelingRules(resource, null));
-            if (modelingRules != null) {
-                initialHints.setHint(DiagramModelHints.KEY_MODELING_RULES, modelingRules);
-            }
-            
-            initialHints.setHint(SynchronizationHints.COPY_ADVISOR, getCopyAdvisor());
+               fillInitialDiagramHints(initialHints);
             
             final RuntimeDiagramManager runtimeDiagramManager = RuntimeDiagramManager.create(Simantics.getSession(), resource, modelURI, RVI);
             
@@ -385,6 +379,15 @@ public class DiagramSceneGraphProvider implements ICanvasSceneGraphProvider, IDi
         return ctx.getSceneGraph();
     }
     
+    protected void fillInitialDiagramHints(IHintContext initialHints) throws DatabaseException {
+         IModelingRules modelingRules = Simantics.getSession().syncRequest(DiagramRequests.getModelingRules(resource, null));
+          if (modelingRules != null) {
+              initialHints.setHint(DiagramModelHints.KEY_MODELING_RULES, modelingRules);
+          }
+          
+          initialHints.setHint(SynchronizationHints.COPY_ADVISOR, getCopyAdvisor());
+    }
+    
     protected IElementClassProvider createElementClassProvider(ReadGraph graph) throws DatabaseException {
         DiagramResource dr = DiagramResource.getInstance(graph);
         return ElementClassProviders.mappedProvider(