7979 "PMD.GodClass"
8080})
8181public class NewUiComponentGridDialog extends AbstractDialog {
82+
8283 private static final String ACTION_NAME = "Action Name" ;
8384 private static final String DATA_PROVIDER_CLASS_NAME = "Data Provider Class Name" ;
8485 private static final String DATA_PROVIDER_DIRECTORY = "Data Provider Directory" ;
@@ -91,25 +92,24 @@ public class NewUiComponentGridDialog extends AbstractDialog {
9192 private JButton buttonOK ;
9293 private JButton buttonCancel ;
9394
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-
10295 private JCheckBox addToolBar ;
10396 private JCheckBox addBookmarksCheckBox ;
10497 private JCheckBox addColumnsControlCheckBox ;
10598 private JCheckBox addFullTextSearchCheckBox ;
10699 private JCheckBox addListingFiltersCheckBox ;
107100 private JCheckBox addListingPagingCheckBox ;
108-
109101 private FilteredComboBox collection ;
110102 private FilteredComboBox dataProviderType ;
111103 private FilteredComboBox areaSelect ;
112104
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+
113113 @ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
114114 message = {NotEmptyRule .MESSAGE , DATA_PROVIDER_CLASS_NAME })
115115 @ FieldValidation (rule = RuleRegistry .PHP_CLASS ,
@@ -194,7 +194,10 @@ public class NewUiComponentGridDialog extends AbstractDialog {
194194 * @param project Project
195195 * @param directory PsiDirectory
196196 */
197- public NewUiComponentGridDialog (final Project project , final PsiDirectory directory ) {
197+ public NewUiComponentGridDialog (
198+ final @ NotNull Project project ,
199+ final @ NotNull PsiDirectory directory
200+ ) {
198201 super ();
199202 this .project = project ;
200203 this .moduleName = GetModuleNameByDirectoryUtil .execute (directory , project );
@@ -244,7 +247,10 @@ public void windowClosing(final WindowEvent event) {
244247 * @param project Project
245248 * @param directory PsiDirectory
246249 */
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+ ) {
248254 final NewUiComponentGridDialog dialog = new NewUiComponentGridDialog (project , directory );
249255 dialog .pack ();
250256 dialog .centerDialog (dialog );
@@ -312,8 +318,8 @@ private void onOK() {
312318 generateDataProviderClass ();
313319 generateDataProviderDeclaration ();
314320 generateUiComponentFile ();
321+ exit ();
315322 }
316- exit ();
317323 }
318324
319325 private void setDefaultValues () {
@@ -352,7 +358,7 @@ private void generateUiComponentFile() {
352358 * Generate data provider class.
353359 */
354360 private void generateDataProviderClass () {
355- if (getDataProviderType (). equals ( UiComponentDataProviderFile .CUSTOM_TYPE )) {
361+ if (UiComponentDataProviderFile .CUSTOM_TYPE . equals ( getDataProviderType () )) {
356362 final UiComponentDataProviderGenerator dataProviderGenerator ;
357363 dataProviderGenerator = new UiComponentDataProviderGenerator (
358364 getGridDataProviderData (),
@@ -367,7 +373,7 @@ private void generateDataProviderClass() {
367373 * Generate data provider declaration.
368374 */
369375 private void generateDataProviderDeclaration () {
370- if (getDataProviderType (). equals ( UiComponentDataProviderFile .COLLECTION_TYPE )) {
376+ if (UiComponentDataProviderFile .COLLECTION_TYPE . equals ( getDataProviderType () )) {
371377 final DataProviderDeclarationGenerator dataProviderGenerator ;
372378 dataProviderGenerator = new DataProviderDeclarationGenerator (
373379 new DataProviderDeclarationData (
@@ -463,8 +469,8 @@ private void onAreaChange() {
463469 }
464470
465471 private void onDataProviderTypeChange () {
466- final boolean visible = getDataProviderType () .equals (
467- UiComponentDataProviderFile . COLLECTION_TYPE
472+ final boolean visible = UiComponentDataProviderFile . COLLECTION_TYPE .equals (
473+ getDataProviderType ()
468474 );
469475
470476 collection .setVisible (visible );
@@ -554,7 +560,7 @@ private String getDataProviderNamespace() {
554560 }
555561
556562 private String getDataProviderClassFqn () {
557- if (!getDataProviderType (). equals ( UiComponentDataProviderFile .CUSTOM_TYPE )) {
563+ if (!UiComponentDataProviderFile .CUSTOM_TYPE . equals ( getDataProviderType () )) {
558564 return UiComponentDataProviderFile .DEFAULT_DATA_PROVIDER ;
559565 }
560566 return String .format (
0 commit comments