From 477d43b766086be8f1a2751551e1f52f29b698b9 Mon Sep 17 00:00:00 2001 From: lempinen Date: Fri, 3 May 2013 11:13:00 +0000 Subject: [PATCH] Fixed problem where changing unit in variable does not affect unit validation in expressions where the variable is used. (fixes #4269) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@27306 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/representation/utils/UnitUtils.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java index eca1fe34..668c83fe 100644 --- a/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java +++ b/org.simantics.sysdyn/src/org/simantics/sysdyn/representation/utils/UnitUtils.java @@ -103,7 +103,10 @@ public class UnitUtils { Resource varResource = model.getMapping().inverseGet(var); if(varResource != null) { try { - graph.getPossibleRelatedValue(varResource, SysdynResource.getInstance(graph).Variable_unit); + String unit = graph.getPossibleRelatedValue(varResource, SysdynResource.getInstance(graph).Variable_unit); + if(unit != null) { + units.put(component, unit); + } } catch (ManyObjectsForFunctionalRelationException e) { e.printStackTrace(); } catch (ServiceException e) { @@ -111,11 +114,6 @@ public class UnitUtils { } } } - - String unit = var.getUnit(); - if(unit != null) { - units.put(component, unit); - } } } -- 2.47.1