Skip to content

Commit 8e92c63

Browse files
873: Enhanced error outputting for new Magento 2 email template generation
1 parent 3b0b191 commit 8e92c63

File tree

2 files changed

+46
-15
lines changed

2 files changed

+46
-15
lines changed

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewEmailTemplateDialog.form

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="10" left="10" bottom="10" right="10"/>
55
<constraints>
6-
<xy x="48" y="54" width="436" height="297"/>
6+
<xy x="48" y="54" width="436" height="351"/>
77
</constraints>
8-
<properties/>
8+
<properties>
9+
<preferredSize width="450" height="325"/>
10+
</properties>
911
<border type="none"/>
1012
<children>
1113
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -49,7 +51,7 @@
4951
</grid>
5052
</children>
5153
</grid>
52-
<grid id="e3588" layout-manager="GridLayoutManager" row-count="6" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
54+
<grid id="e3588" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
5355
<margin top="0" left="0" bottom="0" right="0"/>
5456
<constraints>
5557
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -75,55 +77,55 @@
7577
</component>
7678
<component id="c7eac" class="javax.swing.JLabel">
7779
<constraints>
78-
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
80+
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
7981
</constraints>
8082
<properties>
8183
<text resource-bundle="magento2/common" key="common.template.label"/>
8284
</properties>
8385
</component>
8486
<component id="35e0c" class="javax.swing.JTextField" binding="label">
8587
<constraints>
86-
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
88+
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
8789
<preferred-size width="150" height="-1"/>
8890
</grid>
8991
</constraints>
9092
<properties/>
9193
</component>
9294
<component id="65e98" class="javax.swing.JLabel">
9395
<constraints>
94-
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
96+
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
9597
</constraints>
9698
<properties>
9799
<text resource-bundle="magento2/common" key="common.template.filename"/>
98100
</properties>
99101
</component>
100102
<component id="f244b" class="javax.swing.JLabel">
101103
<constraints>
102-
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
104+
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
103105
</constraints>
104106
<properties>
105107
<text resource-bundle="magento2/common" key="common.template.type"/>
106108
</properties>
107109
</component>
108110
<component id="33fd6" class="javax.swing.JLabel">
109111
<constraints>
110-
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
112+
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
111113
</constraints>
112114
<properties>
113115
<text resource-bundle="magento2/common" key="common.area.target"/>
114116
</properties>
115117
</component>
116118
<component id="617b5" class="javax.swing.JTextField" binding="fileName">
117119
<constraints>
118-
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
120+
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
119121
<preferred-size width="150" height="-1"/>
120122
</grid>
121123
</constraints>
122124
<properties/>
123125
</component>
124126
<component id="bfac1" class="com.magento.idea.magento2plugin.ui.FilteredComboBox" binding="area" custom-create="true">
125127
<constraints>
126-
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
128+
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
127129
</constraints>
128130
<properties>
129131
<toolTipText value=""/>
@@ -134,7 +136,7 @@
134136
</component>
135137
<component id="c5b33" class="com.magento.idea.magento2plugin.ui.FilteredComboBox" binding="templateType" custom-create="true">
136138
<constraints>
137-
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
139+
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
138140
</constraints>
139141
<properties>
140142
<toolTipText value=""/>
@@ -145,20 +147,44 @@
145147
</component>
146148
<component id="285c1" class="javax.swing.JLabel">
147149
<constraints>
148-
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
150+
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
149151
</constraints>
150152
<properties>
151153
<text resource-bundle="magento2/common" key="common.template.subject"/>
152154
</properties>
153155
</component>
154156
<component id="56e46" class="javax.swing.JTextField" binding="subject">
155157
<constraints>
156-
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
158+
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
157159
<preferred-size width="150" height="-1"/>
158160
</grid>
159161
</constraints>
160162
<properties/>
161163
</component>
164+
<component id="fd5e" class="javax.swing.JLabel" binding="identifierErrorMessage">
165+
<constraints>
166+
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
167+
</constraints>
168+
<properties>
169+
<text value=""/>
170+
</properties>
171+
</component>
172+
<component id="69f30" class="javax.swing.JLabel" binding="labelErrorMessage">
173+
<constraints>
174+
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
175+
</constraints>
176+
<properties>
177+
<text value=""/>
178+
</properties>
179+
</component>
180+
<component id="e3d5a" class="javax.swing.JLabel" binding="fileNameErrorMessage">
181+
<constraints>
182+
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
183+
</constraints>
184+
<properties>
185+
<text value=""/>
186+
</properties>
187+
</component>
162188
</children>
163189
</grid>
164190
</children>

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewEmailTemplateDialog.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.List;
3030
import javax.swing.JButton;
3131
import javax.swing.JComponent;
32+
import javax.swing.JLabel;
3233
import javax.swing.JPanel;
3334
import javax.swing.JTextField;
3435
import javax.swing.KeyStroke;
@@ -51,9 +52,11 @@ public class NewEmailTemplateDialog extends AbstractDialog {
5152
@FieldValidation(rule = RuleRegistry.IDENTIFIER,
5253
message = {IdentifierRule.MESSAGE, EMAIL_TEMPLATE_ID})
5354
private JTextField identifier;
55+
5456
@FieldValidation(rule = RuleRegistry.NOT_EMPTY,
5557
message = {NotEmptyRule.MESSAGE, LABEL})
5658
private JTextField label;
59+
5760
@FieldValidation(rule = RuleRegistry.NOT_EMPTY,
5861
message = {NotEmptyRule.MESSAGE, FILENAME})
5962
@FieldValidation(rule = RuleRegistry.IDENTIFIER,
@@ -64,6 +67,10 @@ public class NewEmailTemplateDialog extends AbstractDialog {
6467
private FilteredComboBox templateType;
6568
private JTextField subject;
6669

70+
private JLabel identifierErrorMessage;//NOPMD
71+
private JLabel labelErrorMessage;//NOPMD
72+
private JLabel fileNameErrorMessage;//NOPMD
73+
6774
/**
6875
* New email template dialog.
6976
*
@@ -208,11 +215,9 @@ private void onOK() {
208215
final boolean emailTemplateCanBeDeclared = !this.validator.validate(this);
209216

210217
if (!validateFormFields() || emailTemplateCanBeDeclared) {
211-
exit();
212218
return;
213219
}
214220
generateFile();
215-
216221
exit();
217222
}
218223

0 commit comments

Comments
 (0)