From e08dd487037529baf1d6f873c09564133d53f51c Mon Sep 17 00:00:00 2001 From: Marko Luukkainen Date: Fri, 26 Jun 2020 10:49:20 +0300 Subject: [PATCH] Allow Issues and Profiles to be used on non standard diagram viewers As in diagram viewers that are not based on Diagramming/Modelling ontologies. gitlab #564 Change-Id: Ia6f4c94f76b085e0741e62a1312b2e1fd457fe86 --- .../profile/view/ActiveRuntimeDiagramInputSource.java | 8 +++++++- .../org/simantics/diagram/runtime/RuntimeVariable.java | 2 ++ .../modeling/ui/diagram/style/IssueDecorationStyle.java | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java index fb07993ac..be0b062ad 100644 --- a/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java +++ b/bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java @@ -37,6 +37,7 @@ import org.simantics.db.common.request.UniqueRead; import org.simantics.db.exception.DatabaseException; import org.simantics.db.management.ISessionContext; import org.simantics.db.procedure.Procedure; +import org.simantics.diagram.runtime.RuntimeDiagramManager; import org.simantics.diagram.stubs.DiagramResource; import org.simantics.utils.ObjectUtils; import org.simantics.utils.ui.SWTUtils; @@ -170,7 +171,12 @@ public class ActiveRuntimeDiagramInputSource implements WorkbenchSessionContextI } protected void editorActivated(IEditorPart part) { - Resource resource = part.getAdapter(Resource.class); + RuntimeDiagramManager rdm = part.getAdapter(RuntimeDiagramManager.class); + Resource resource = null; + if (rdm != null) + resource = rdm.getRuntimeDiagram(); + if (resource == null) + resource = part.getAdapter(Resource.class); lastInputResource = resource; if (ownerIsVisible) { testAndChangeInput(resource); diff --git a/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java b/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java index 994370670..e7d411f85 100644 --- a/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java +++ b/bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java @@ -65,6 +65,8 @@ class RuntimeVariable extends TernaryRead { private static final String DECORATION_NODE_NAME = "issueDecorations"; //$NON-NLS-1$ - private List getContexts(ReadGraph graph, Resource element) throws DatabaseException { + protected List getContexts(ReadGraph graph, Resource element) throws DatabaseException { ModelingResources MOD = ModelingResources.getInstance(graph); List result = new ArrayList(3); -- 2.47.1