From 406b6b16dc26c8e3d05fc6bae078decf9a1dd74d Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Tue, 10 Mar 2020 13:21:21 +0200 Subject: [PATCH] Expose diagramHints for customization gitlab #494 Change-Id: I7545e9ff469cc819a07b48bbdfe3e781c8455b5d (cherry picked from commit 59504249e01a0d803c5c4fdd4ba581d8272fee18) --- .../ui/sg/DiagramSceneGraphProvider.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java index d3170b950..1db2ba151 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/sg/DiagramSceneGraphProvider.java @@ -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( -- 2.47.1