From: Marko Luukkainen Date: Tue, 10 Mar 2020 11:21:21 +0000 (+0200) Subject: Expose diagramHints for customization X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F82%2F3982%2F1;p=simantics%2Fplatform.git Expose diagramHints for customization gitlab #494 Change-Id: I7545e9ff469cc819a07b48bbdfe3e781c8455b5d --- 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(