Skip to content

Commit 2ad8ba7

Browse files
author
Vasilii Burlacu
committed
Adding the license to the "New Module" form
1 parent 77fa261 commit 2ad8ba7

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

resources/fileTemplates/internal/Magento Module Composer.json.ft

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
},
1010
#end
1111
#if (${LICENSE})
12-
${LICENSE},
12+
"license": [
13+
${LICENSE}
14+
],
1315
#end
1416
"autoload": {
1517
"files": [

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

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.magento.idea.magento2plugin.actions.generation.dialog.NewMagentoModuleDialog">
3-
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<grid id="cbd77" binding="contentPane" layout-manager="GridLayoutManager" row-count="5" column-count="2" 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="462" height="297"/>
6+
<xy x="48" y="54" width="638" height="433"/>
77
</constraints>
88
<properties/>
99
<border type="none"/>
1010
<children>
1111
<grid id="94766" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
1212
<margin top="0" left="0" bottom="0" right="0"/>
1313
<constraints>
14-
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
14+
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="1" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
1515
</constraints>
1616
<properties/>
1717
<border type="none"/>
@@ -49,7 +49,7 @@
4949
</grid>
5050
</children>
5151
</grid>
52-
<grid id="e3588" layout-manager="GridLayoutManager" row-count="3" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
52+
<grid id="e3588" layout-manager="GridLayoutManager" row-count="4" column-count="4" same-size-horizontally="true" same-size-vertically="false" hgap="-1" vgap="-1">
5353
<margin top="0" left="0" bottom="0" right="0"/>
5454
<constraints>
5555
<grid row="0" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -116,6 +116,24 @@
116116
<text value="Module Version"/>
117117
</properties>
118118
</component>
119+
<component id="8bae" class="javax.swing.JList" binding="moduleLicense">
120+
<constraints>
121+
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="2" anchor="9" fill="0" indent="0" use-parent-layout="false">
122+
<preferred-size width="100" height="50"/>
123+
</grid>
124+
</constraints>
125+
<properties>
126+
<toolTipText value="Module's Lincese"/>
127+
</properties>
128+
</component>
129+
<component id="c5925" class="javax.swing.JLabel" binding="moduleLicenseLabel">
130+
<constraints>
131+
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="9" fill="0" indent="0" use-parent-layout="false"/>
132+
</constraints>
133+
<properties>
134+
<text value="License(s)"/>
135+
</properties>
136+
</component>
119137
</children>
120138
</grid>
121139
<component id="4c5ac" class="javax.swing.JTextArea" binding="moduleDescription">

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public class NewMagentoModuleDialog extends AbstractDialog {
5555
private JLabel moduleDescriptionLabel;
5656
private JTextField moduleVersion;
5757
private JLabel moduleVersionLabel;
58+
private JList moduleLicense;
59+
private JLabel moduleLicenseLabel;
5860
private String detectedPackageName;
5961

6062
public NewMagentoModuleDialog(@NotNull Project project, @NotNull PsiDirectory initialBaseDir, @Nullable PsiFile file, @Nullable IdeView view, @Nullable Editor editor) {
@@ -74,6 +76,10 @@ public NewMagentoModuleDialog(@NotNull Project project, @NotNull PsiDirectory in
7476
getRootPane().setDefaultButton(buttonOK);
7577
pushToMiddle();
7678

79+
String licenses[] = {"license 1", "license 2"};
80+
81+
moduleLicense.setListData(licenses);
82+
7783
buttonOK.addActionListener(new ActionListener() {
7884
public void actionPerformed(ActionEvent e) {
7985
onOK();
@@ -180,6 +186,10 @@ public String getModuleVersion() {
180186
return this.moduleVersion.getText().trim();
181187
}
182188

189+
public List getModuleLicense() {
190+
return (List) this.moduleLicense.getSelectedValuesList();
191+
}
192+
183193
public static void open(@NotNull Project project, @NotNull PsiDirectory initialBaseDir, @Nullable PsiFile file, @Nullable IdeView view, @Nullable Editor editor) {
184194
NewMagentoModuleDialog dialog = new NewMagentoModuleDialog(project, initialBaseDir, file, view, editor);
185195
dialog.pack();

0 commit comments

Comments
 (0)