From: Reino Ruusu Date: Fri, 27 Mar 2020 13:18:14 +0000 (+0200) Subject: Fix validation of selection by property when not used X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=2b5692125f52558f2b405d00c6f075848e764cb8;p=simantics%2Fdistrict.git Fix validation of selection by property when not used gitlab #84 Change-Id: I6fd1b5d297ac2a07536edcd51a5f1b1099e3d06d --- diff --git a/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/parts/EditSelectorDialog.java b/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/parts/EditSelectorDialog.java index b708d8e9..623f0f84 100644 --- a/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/parts/EditSelectorDialog.java +++ b/org.simantics.district.selection.ui/src/org/simantics/district/selection/ui/parts/EditSelectorDialog.java @@ -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