X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FdiagramEditor%2FDiagramViewerSelectionProvider.java;h=4317f59799f9c8819bb1459fe76d3997ac56dc90;hp=c3070d9cceb9f60ccd3fde3aef1e7407a14b9957;hb=25b6c25959c1fb3c60bb41cd0e1f0808e7fc3769;hpb=ccc1271c9d6657fb9dcf4cf3cb115fa0c8cb9589 diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java index c3070d9cc..4317f5979 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/diagramEditor/DiagramViewerSelectionProvider.java @@ -62,6 +62,7 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider { public Variable perform(ReadGraph graph) throws DatabaseException { DiagramResource DIA = DiagramResource.getInstance(graph); + ModelingResources MOD = ModelingResources.getInstance(graph); String uri = graph.getPossibleRelatedValue(resource, DIA.RuntimeDiagram_HasVariable); if (uri == null) @@ -71,9 +72,20 @@ public class DiagramViewerSelectionProvider extends WorkbenchSelectionProvider { if (var == null) return null; - Resource config = graph.getPossibleObject(resource2, ModelingResources.getInstance(graph).ElementToComponent); - if (config == null) + Resource config = graph.getPossibleObject(resource2, MOD.ElementToComponent); + if (config == null) { + // Apros #9646: if resource2 is the diagram + // itself, return the diagram composite variable + // since it is generally more useful than the + // variable to the diagram. + Resource composite = graph.getPossibleObject(resource2, MOD.DiagramToComposite); + if (composite != null && composite.equals(var.getPossibleRepresents(graph))) { + //return Variables.getPossibleVariable(graph, resource2); + return var; + } + return null; + } return var.browsePossible(graph, config);