From: Marko Luukkainen Date: Fri, 26 Jun 2020 07:49:20 +0000 (+0300) Subject: Allow Issues and Profiles to be used on non standard diagram viewers X-Git-Tag: v1.43.0~11 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F27%2F4327%2F2;p=simantics%2Fplatform.git 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 --- 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);