]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Fix validation of selection by property when not used 52/4052/1
authorReino Ruusu <reino.ruusu@semantum.fi>
Fri, 27 Mar 2020 13:18:14 +0000 (15:18 +0200)
committerReino Ruusu <reino.ruusu@semantum.fi>
Fri, 27 Mar 2020 13:18:14 +0000 (15:18 +0200)
gitlab #84

Change-Id: I6fd1b5d297ac2a07536edcd51a5f1b1099e3d06d

org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/parts/EditSelectorDialog.java

index b708d8e978695dc18919f05a80a824409d2b1564..623f0f847921137f08f1f953d2179b5df56edd8e 100644 (file)
@@ -358,12 +358,15 @@ public class EditSelectorDialog extends Dialog {
                        }
                        
                        componentType = componentTypes.get(componentTypeField.getSelectionIndex());
+                       
                        selectorIndex = selectorField.getSelectionIndex();
-                       int propertyIndex = propertyField.getSelectionIndex();
-                       propertyName = propertyIndex >= 0 ? propertyNames.get(propertyIndex) : propertyField.getText();
-                       if (propertyName.isEmpty()) {
-                               propertyField.setFocus();
-                               throw new ValidationException("Please select a property");
+                       if (selectorIndex != 0) {
+                               int propertyIndex = propertyField.getSelectionIndex();
+                               propertyName = propertyIndex >= 0 ? propertyNames.get(propertyIndex) : propertyField.getText();
+                               if (propertyName.isEmpty()) {
+                                       propertyField.setFocus();
+                                       throw new ValidationException("Please select a property");
+                               }
                        }
                        
                        // Try to parse number of items