]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/StructuralRVIResolver.java
(refs #7461) Implemented StructuralRVIResolver.getPossibleRVI
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / StructuralRVIResolver.java
index f27356b9f2c403bdef0e25feddea8dd3e4a03778..b2913f3203eccc550c799d3632282c2372fd7d6c 100644 (file)
@@ -45,6 +45,24 @@ public class StructuralRVIResolver extends StandardRVIResolver {
         RVIPart part = getRVIPart(graph, variable);
         return new RVIBuilder(base.getRVI(graph)).append(part).toRVI();
     }
+    
+    @Override
+    public RVI getPossibleRVI(ReadGraph graph, Variable variable) throws DatabaseException {
+        if (Variables.isContext(graph, variable)) {
+            Databoard databoard = graph.getService( Databoard.class );
+            Binding rviBinding = databoard.getBindingUnchecked( RVI.class );
+            return RVI.empty(rviBinding);
+        }
+        Variable base = variable.getParent(graph);
+        if(base == null) return null;
+        while(!isRVIBase(graph, base)) {
+            base = base.getParent(graph);
+            if(base == null) return null;
+        }
+        RVIPart part = getRVIPart(graph, variable);
+        if(part == null) return null;
+        return new RVIBuilder(base.getRVI(graph)).append(part).toRVI();
+    }
 
     protected boolean isPartOfComponentType(ReadGraph graph, Resource resource)
             throws DatabaseException {