From: Reino Ruusu Date: Tue, 16 Apr 2019 13:54:50 +0000 (+0300) Subject: Fix change of type in component property editor when range is present X-Git-Tag: v1.43.0~136^2~163 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=fd2a6ff5d708baed2bdbaf94e6cd7bcc7b288069;p=simantics%2Fplatform.git Fix change of type in component property editor when range is present gitlab #285 Change-Id: Idee2893d334ea093147678c0cb4579bf9aaadc2c --- diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java index 1c4b22ee0..ea10d6d8d 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java @@ -216,7 +216,7 @@ public class ComponentTypeViewerData { editor.setEditor(text, selectedItem, column); } - public void editType(Table table, TableEditor editor, final ComponentTypeViewerPropertyInfo propertyInfo, TableItem selectedItem, int column, final boolean convertDefaultValue) { + public void editType(Table table, TableEditor editor, final ComponentTypeViewerPropertyInfo propertyInfo, TableItem selectedItem, int column, String range, final boolean convertDefaultValue) { int extraStyle = propertyInfo.immutable ? SWT.READ_ONLY : 0; final Combo combo = new Combo(table, SWT.NONE | extraStyle); combo.setText(selectedItem.getText(column)); @@ -252,6 +252,7 @@ public class ComponentTypeViewerData { throws DatabaseException { graph.markUndoPoint(); ComponentTypeCommands.editType(graph, componentType, propertyInfo.resource, convertDefaultValue, newValue); + if (range != null) ComponentTypeCommands.setRange(graph, componentType, propertyInfo.resource, range); } }); } diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java index 34d26e491..c11463f13 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java @@ -183,7 +183,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio break; case 1: - data.editType(table, editor, propertyInfo, selectedItem, column, true); + data.editType(table, editor, propertyInfo, selectedItem, column, selectedItem.getText(4), true); break; case 2: { diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java index 5f96c2ba9..1abe84348 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java @@ -162,7 +162,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection { break; case 1: - data.editType(table, editor, propertyInfo, selectedItem, column, false); + data.editType(table, editor, propertyInfo, selectedItem, column, null, false); break; case 2: