X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.structural2%2Fsrc%2Forg%2Fsimantics%2Fstructural2%2Fqueries%2FGetComponentLocation.java;h=e109f59e89538b3574f2abe73c67b39355674a56;hp=df6e1598c2649312442e3acae4c7186b4bc329c3;hb=d8f1f7da4d84424402812f1aa5deed6112f4c665;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java index df6e1598c..e109f59e8 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/queries/GetComponentLocation.java @@ -66,10 +66,16 @@ public class GetComponentLocation extends UnaryRead Variable firstRepresentedParent = findFirstParentWithRepresentation(graph, parameter, STR); if (firstRepresentedParent == null) return null; - Resource realParentComposite = graph.getPossibleObject(firstRepresentedParent.getRepresents(graph), L0.PartOf); - if (realParentComposite == null) - return null; - isInsideStructure = graph.hasStatement(realParentComposite, STR.Defines); + Resource representedParent = firstRepresentedParent.getRepresents(graph); + Resource representedParentType = graph.getPossibleType(representedParent, STR.Component); + if (representedParentType != null && graph.isInstanceOf(representedParentType, STR.ProceduralComponentType)) { + isInsideStructure = !parameter.equals(firstRepresentedParent); + } else { + Resource realParentComposite = graph.getPossibleObject(representedParent, L0.PartOf); + if (realParentComposite == null) + return null; + isInsideStructure = graph.hasStatement(realParentComposite, STR.Defines); + } Variable firstParentComposite = findFirstParentComposite(graph, firstRepresentedParent, STR); if (firstParentComposite != null) {