2121import com .magento .idea .magento2plugin .magento .packages .Areas ;
2222import com .magento .idea .magento2plugin .ui .FilteredComboBox ;
2323import com .magento .idea .magento2plugin .util .magento .GetModuleNameByDirectoryUtil ;
24- import java .awt .event .ActionEvent ;
25- import java .awt .event .ActionListener ;
2624import java .awt .event .KeyEvent ;
2725import java .awt .event .WindowAdapter ;
2826import java .awt .event .WindowEvent ;
3634import javax .swing .KeyStroke ;
3735
3836public class NewEmailTemplateDialog extends AbstractDialog {
39- private final String moduleName ;
40- private final Project project ;
41- private final NewEmailTemplateDialogValidator validator ;
37+
4238 private static final String EMAIL_TEMPLATE_ID = "id" ;
4339 private static final String LABEL = "label" ;
4440 private static final String FILENAME = "file name" ;
41+
42+ private final String moduleName ;
43+ private final Project project ;
44+ private final NewEmailTemplateDialogValidator validator ;
4545 private JPanel contentPane ;
4646 private JButton buttonOK ;
4747 private JButton buttonCancel ;
48+
4849 @ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
4950 message = {NotEmptyRule .MESSAGE , EMAIL_TEMPLATE_ID })
5051 @ FieldValidation (rule = RuleRegistry .IDENTIFIER ,
@@ -58,6 +59,7 @@ public class NewEmailTemplateDialog extends AbstractDialog {
5859 @ FieldValidation (rule = RuleRegistry .IDENTIFIER ,
5960 message = {IdentifierRule .MESSAGE , FILENAME })
6061 private JTextField fileName ;
62+
6163 private FilteredComboBox area ;
6264 private FilteredComboBox templateType ;
6365 private JTextField subject ;
@@ -83,18 +85,16 @@ public NewEmailTemplateDialog(final Project project, final PsiDirectory director
8385 // call onCancel() when cross is clicked
8486 setDefaultCloseOperation (DO_NOTHING_ON_CLOSE );
8587 addWindowListener (new WindowAdapter () {
88+
89+ @ Override
8690 public void windowClosing (final WindowEvent windowEvent ) {
8791 onCancel ();
8892 }
8993 });
9094
9195 // call onCancel() on ESCAPE
9296 contentPane .registerKeyboardAction (
93- new ActionListener () {
94- public void actionPerformed (final ActionEvent actionEvent ) {
95- onCancel ();
96- }
97- },
97+ actionEvent -> onCancel (),
9898 KeyStroke .getKeyStroke (KeyEvent .VK_ESCAPE , 0 ),
9999 JComponent .WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
100100 );
@@ -230,11 +230,6 @@ private void generateFile() {
230230 xmlGenerator .generate (NewEmailTemplateAction .ACTION_NAME , true );
231231 }
232232
233- protected void onCancel () {
234- // add your code here if necessary
235- dispose ();
236- }
237-
238233 @ SuppressWarnings ({"PMD.UnusedPrivateMethod" })
239234 private void createUIComponents () {
240235 this .area = new FilteredComboBox (getAreaList ());
0 commit comments