77
88import com .intellij .openapi .project .Project ;
99import com .intellij .psi .PsiDirectory ;
10- import com .intellij .psi .PsiFile ;
1110import com .magento .idea .magento2plugin .actions .generation .NewBlockAction ;
1211import com .magento .idea .magento2plugin .actions .generation .data .BlockFileData ;
1312import com .magento .idea .magento2plugin .actions .generation .dialog .validator .annotation .FieldValidation ;
2625import java .awt .event .WindowEvent ;
2726import javax .swing .JButton ;
2827import javax .swing .JComponent ;
28+ import javax .swing .JLabel ;
2929import javax .swing .JPanel ;
3030import javax .swing .JRadioButton ;
3131import javax .swing .JTextField ;
3232import javax .swing .JTextPane ;
3333import javax .swing .KeyStroke ;
3434
3535public class NewBlockDialog extends AbstractDialog {
36+
3637 private final PsiDirectory baseDir ;
3738 private final String moduleName ;
3839 private JPanel contentPanel ;
@@ -44,18 +45,18 @@ public class NewBlockDialog extends AbstractDialog {
4445 private static final String NAME = "name" ;
4546 private static final String DIRECTORY = "directory" ;
4647
47- @ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
48- message = {NotEmptyRule .MESSAGE , NAME })
49- @ FieldValidation (rule = RuleRegistry .PHP_CLASS ,
50- message = {PhpClassRule .MESSAGE , NAME })
48+ @ FieldValidation (rule = RuleRegistry .NOT_EMPTY , message = {NotEmptyRule .MESSAGE , NAME })
49+ @ FieldValidation (rule = RuleRegistry .PHP_CLASS , message = {PhpClassRule .MESSAGE , NAME })
5150 private JTextField blockName ;
5251
53- @ FieldValidation (rule = RuleRegistry .NOT_EMPTY ,
54- message = {NotEmptyRule .MESSAGE , DIRECTORY })
52+ @ FieldValidation (rule = RuleRegistry .NOT_EMPTY , message = {NotEmptyRule .MESSAGE , DIRECTORY })
5553 @ FieldValidation (rule = RuleRegistry .PHP_DIRECTORY ,
5654 message = {PhpDirectoryRule .MESSAGE , DIRECTORY })
5755 private JTextField blockParentDir ;
5856
57+ private JLabel blockNameErrorMessage ;//NOPMD
58+ private JLabel blockParentDirErrorMessage ;//NOPMD
59+
5960 /**
6061 * Constructor.
6162 *
@@ -113,8 +114,8 @@ public static void open(final Project project, final PsiDirectory directory) {
113114 protected void onOK () {
114115 if (validateFormFields ()) {
115116 generateFile ();
117+ exit ();
116118 }
117- exit ();
118119 }
119120
120121 private void generateFile () {
0 commit comments