From 16ce2fab4f52fcabe55a07d41c691899ca95c4ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Tue, 5 Sep 2017 17:13:53 +0300 Subject: [PATCH] (refs #7461) Fix to StructuralRVIResolver.getPossibleRVI Call getPossibleRVI instead of getRVI. Change-Id: I1638f0a08c78ac784f7c3d2e3a6f9ce4e9670f43 --- .../layer0/variable/StandardRVIResolver.java | 8 +++--- .../structural2/StructuralRVIResolver.java | 28 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java index 7c632f3f4..b01aeb32b 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java @@ -32,9 +32,9 @@ public class StandardRVIResolver implements RVIResolver { @Override public RVI getRVI(ReadGraph graph, Variable variable) throws DatabaseException { - Databoard databoard = graph.getService( Databoard.class ); - Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); if(Variables.isContext(graph, variable)) { + Databoard databoard = graph.getService( Databoard.class ); + Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); return RVI.empty( rviBinding ); } else { Variable parent = variable.getParent(graph); @@ -49,9 +49,9 @@ public class StandardRVIResolver implements RVIResolver { @Override public RVI getPossibleRVI(ReadGraph graph, Variable variable) throws DatabaseException { - Databoard databoard = graph.getService( Databoard.class ); - Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); if(Variables.isContext(graph, variable)) { + Databoard databoard = graph.getService( Databoard.class ); + Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); return RVI.empty( rviBinding ); } else { Variable parent = variable.getParent(graph); 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 b2913f320..8cf61b3e0 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/StructuralRVIResolver.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/StructuralRVIResolver.java @@ -40,10 +40,12 @@ public class StructuralRVIResolver extends StandardRVIResolver { Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); return RVI.empty(rviBinding); } - Variable base = variable.getParent(graph); - while(!isRVIBase(graph, base)) base = base.getParent(graph); - RVIPart part = getRVIPart(graph, variable); - return new RVIBuilder(base.getRVI(graph)).append(part).toRVI(); + else { + Variable base = variable.getParent(graph); + while(!isRVIBase(graph, base)) base = base.getParent(graph); + RVIPart part = getRVIPart(graph, variable); + return new RVIBuilder(base.getRVI(graph)).append(part).toRVI(); + } } @Override @@ -53,15 +55,19 @@ public class StructuralRVIResolver extends StandardRVIResolver { 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); + else { + 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; + RVI baseRVI = base.getPossibleRVI(graph); + if(baseRVI == null) return null; + return new RVIBuilder(baseRVI).append(part).toRVI(); } - 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) -- 2.47.1