1212import com .magento .idea .magento2plugin .actions .generation .data .ModuleComposerJsonData ;
1313import com .magento .idea .magento2plugin .actions .generation .data .ModuleRegistrationPhpData ;
1414import com .magento .idea .magento2plugin .actions .generation .data .ModuleXmlData ;
15- import com .magento .idea .magento2plugin .actions .generation .dialog .validator .NewModuleDialogValidator ;
1615import com .magento .idea .magento2plugin .actions .generation .generator .ModuleComposerJsonGenerator ;
1716import com .magento .idea .magento2plugin .actions .generation .generator .ModuleRegistrationPhpGenerator ;
1817import com .magento .idea .magento2plugin .actions .generation .generator .ModuleXmlGenerator ;
2423import com .magento .idea .magento2plugin .util .CamelCaseToHyphen ;
2524import com .magento .idea .magento2plugin .util .magento .MagentoVersionUtil ;
2625import java .awt .event .ActionEvent ;
27- import java .awt .event .ActionListener ;
2826import java .awt .event .KeyEvent ;
2927import java .awt .event .WindowAdapter ;
3028import java .awt .event .WindowEvent ;
@@ -50,7 +48,6 @@ public class NewModuleDialog extends AbstractDialog implements ListSelectionList
5048 private final Project project ;
5149 @ NotNull
5250 private final PsiDirectory initialBaseDir ;
53- private final NewModuleDialogValidator validator ;
5451 private final CamelCaseToHyphen camelCaseToHyphen ;
5552 private JPanel contentPane ;
5653 private JButton buttonOK ;
@@ -90,7 +87,6 @@ public NewModuleDialog(
9087 this .project = project ;
9188 this .initialBaseDir = initialBaseDir ;
9289 this .camelCaseToHyphen = CamelCaseToHyphen .getInstance ();
93- this .validator = NewModuleDialogValidator .getInstance (this );
9490 this .moduleIndex = ModuleIndex .getInstance (project );
9591 detectPackageName (initialBaseDir );
9692 setContentPane (contentPane );
@@ -102,19 +98,8 @@ public NewModuleDialog(
10298 moduleLicenseCustom .setToolTipText ("Custom License Name" );
10399 moduleLicenseCustom .setText (Settings .getDefaultLicenseName (project ));
104100
105- buttonOK .addActionListener (new ActionListener () {
106- @ Override
107- public void actionPerformed (final ActionEvent event ) {
108- onOK ();
109- }
110- });
111-
112- buttonCancel .addActionListener (new ActionListener () {
113- @ Override
114- public void actionPerformed (final ActionEvent event ) {
115- onCancel ();
116- }
117- });
101+ buttonOK .addActionListener ((final ActionEvent event ) -> onOK ());
102+ buttonCancel .addActionListener ((final ActionEvent event ) -> onCancel ());
118103
119104 setDefaultCloseOperation (DO_NOTHING_ON_CLOSE );
120105 addWindowListener (new WindowAdapter () {
@@ -124,13 +109,11 @@ public void windowClosing(final WindowEvent event) {
124109 }
125110 });
126111
127- contentPane .registerKeyboardAction (new ActionListener () {
128- @ Override
129- public void actionPerformed (final ActionEvent event ) {
130- onCancel ();
131- }
132- }, KeyStroke .getKeyStroke (KeyEvent .VK_ESCAPE , 0 ),
133- JComponent .WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
112+ contentPane .registerKeyboardAction (
113+ (final ActionEvent event ) -> onCancel (),
114+ KeyStroke .getKeyStroke (KeyEvent .VK_ESCAPE , 0 ),
115+ JComponent .WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
116+ );
134117 }
135118
136119 private void detectPackageName (final @ NotNull PsiDirectory initialBaseDir ) {
@@ -143,7 +126,7 @@ private void detectPackageName(final @NotNull PsiDirectory initialBaseDir) {
143126 }
144127
145128 protected void onOK () {
146- if (!validator . validate () ) {
129+ if (!validateFormFields ) {
147130 return ;
148131 }
149132 generateFiles ();
0 commit comments