From 0c3b8b98a7d91a17e60a954a43802ecca091cd2b Mon Sep 17 00:00:00 2001 From: lempinen Date: Fri, 1 Mar 2013 10:38:51 +0000 Subject: [PATCH] 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 --- .../ui/properties/widgets/expressions/BasicExpression.java | 4 ++++ .../properties/widgets/expressions/ParameterExpression.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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; -- 2.47.1