From 90c1f0db31b0b505e065e4781cfdc1c3ed3d274d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Mon, 4 Sep 2017 18:42:48 +0300 Subject: [PATCH] (refs #7461) Implemented StructuralRVIResolver.getPossibleRVI Change-Id: I451d37af2cc532332c8de3d7c6401afda23bd969 --- .../structural2/StructuralRVIResolver.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 { -- 2.47.1