X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fadapters%2FSCLChildRule.java;h=1ea88caf4377bb7cb66b31e8b55b8eeafec32ac9;hb=c0941146a40af9df766b514fd4238aa20ec2ff4f;hp=52349e5821acec2f1a8d476b9c31cd901c8b2ad1;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java index 52349e582..1ea88caf4 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/SCLChildRule.java @@ -28,21 +28,27 @@ public class SCLChildRule implements ChildRule { } @Override - public Collection getChildren(ReadGraph graph, Object parent) throws DatabaseException { + public Collection getChildren(ReadGraph graph, Object parent) throws DatabaseException { + Resource parentResource; + + if (parent instanceof Variable) { + parentResource = ((Variable)parent).getRepresents(graph); + } else { + parentResource = (Resource)parent; + } ModelingResources MOD = ModelingResources.getInstance(graph); Variable ruleVariable = Variables.getVariable(graph, rule); - Function1> getChildren = ruleVariable.getPossiblePropertyValue(graph, MOD.SCLChildRule_getChildren); + Function1> getChildren = ruleVariable.getPossiblePropertyValue(graph, MOD.SCLChildRule_getChildren); if(getChildren == null) return Collections.emptyList(); SCLContext sclContext = SCLContext.getCurrent(); Object oldGraph = sclContext.get("graph"); try { sclContext.put("graph", graph); - Object value = getChildren.apply(parent); - return (Collection)value; + return getChildren.apply(parentResource); } catch (Throwable t) { throw new DatabaseException(t); } finally {