From 2b5692125f52558f2b405d00c6f075848e764cb8 Mon Sep 17 00:00:00 2001 From: Reino Ruusu Date: Fri, 27 Mar 2020 15:18:14 +0200 Subject: [PATCH] Fix validation of selection by property when not used gitlab #84 Change-Id: I6fd1b5d297ac2a07536edcd51a5f1b1099e3d06d --- .../selection/ui/parts/EditSelectorDialog.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 -- 2.47.1