21
21
import com .magento .idea .magento2plugin .magento .packages .Areas ;
22
22
import com .magento .idea .magento2plugin .ui .FilteredComboBox ;
23
23
import com .magento .idea .magento2plugin .util .magento .GetModuleNameByDirectoryUtil ;
24
- import java .awt .event .ActionEvent ;
25
- import java .awt .event .ActionListener ;
26
24
import java .awt .event .KeyEvent ;
27
25
import java .awt .event .WindowAdapter ;
28
26
import java .awt .event .WindowEvent ;
36
34
import javax .swing .KeyStroke ;
37
35
38
36
public class NewEmailTemplateDialog extends AbstractDialog {
39
- private final String moduleName ;
40
- private final Project project ;
41
- private final NewEmailTemplateDialogValidator validator ;
37
+
42
38
private static final String EMAIL_TEMPLATE_ID = "id" ;
43
39
private static final String LABEL = "label" ;
44
40
private static final String FILENAME = "file name" ;
41
+
42
+ private final String moduleName ;
43
+ private final Project project ;
44
+ private final NewEmailTemplateDialogValidator validator ;
45
45
private JPanel contentPane ;
46
46
private JButton buttonOK ;
47
47
private JButton buttonCancel ;
48
+
48
49
@ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
49
50
message = {NotEmptyRule .MESSAGE , EMAIL_TEMPLATE_ID })
50
51
@ FieldValidation (rule = RuleRegistry .IDENTIFIER ,
@@ -58,6 +59,7 @@ public class NewEmailTemplateDialog extends AbstractDialog {
58
59
@ FieldValidation (rule = RuleRegistry .IDENTIFIER ,
59
60
message = {IdentifierRule .MESSAGE , FILENAME })
60
61
private JTextField fileName ;
62
+
61
63
private FilteredComboBox area ;
62
64
private FilteredComboBox templateType ;
63
65
private JTextField subject ;
@@ -83,18 +85,16 @@ public NewEmailTemplateDialog(final Project project, final PsiDirectory director
83
85
// call onCancel() when cross is clicked
84
86
setDefaultCloseOperation (DO_NOTHING_ON_CLOSE );
85
87
addWindowListener (new WindowAdapter () {
88
+
89
+ @ Override
86
90
public void windowClosing (final WindowEvent windowEvent ) {
87
91
onCancel ();
88
92
}
89
93
});
90
94
91
95
// call onCancel() on ESCAPE
92
96
contentPane .registerKeyboardAction (
93
- new ActionListener () {
94
- public void actionPerformed (final ActionEvent actionEvent ) {
95
- onCancel ();
96
- }
97
- },
97
+ actionEvent -> onCancel (),
98
98
KeyStroke .getKeyStroke (KeyEvent .VK_ESCAPE , 0 ),
99
99
JComponent .WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
100
100
);
@@ -230,11 +230,6 @@ private void generateFile() {
230
230
xmlGenerator .generate (NewEmailTemplateAction .ACTION_NAME , true );
231
231
}
232
232
233
- protected void onCancel () {
234
- // add your code here if necessary
235
- dispose ();
236
- }
237
-
238
233
@ SuppressWarnings ({"PMD.UnusedPrivateMethod" })
239
234
private void createUIComponents () {
240
235
this .area = new FilteredComboBox (getAreaList ());
0 commit comments