47
47
import javax .swing .KeyStroke ;
48
48
import javax .swing .table .DefaultTableModel ;
49
49
import javax .swing .table .TableColumn ;
50
+ import org .jetbrains .annotations .NotNull ;
50
51
51
52
@ SuppressWarnings ({
52
53
"PMD.ExcessiveImports"
53
54
})
54
55
public class NewDataModelDialog extends AbstractDialog {
55
56
56
- private final Project project ;
57
- private final String moduleName ;
58
- private final ValidatorBundle validatorBundle ;
59
- private final CommonBundle commonBundle ;
60
- private final List <String > properties ;
61
-
62
57
private static final String MODEL_NAME = "Model Name" ;
63
58
private static final String PROPERTY_NAME = "Name" ;
64
59
private static final String PROPERTY_TYPE = "Type" ;
65
60
private static final String PROPERTY_ACTION = "Action" ;
66
61
private static final String PROPERTY_DELETE = "Delete" ;
67
62
63
+ private final Project project ;
64
+ private final String moduleName ;
65
+ private final ValidatorBundle validatorBundle ;
66
+ private final CommonBundle commonBundle ;
67
+ private final List <String > properties ;
68
+
68
69
private JPanel contentPanel ;
69
70
private JButton buttonOK ;
70
71
private JButton buttonCancel ;
71
72
private JTable propertyTable ;
72
73
private JButton addProperty ;
73
74
private JCheckBox createInterface ;
74
75
75
- @ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
76
- message = {NotEmptyRule .MESSAGE , MODEL_NAME })
77
- @ FieldValidation (rule = RuleRegistry .PHP_CLASS ,
78
- message = {PhpClassRule .MESSAGE , MODEL_NAME })
76
+ @ FieldValidation (rule = RuleRegistry .NOT_EMPTY , message = {NotEmptyRule .MESSAGE , MODEL_NAME })
77
+ @ FieldValidation (rule = RuleRegistry .PHP_CLASS , message = {PhpClassRule .MESSAGE , MODEL_NAME })
79
78
private JTextField modelName ;
80
79
81
80
/**
82
81
* Constructor.
83
82
*/
84
- public NewDataModelDialog (final Project project , final PsiDirectory directory ) {
83
+ public NewDataModelDialog (
84
+ final @ NotNull Project project ,
85
+ final @ NotNull PsiDirectory directory
86
+ ) {
85
87
super ();
86
88
87
89
this .project = project ;
@@ -122,7 +124,10 @@ public void windowClosing(final WindowEvent event) {
122
124
/**
123
125
* Opens the dialog window.
124
126
*/
125
- public static void open (final Project project , final PsiDirectory directory ) {
127
+ public static void open (
128
+ final @ NotNull Project project ,
129
+ final @ NotNull PsiDirectory directory
130
+ ) {
126
131
final NewDataModelDialog dialog = new NewDataModelDialog (project , directory );
127
132
dialog .pack ();
128
133
dialog .centerDialog (dialog );
@@ -145,8 +150,8 @@ private void onOK() {
145
150
generateDataModelInterfaceFile ();
146
151
generatePreferenceForInterface ();
147
152
}
153
+ exit ();
148
154
}
149
- exit ();
150
155
}
151
156
152
157
@ Override
@@ -190,11 +195,6 @@ protected boolean validateFormFields() {
190
195
return valid ;
191
196
}
192
197
193
- @ Override
194
- public void onCancel () {
195
- dispose ();
196
- }
197
-
198
198
/**
199
199
* Generate DTO interface file.
200
200
*/
0 commit comments