From: lempinen Date: Fri, 1 Mar 2013 10:38:51 +0000 (+0000) Subject: Do not save expressions if they are not changed. (fixes #4136) X-Git-Tag: simantics-1.10.1~14 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=0c3b8b98a7d91a17e60a954a43802ecca091cd2b;p=simantics%2Fsysdyn.git Do not save expressions if they are not changed. (fixes #4136) git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26944 ac1ea38d-2e2b-0410-8846-a27921b304fc --- diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java index d4235c63..0ddbebc5 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java @@ -131,6 +131,10 @@ public class BasicExpression implements IExpression { public void save(final Resource expression, Map data) { final String currentText = this.expression.getExpression(); final String oldEquation = (String)data.get("equation"); + + if(currentText != null && oldEquation != null && currentText.equals(oldEquation)) + return; // Nothing is changed, no need to save + if(oldEquation == null || (currentText != null && expressionType != null)) { data.put("equation", currentText); diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/ParameterExpression.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/ParameterExpression.java index cb47168b..cfaf2a6d 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/ParameterExpression.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/ParameterExpression.java @@ -117,7 +117,7 @@ public class ParameterExpression extends BasicExpression { final String currentText = this.expression.getExpression(); final String oldEquation = (String)data.get("equation"); if(oldEquation == null || - (currentText != null && expressionType != null)) { + (currentText != null && oldEquation != null && !currentText.equals(oldEquation) && expressionType != null)) { if(ExpressionUtils.isParameter(currentText)) { Boolean savedIntoFMU = false;