File tree Expand file tree Collapse file tree 6 files changed +27
-2
lines changed
src/com/magento/idea/magento2plugin/actions/generation/dialog Expand file tree Collapse file tree 6 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 1
1
validator.notEmpty =The {0} field must not be empty
2
+ validator.box.notEmpty =The {0} field must contain a valid selection from the dropdown
2
3
validator.package.validPath =Please specify a valid Magento 2 installation path
3
4
validator.alphaNumericCharacters =The {0} must contain letters and numbers only
4
5
validator.alphaNumericAndUnderscoreCharacters ={0} must contain letters, numbers and underscores only
Original file line number Diff line number Diff line change @@ -184,7 +184,11 @@ private String resolveFieldValueByComponentType(final Object field) {
184
184
if (field instanceof JTextField ) {
185
185
return ((JTextField ) field ).isEditable () ? ((JTextField ) field ).getText () : null ;
186
186
} else if (field instanceof JComboBox ) {
187
- return ((JComboBox ) field ).getSelectedItem ().toString ();
187
+ try {
188
+ return ((JComboBox ) field ).getSelectedItem ().toString ();
189
+ } catch (NullPointerException exception ) {
190
+ return "" ;
191
+ }
188
192
}
189
193
return null ;
190
194
}
Original file line number Diff line number Diff line change 12
12
import com .magento .idea .magento2plugin .actions .generation .data .CrontabXmlData ;
13
13
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .annotation .FieldValidation ;
14
14
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .annotation .RuleRegistry ;
15
+ import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .BoxNotEmptyRule ;
15
16
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .ConfigPathRule ;
16
17
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .CronScheduleRule ;
17
18
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .DirectoryRule ;
@@ -100,6 +101,8 @@ public class NewCronjobDialog extends AbstractDialog {
100
101
message = {ConfigPathRule .MESSAGE , CONFIG_PATH })
101
102
private JTextField configPathField ;
102
103
104
+ @ FieldValidation (rule = RuleRegistry .BOX_NOT_EMPTY ,
105
+ message = {BoxNotEmptyRule .MESSAGE , CRON_GROUP })
103
106
@ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
104
107
message = {NotEmptyRule .MESSAGE , CRON_GROUP })
105
108
private FilteredComboBox cronGroupComboBox ;
Original file line number Diff line number Diff line change 8
8
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .AclResourceIdRule ;
9
9
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .AlphanumericRule ;
10
10
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .AlphanumericWithUnderscoreRule ;
11
+ import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .BoxNotEmptyRule ;
11
12
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .ConfigPathRule ;
12
13
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .CronScheduleRule ;
13
14
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .DirectoryRule ;
23
24
24
25
public enum RuleRegistry {
25
26
NOT_EMPTY (NotEmptyRule .class ),
27
+ BOX_NOT_EMPTY (BoxNotEmptyRule .class ),
26
28
PHP_CLASS (PhpClassRule .class ),
27
29
ROUTE_ID (RouteIdRule .class ),
28
30
ALPHANUMERIC (AlphanumericRule .class ),
Original file line number Diff line number Diff line change
1
+ package com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule ;
2
+
3
+ public class BoxNotEmptyRule implements ValidationRule {
4
+ public static final String MESSAGE = "validator.box.notEmpty" ;
5
+ private static final ValidationRule INSTANCE = new BoxNotEmptyRule ();
6
+
7
+ @ Override
8
+ public boolean check (final String value ) {
9
+ return !value .isEmpty ();
10
+ }
11
+
12
+ public static ValidationRule getInstance () {
13
+ return INSTANCE ;
14
+ }
15
+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public class NotEmptyRule implements ValidationRule {
11
11
12
12
@ Override
13
13
public boolean check (final String value ) {
14
- return value .length () != 0 ;
14
+ return ! value .isEmpty () ;
15
15
}
16
16
17
17
public static ValidationRule getInstance () {
You can’t perform that action at this time.
0 commit comments