]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Allow Issues and Profiles to be used on non standard diagram viewers 27/4327/2
authorMarko Luukkainen <marko.luukkainen@semantum.fi>
Fri, 26 Jun 2020 07:49:20 +0000 (10:49 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 26 Jun 2020 07:59:25 +0000 (07:59 +0000)
As in diagram viewers that are not based on Diagramming/Modelling
ontologies.

gitlab #564

Change-Id: Ia6f4c94f76b085e0741e62a1312b2e1fd457fe86

bundles/org.simantics.diagram.profile/src/org/simantics/diagram/profile/view/ActiveRuntimeDiagramInputSource.java
bundles/org.simantics.diagram/src/org/simantics/diagram/runtime/RuntimeVariable.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagram/style/IssueDecorationStyle.java

index fb07993ac7894940a6fa522243595470a16837bb..be0b062ad3b8fdd5a3d911228092932997db3b86 100644 (file)
@@ -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);
index 9943706700bb960346e4c3a974c19328bdd63e0f..e7d411f853d7cb1856292e30c555b0c3e5491f0f 100644 (file)
@@ -65,6 +65,8 @@ class RuntimeVariable extends TernaryRead<Resource, RVI, Resource, RuntimeDiagra
                Resource composite = graph.getPossibleObject(diagram, ModelingResources.getInstance(graph).DiagramToComposite);
                if (composite != null) {
                        variable = Variables.getPossibleVariable(graph, composite);
+               } else {
+                       variable = Variables.getPossibleVariable(graph, diagram);
                }
 
         }
index 68210f9e263f5c48e51eb10bbbc30f0324b85244..6558df07c80a60963f9dbdedf608948152c06282 100644 (file)
@@ -60,7 +60,7 @@ public class IssueDecorationStyle extends StyleBase<IssueResult> {
 
     private static final String DECORATION_NODE_NAME = "issueDecorations"; //$NON-NLS-1$
 
-    private List<Resource> getContexts(ReadGraph graph, Resource element) throws DatabaseException {
+    protected List<Resource> getContexts(ReadGraph graph, Resource element) throws DatabaseException {
 
         ModelingResources MOD = ModelingResources.getInstance(graph);
         List<Resource> result = new ArrayList<Resource>(3);