]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/DerivedPropertiesSection.java
Fix change of type in component property editor when range is present
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / DerivedPropertiesSection.java
index 0f7bff3969dbf649e2a4740de2c586312a80a0a2..1abe8434897ee8bc3071ff528baf45b41e76bbee 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:
@@ -330,12 +330,7 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection {
         SCLContext sclContext = SCLContext.getCurrent();
         Object oldGraph = sclContext.get("graph");
         try {
-            CompileSCLMonitorRequest compileSCLMonitorRequest = new CompileSCLMonitorRequest(graph, context) {
-                @Override
-                protected String getExpressionText(ReadGraph graph) throws DatabaseException {
-                    return expression;
-                }
-            };
+            CompileSCLMonitorRequest compileSCLMonitorRequest = new ValidationCompilationRequest(graph, context, expression);
             Function1<Variable,Object> exp = graph.syncRequest(compileSCLMonitorRequest);
             sclContext.put("graph", graph);
             //return exp.apply(context.getParent(graph));
@@ -422,4 +417,29 @@ public class DerivedPropertiesSection implements ComponentTypeViewerSection {
         return 100.0;
     }
 
+    private static final class ValidationCompilationRequest extends CompileSCLMonitorRequest {
+        private final String expression;
+    
+        private ValidationCompilationRequest(ReadGraph graph, Variable context, String expression)
+                throws DatabaseException {
+            super(graph, context);
+            this.expression = expression;
+        }
+    
+        @Override
+        protected String getExpressionText(ReadGraph graph) throws DatabaseException {
+            return expression;
+        }
+    
+        @Override
+        public int hashCode() {
+            return super.hashCode() + 37 * expression.hashCode();
+        }
+    
+        @Override
+        public boolean equals(Object obj) {
+            return super.equals(obj) && ((ValidationCompilationRequest)obj).expression.equals(expression);
+        }
+    }
+
 }
\ No newline at end of file