]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Do not save expressions if they are not changed. (fixes #4136)
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 1 Mar 2013 10:38:51 +0000 (10:38 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Fri, 1 Mar 2013 10:38:51 +0000 (10:38 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26944 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/BasicExpression.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/expressions/ParameterExpression.java

index d4235c63dc4934d6d867d6424514a70d0c7470fe..0ddbebc54434d93fb4bec9e6bce62734cd18a052 100644 (file)
@@ -131,6 +131,10 @@ public class BasicExpression implements IExpression {
     public void save(final Resource expression, Map<String, Object> data) {\r
         final String currentText = this.expression.getExpression();\r
         final String oldEquation = (String)data.get("equation");\r
+        \r
+        if(currentText != null && oldEquation != null && currentText.equals(oldEquation))\r
+            return; // Nothing is changed, no need to save\r
+        \r
         if(oldEquation == null || \r
                 (currentText != null && expressionType != null)) {\r
             data.put("equation", currentText);\r
index cb47168b2890b6452b6a50848e308ca10d1344fb..cfaf2a6dad6d6e3ce353d71ac1495f207c8fbadf 100644 (file)
@@ -117,7 +117,7 @@ public class ParameterExpression extends BasicExpression {
                        final String currentText = this.expression.getExpression();\r
                        final String oldEquation = (String)data.get("equation");\r
                        if(oldEquation == null || \r
-                               (currentText != null && expressionType != null)) {\r
+                               (currentText != null && oldEquation != null && !currentText.equals(oldEquation) && expressionType != null)) {\r
                            if(ExpressionUtils.isParameter(currentText)) {\r
                                Boolean savedIntoFMU = false;\r
 \r