79
79
"PMD.GodClass"
80
80
})
81
81
public class NewUiComponentGridDialog extends AbstractDialog {
82
+
82
83
private static final String ACTION_NAME = "Action Name" ;
83
84
private static final String DATA_PROVIDER_CLASS_NAME = "Data Provider Class Name" ;
84
85
private static final String DATA_PROVIDER_DIRECTORY = "Data Provider Directory" ;
@@ -91,25 +92,24 @@ public class NewUiComponentGridDialog extends AbstractDialog {
91
92
private JButton buttonOK ;
92
93
private JButton buttonCancel ;
93
94
94
- @ FieldValidation (rule = RuleRegistry .NOT_EMPTY , message = {NotEmptyRule .MESSAGE , NAME })
95
- @ FieldValidation (rule = RuleRegistry .IDENTIFIER , message = {IdentifierRule .MESSAGE , NAME })
96
- private JTextField uiComponentName ;
97
-
98
- @ FieldValidation (rule = RuleRegistry .NOT_EMPTY , message = {NotEmptyRule .MESSAGE , NAME })
99
- @ FieldValidation (rule = RuleRegistry .IDENTIFIER , message = {IdentifierRule .MESSAGE , NAME })
100
- private JTextField idField ;
101
-
102
95
private JCheckBox addToolBar ;
103
96
private JCheckBox addBookmarksCheckBox ;
104
97
private JCheckBox addColumnsControlCheckBox ;
105
98
private JCheckBox addFullTextSearchCheckBox ;
106
99
private JCheckBox addListingFiltersCheckBox ;
107
100
private JCheckBox addListingPagingCheckBox ;
108
-
109
101
private FilteredComboBox collection ;
110
102
private FilteredComboBox dataProviderType ;
111
103
private FilteredComboBox areaSelect ;
112
104
105
+ @ FieldValidation (rule = RuleRegistry .NOT_EMPTY , message = {NotEmptyRule .MESSAGE , NAME })
106
+ @ FieldValidation (rule = RuleRegistry .IDENTIFIER , message = {IdentifierRule .MESSAGE , NAME })
107
+ private JTextField uiComponentName ;
108
+
109
+ @ FieldValidation (rule = RuleRegistry .NOT_EMPTY , message = {NotEmptyRule .MESSAGE , NAME })
110
+ @ FieldValidation (rule = RuleRegistry .IDENTIFIER , message = {IdentifierRule .MESSAGE , NAME })
111
+ private JTextField idField ;
112
+
113
113
@ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
114
114
message = {NotEmptyRule .MESSAGE , DATA_PROVIDER_CLASS_NAME })
115
115
@ FieldValidation (rule = RuleRegistry .PHP_CLASS ,
@@ -194,7 +194,10 @@ public class NewUiComponentGridDialog extends AbstractDialog {
194
194
* @param project Project
195
195
* @param directory PsiDirectory
196
196
*/
197
- public NewUiComponentGridDialog (final Project project , final PsiDirectory directory ) {
197
+ public NewUiComponentGridDialog (
198
+ final @ NotNull Project project ,
199
+ final @ NotNull PsiDirectory directory
200
+ ) {
198
201
super ();
199
202
this .project = project ;
200
203
this .moduleName = GetModuleNameByDirectoryUtil .execute (directory , project );
@@ -244,7 +247,10 @@ public void windowClosing(final WindowEvent event) {
244
247
* @param project Project
245
248
* @param directory PsiDirectory
246
249
*/
247
- public static void open (final Project project , final PsiDirectory directory ) {
250
+ public static void open (
251
+ final @ NotNull Project project ,
252
+ final @ NotNull PsiDirectory directory
253
+ ) {
248
254
final NewUiComponentGridDialog dialog = new NewUiComponentGridDialog (project , directory );
249
255
dialog .pack ();
250
256
dialog .centerDialog (dialog );
@@ -312,8 +318,8 @@ private void onOK() {
312
318
generateDataProviderClass ();
313
319
generateDataProviderDeclaration ();
314
320
generateUiComponentFile ();
321
+ exit ();
315
322
}
316
- exit ();
317
323
}
318
324
319
325
private void setDefaultValues () {
@@ -352,7 +358,7 @@ private void generateUiComponentFile() {
352
358
* Generate data provider class.
353
359
*/
354
360
private void generateDataProviderClass () {
355
- if (getDataProviderType (). equals ( UiComponentDataProviderFile .CUSTOM_TYPE )) {
361
+ if (UiComponentDataProviderFile .CUSTOM_TYPE . equals ( getDataProviderType () )) {
356
362
final UiComponentDataProviderGenerator dataProviderGenerator ;
357
363
dataProviderGenerator = new UiComponentDataProviderGenerator (
358
364
getGridDataProviderData (),
@@ -367,7 +373,7 @@ private void generateDataProviderClass() {
367
373
* Generate data provider declaration.
368
374
*/
369
375
private void generateDataProviderDeclaration () {
370
- if (getDataProviderType (). equals ( UiComponentDataProviderFile .COLLECTION_TYPE )) {
376
+ if (UiComponentDataProviderFile .COLLECTION_TYPE . equals ( getDataProviderType () )) {
371
377
final DataProviderDeclarationGenerator dataProviderGenerator ;
372
378
dataProviderGenerator = new DataProviderDeclarationGenerator (
373
379
new DataProviderDeclarationData (
@@ -463,8 +469,8 @@ private void onAreaChange() {
463
469
}
464
470
465
471
private void onDataProviderTypeChange () {
466
- final boolean visible = getDataProviderType () .equals (
467
- UiComponentDataProviderFile . COLLECTION_TYPE
472
+ final boolean visible = UiComponentDataProviderFile . COLLECTION_TYPE .equals (
473
+ getDataProviderType ()
468
474
);
469
475
470
476
collection .setVisible (visible );
@@ -554,7 +560,7 @@ private String getDataProviderNamespace() {
554
560
}
555
561
556
562
private String getDataProviderClassFqn () {
557
- if (!getDataProviderType (). equals ( UiComponentDataProviderFile .CUSTOM_TYPE )) {
563
+ if (!UiComponentDataProviderFile .CUSTOM_TYPE . equals ( getDataProviderType () )) {
558
564
return UiComponentDataProviderFile .DEFAULT_DATA_PROVIDER ;
559
565
}
560
566
return String .format (
0 commit comments