]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java
Do not compute replaceable type for non ReplaceableDefinedComponentTypes
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / utils / StructuralUtils.java
index 584b4acf73f924f4ab57de7de12764fc39548ec3..e27d92f29219a7f54963208286b5bd1936c0f485 100644 (file)
@@ -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);
+    }
 
 
 }