From: Hannu Niemistö Date: Mon, 4 Sep 2017 15:42:48 +0000 (+0300) Subject: (refs #7461) Implemented StructuralRVIResolver.getPossibleRVI X-Git-Tag: v1.31.0~204 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F12%2F912%2F1;p=simantics%2Fplatform.git (refs #7461) Implemented StructuralRVIResolver.getPossibleRVI Change-Id: I451d37af2cc532332c8de3d7c6401afda23bd969 --- diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/StructuralRVIResolver.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/StructuralRVIResolver.java index f27356b9f..b2913f320 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/StructuralRVIResolver.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/StructuralRVIResolver.java @@ -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 {