Fix change of type in component property editor when range is present 54/2854/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Tue, 16 Apr 2019 13:54:50 +0000 (16:54 +0300)
committerReino Ruusu <reino.ruusu@semantum.fi>
Tue, 16 Apr 2019 13:54:50 +0000 (16:54 +0300)
gitlab #285

Change-Id: Idee2893d334ea093147678c0cb4579bf9aaadc2c

bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypeViewerData.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java
bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java

index 1c4b22e..ea10d6d 100644 (file)
@@ -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);
                     }
                 });
             }
index 34d26e4..c11463f 100644 (file)
@@ -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: {
index 5f96c2b..1abe843 100644 (file)
@@ -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: