import org.simantics.sysdyn.ui.properties.widgets.IsOutputWidget;\r
import org.simantics.sysdyn.ui.properties.widgets.ShortcutTabWidget;\r
import org.simantics.sysdyn.ui.properties.widgets.arrays.NameAndArrayRangeModifyListener;\r
+import org.simantics.sysdyn.ui.properties.widgets.expressions.DelayExpression;\r
import org.simantics.sysdyn.ui.properties.widgets.expressions.ExpressionComposite;\r
import org.simantics.sysdyn.ui.properties.widgets.expressions.ExpressionWidgetInput;\r
import org.simantics.sysdyn.ui.properties.widgets.factories.VariableNameInputValidator;\r
\r
@Override\r
public void dispose() {\r
+ if(expressionWidget != null && !(expressionWidget.getExpression() instanceof DelayExpression)) {\r
+ // For delay expression this doesn't work, \r
+ // but it doesn't matter since the saving is succeeded elsewhere.\r
+ expressionWidget.save();\r
+ }\r
if(focusLostListener != null && site != null)\r
site.getPage().removePartListener(focusLostListener);\r
super.dispose();\r
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
+\r
if(oldEquation == null || \r
(currentText != null && expressionType != null)) {\r
data.put("equation", currentText);\r
SysdynResource sr = SysdynResource.getInstance(g);\r
Layer0 l0 = Layer0.getInstance(g);\r
\r
- // Force change to parameter, if the equation is a parameter\r
- if(ExpressionUtils.isParameter(currentText)) {\r
- if(!expressionType.equals(sr.ConstantExpression))\r
- expressionType = sr.ParameterExpression;\r
- } else {\r
- expressionType = sr.NormalExpression;\r
- }\r
- \r
// If nothing has changed, do nothing\r
if (oldEquation != null \r
&& expression != null \r
return;\r
}\r
\r
+ // Force change to parameter, if the equation is a parameter\r
+ if(ExpressionUtils.isParameter(currentText)) {\r
+ if(!expressionType.equals(sr.ConstantExpression))\r
+ expressionType = sr.ParameterExpression;\r
+ } else {\r
+ expressionType = sr.NormalExpression;\r
+ }\r
+ \r
// If the current expression type is different than the target expression type, create a new expression\r
if(!g.isInstanceOf(expression, expressionType)) {\r
\r