X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fadapters%2FSCLChildRule.java;h=a04b9315f544d698913c655ce084e485ec05224a;hp=52349e5821acec2f1a8d476b9c31cd901c8b2ad1;hb=456397cb7d972d49540b89f92aadca71039e8870;hpb=7fe2a02ad295ec7406f44e8f86b7d25deedceb8b 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..a04b9315f 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 {