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%2FFunctions.java;h=e9bb272d3d4442d07184c2bed0437a63f67a5562;hp=9b5fc4586a9281d16751d002c6103e3047e78bd9;hb=HEAD;hpb=7e1ba415e6f14478c2aa682a89ed534e7044ac43 diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java index 9b5fc4586..e9bb272d3 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/Functions.java @@ -562,8 +562,14 @@ public class Functions { } throw new DatabaseException("No type for " + variable.getURI(graph)); } else { - Resource possibleType = graph.getPossibleType(represents, Layer0.getInstance(graph).Entity); - if (graph.syncRequest(new IsInstanceOf(possibleType, StructuralResource2.getInstance(graph).ReplaceableDefinedComponentType), TransientCacheListener.instance()) ) { + StructuralResource2 STR = StructuralResource2.getInstance(graph); + Resource possibleType = graph.getPossibleType(represents, STR.Component); + if (possibleType == null) { + possibleType = graph.getPossibleType(represents, Layer0.getInstance(graph).Entity); + if (possibleType == null) + return null; + } + if (graph.syncRequest(new IsInstanceOf(possibleType, STR.ReplaceableDefinedComponentType), TransientCacheListener.instance()) ) { return graph.syncRequest(new StructuralOverrideDataWalkRequest(variable, represents, possibleType), TransientCacheListener.instance()); } else { return null; @@ -600,8 +606,8 @@ public class Functions { @Override public Variable getVariable(ReadGraph graph, Variable context, String name) throws DatabaseException { - - Resource type = context.getPossibleType(graph); + StructuralResource2 STR = StructuralResource2.getInstance(graph); + Resource type = context.getPossibleType(graph, STR.Component); if(type == null) return null; Tuple2 result = graph.syncRequest(new StructureTypeAndChildMapRequest(type), TransientCacheListener.instance()); @@ -629,8 +635,8 @@ public class Functions { @Override public Map getVariables(ReadGraph graph, Variable context, Map map) throws DatabaseException { - - Resource type = context.getPossibleType(graph); + StructuralResource2 STR = StructuralResource2.getInstance(graph); + Resource type = context.getPossibleType(graph, STR.Component); if(type == null) return null; StructuralComponentClass clazz = StructuralComponentClass.get(graph, type); @@ -647,7 +653,6 @@ public class Functions { } return map; } else if (StructuralComponentClass.DEFINED.equals(clazz)) { - StructuralResource2 STR = StructuralResource2.getInstance(graph); Resource def = graph.getSingleObject(type, STR.IsDefinedBy); Map children = graph.syncRequest(new UnescapedChildMapOfResource(def), TransientCacheListener.instance()); return StandardChildDomainChildren.getStandardChildDomainChildVariables(graph, context, children, map); @@ -743,7 +748,7 @@ public class Functions { for(Resource req : requiredConnections) { if(!connections.contains(req)) { - result.add(new StandardIssue(sr.ConnectionConstraint_ErrorIssue, component, req)); + result.add(new StandardIssue(sr.ConnectionValidationConstraint_ErrorIssue, component, req)); } }