X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.structural2%2Fsrc%2Forg%2Fsimantics%2Fstructural2%2Futils%2FStructuralUtils.java;h=e27d92f29219a7f54963208286b5bd1936c0f485;hb=refs%2Fchanges%2F64%2F2564%2F2;hp=584b4acf73f924f4ab57de7de12764fc39548ec3;hpb=7402926f3949dbb38e9f8f45e864ba4dd65b59b9;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java index 584b4acf7..e27d92f29 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java @@ -325,16 +325,22 @@ public class StructuralUtils { public static Resource structuralTypeResource(ReadGraph graph, Variable component, Resource baseType) throws DatabaseException { StructuralOverrideData od = StructuralOverrideData.compute(graph, component); - return od.type(); + if (od != null) + return od.type(); + return null; } public static Resource getComponentType(ReadGraph graph, Variable configuration, Resource component) throws DatabaseException { - Variable componentVariable = configuration.browse(graph, component); return componentVariable.getType(graph); - } + public static Resource getPossibleComponentType(ReadGraph graph, Variable configuration, Resource component) throws DatabaseException { + Variable componentVariable = configuration.browsePossible(graph, component); + if(componentVariable == null) return null; + StructuralResource2 STR = StructuralResource2.getInstance(graph); + return componentVariable.getPossibleType(graph, STR.Component); + } }