From fe7e77faebd92736a6e7002b96cf3c619f78138a Mon Sep 17 00:00:00 2001 From: jsimomaa Date: Sat, 16 Nov 2019 09:45:43 +0200 Subject: [PATCH] Introduce new DiagramViewer.getRuntimeFromManager() * The original DiagramViewer.getRuntime() returns cached version of the runtime diagram resource gitlab #416 Change-Id: Id2723f5deb94cdba15e815229d9a1931482ace16 (cherry picked from commit 9a37dabc6c0212ed3e14499c88df3208cd06f9b0) --- .../modeling/ui/diagramEditor/DiagramViewer.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java index 000689309..d7e66deb4 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewer.java @@ -236,6 +236,7 @@ public class DiagramViewer protected GridSnapAdvisor snapAdvisor; private RuntimeDiagramManager runtimeDiagramManager; + private Resource runtimeDiagramResourceCache; private HasDiagramSourceListener hasDiagramSourceListener; /** @@ -245,11 +246,18 @@ public class DiagramViewer */ protected WorkbenchSelectionProvider selectionProvider; - public Resource getRuntime() { + protected Resource getRuntimeFromManager() { RuntimeDiagramManager rtdm = runtimeDiagramManager; return (rtdm == null) ? null : rtdm.getRuntimeDiagram(); } + public Resource getRuntime() { + if (runtimeDiagramResourceCache != null) + return runtimeDiagramResourceCache; + runtimeDiagramResourceCache = getRuntimeFromManager(); + return runtimeDiagramResourceCache; + } + public ParametrizedRead getInputValidator() { return INPUT_VALIDATOR; } -- 2.47.1