Skip to content

Commit dcd7e13

Browse files
author
Vyacheslav Kotelnikov
committed
added preferred test framework combobox to settings form
1 parent 6acbaa2 commit dcd7e13

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

src/main/java/com/bruce/intellijplugin/generatesetter/template/GenerateAllSetterSettingForm.form

+29-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
6-
<xy x="20" y="20" width="500" height="400"/>
6+
<xy x="20" y="20" width="521" height="400"/>
77
</constraints>
88
<properties/>
99
<border type="none"/>
@@ -15,7 +15,7 @@
1515
<properties/>
1616
<border type="none"/>
1717
<children>
18-
<grid id="a574c" layout-manager="GridLayoutManager" row-count="3" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
18+
<grid id="a574c" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
1919
<margin top="0" left="0" bottom="0" right="0"/>
2020
<constraints border-constraint="North"/>
2121
<properties/>
@@ -47,7 +47,7 @@
4747
<grid id="99e56" layout-manager="GridLayoutManager" row-count="2" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
4848
<margin top="0" left="0" bottom="0" right="0"/>
4949
<constraints>
50-
<grid row="1" column="0" row-span="2" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
50+
<grid row="2" column="0" row-span="2" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
5151
</constraints>
5252
<properties/>
5353
<border type="none"/>
@@ -124,6 +124,32 @@
124124
</grid>
125125
</children>
126126
</grid>
127+
<grid id="e4650" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
128+
<margin top="0" left="0" bottom="0" right="0"/>
129+
<constraints>
130+
<grid row="1" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
131+
</constraints>
132+
<properties/>
133+
<border type="none"/>
134+
<children>
135+
<component id="687d3" class="javax.swing.JLabel" binding="preferredTestingFrameworkForLabel" default-binding="true">
136+
<constraints>
137+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
138+
</constraints>
139+
<properties>
140+
<text value="Preferred testing framework (for assertions)"/>
141+
</properties>
142+
</component>
143+
<component id="ea787" class="javax.swing.JComboBox" binding="comboBoxPreferredTestFramework">
144+
<constraints>
145+
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
146+
</constraints>
147+
<properties>
148+
<editable value="false"/>
149+
</properties>
150+
</component>
151+
</children>
152+
</grid>
127153
</children>
128154
</grid>
129155
<grid id="ca9b3" binding="splitterPanel" layout-manager="BorderLayout" hgap="0" vgap="0">

src/main/java/com/bruce/intellijplugin/generatesetter/template/GenerateAllSetterSettingForm.java

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ public class GenerateAllSetterSettingForm {
6363
private JPanel splitterPanel;
6464
private JCheckBox useOnlyJDKClassesCheckBox;
6565
private JPanel generateByTemplateSettings;
66+
private JComboBox comboBoxPreferredTestFramework;
67+
private JLabel preferredTestingFrameworkForLabel;
6668
private GenerateSetterState myGenerateSetterState;
6769
private int currentSelectedIndex = -1;
6870

@@ -252,6 +254,7 @@ public void importFromSettings(GenerateSetterState state) {
252254
public GenerateSetterState getTheState() {
253255
myGenerateSetterState.setGenerateByTemplate(enableGenerateByTemplateCheckBox.isSelected());
254256
myGenerateSetterState.setUseJdkClassesOnly(useOnlyJDKClassesCheckBox.isSelected());
257+
myGenerateSetterState.setPreferredTestingFramework(((String) comboBoxPreferredTestFramework.getSelectedItem()));
255258
return myGenerateSetterState;
256259
}
257260

src/main/java/com/bruce/intellijplugin/generatesetter/template/GenerateSetterState.java

+12
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class GenerateSetterState {
2828
private Boolean useJdkClassesOnly = false;
2929
private Boolean generateByTemplate = false;
3030

31+
private String preferredTestingFramework = "JUnit 5";
32+
3133
private List<Template> templateList = Lists.newArrayList();
3234

3335
public Boolean getUseJdkClassesOnly() {
@@ -66,6 +68,7 @@ public boolean equals(Object o) {
6668
.append(useJdkClassesOnly, that.useJdkClassesOnly)
6769
.append(generateByTemplate, that.generateByTemplate)
6870
.append(templateList, that.templateList)
71+
.append(preferredTestingFramework, that.preferredTestingFramework)
6972
.isEquals();
7073
}
7174

@@ -75,6 +78,15 @@ public int hashCode() {
7578
.append(useJdkClassesOnly)
7679
.append(generateByTemplate)
7780
.append(templateList)
81+
.append(preferredTestingFramework)
7882
.toHashCode();
7983
}
84+
85+
public String getPreferredTestingFramework() {
86+
return preferredTestingFramework;
87+
}
88+
89+
public void setPreferredTestingFramework(String preferredTestingFramework) {
90+
this.preferredTestingFramework = preferredTestingFramework;
91+
}
8092
}

0 commit comments

Comments
 (0)