Skip to content

Commit b2ca38e

Browse files
committedFeb 21, 2022
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-plugin into 959-moving-example-to-the-placeholder
2 parents 47621d0 + a327cf2 commit b2ca38e

File tree

4 files changed

+96
-20
lines changed

4 files changed

+96
-20
lines changed
 

‎resources/META-INF/plugin.xml

+12-12
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,25 @@
5656
<add-to-group group-id="PhpGenerateGroup" anchor="last"/>
5757
</group>
5858

59-
<group id="MagentoContextBasedActionsGroup" class="com.intellij.ide.actions.NonEmptyActionGroup" text="Context Actions" popup="false" compact="true" searchable="true">
59+
<group id="MagentoContextBasedActionsGroup" class="com.magento.idea.magento2plugin.actions.groups.ContextActionsGroup" text="Context Actions" popup="false" compact="true" searchable="true">
6060
<separator/>
6161
<!-- Context dependent actions -->
62-
<action id="MagentoCreateRoutesFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewRoutesXmlAction"/>
63-
<action id="MagentoCreateDiFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewDiXmlAction"/>
64-
<action id="MagentoCreateWebapiFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewWebapiXmlAction"/>
6562
<action id="MagentoCreateAclFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewAclXmlAction"/>
6663
<action id="MagentoCreateConfigFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewConfigXmlAction"/>
67-
<action id="MagentoCreateSystemFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewSystemXmlAction"/>
64+
<action id="MagentoCreateCrontabFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewCrontabXmlAction"/>
65+
<action id="MagentoCreateDiFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewDiXmlAction"/>
66+
<action id="MagentoCreateEmailTemplatesFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewEmailTemplatesXmlAction"/>
6867
<action id="MagentoCreateExtensionAttributesFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewExtensionAttributesXmlAction"/>
69-
<action id="MagentoCreateWidgetFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewWidgetXmlAction"/>
70-
<action id="MagentoCreateMviewFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewMviewXmlAction"/>
71-
<action id="MagentoCreateIndexerFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewIndexerXmlAction"/>
72-
<action id="MagentoCreateViewFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewViewXmlAction"/>
7368
<action id="MagentoCreateFieldsetFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewFieldsetXmlAction"/>
74-
<action id="MagentoCreateSectionsFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewSectionsXmlAction"/>
75-
<action id="MagentoCreateEmailTemplatesFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewEmailTemplatesXmlAction"/>
76-
<action id="MagentoCreateCrontabFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewCrontabXmlAction"/>
69+
<action id="MagentoCreateIndexerFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewIndexerXmlAction"/>
70+
<action id="MagentoCreateMviewFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewMviewXmlAction"/>
7771
<action id="MagentoCreatePageTypesFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewPageTypesXmlAction"/>
72+
<action id="MagentoCreateRoutesFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewRoutesXmlAction"/>
73+
<action id="MagentoCreateSectionsFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewSectionsXmlAction"/>
74+
<action id="MagentoCreateSystemFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewSystemXmlAction"/>
75+
<action id="MagentoCreateViewFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewViewXmlAction"/>
76+
<action id="MagentoCreateWebapiFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewWebapiXmlAction"/>
77+
<action id="MagentoCreateWidgetFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewWidgetXmlAction"/>
7878
<!-- Context dependent actions -->
7979
<separator/>
8080
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewXml"/>

‎src/com/magento/idea/magento2plugin/actions/generation/dialog/NewUiComponentFormDialog.form

+20-4
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@
175175
<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"/>
176176
</constraints>
177177
<properties>
178-
<text value="Controller Name"/>
178+
<text value="Action Path"/>
179179
</properties>
180180
</component>
181181
<component id="bb0f3" class="javax.swing.JTextField" binding="submitControllerName">
@@ -184,7 +184,12 @@
184184
<preferred-size width="150" height="-1"/>
185185
</grid>
186186
</constraints>
187-
<properties/>
187+
<properties>
188+
<toolTipText value="Can consist of few directories, for an ex.: Product/Custom"/>
189+
</properties>
190+
<clientProperties>
191+
<promptText class="java.lang.String" value="Folder name for Action"/>
192+
</clientProperties>
188193
</component>
189194
<component id="27a44" class="javax.swing.JLabel" binding="submitActionNameLabel">
190195
<constraints>
@@ -203,6 +208,9 @@
203208
<properties>
204209
<text value="Save"/>
205210
</properties>
211+
<clientProperties>
212+
<promptText class="java.lang.String" value="Class name for Action"/>
213+
</clientProperties>
206214
</component>
207215
<component id="5065a" class="javax.swing.JLabel" binding="saveControllerLabel">
208216
<constraints>
@@ -246,7 +254,7 @@
246254
<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"/>
247255
</constraints>
248256
<properties>
249-
<text value="Controller Name"/>
257+
<text value="Action Path"/>
250258
</properties>
251259
</component>
252260
<component id="f609b" class="javax.swing.JTextField" binding="viewControllerName">
@@ -255,7 +263,12 @@
255263
<preferred-size width="150" height="-1"/>
256264
</grid>
257265
</constraints>
258-
<properties/>
266+
<properties>
267+
<toolTipText value="Can consist of few directories, for an ex.: Product/Custom"/>
268+
</properties>
269+
<clientProperties>
270+
<promptText class="java.lang.String" value="Folder name for Action"/>
271+
</clientProperties>
259272
</component>
260273
<component id="6a2bd" class="javax.swing.JLabel" binding="viewControllerLabel">
261274
<constraints>
@@ -275,6 +288,9 @@
275288
<properties>
276289
<text value="Edit"/>
277290
</properties>
291+
<clientProperties>
292+
<promptText class="java.lang.String" value="Class name for Action"/>
293+
</clientProperties>
278294
</component>
279295
<component id="e2e73" class="javax.swing.JLabel" binding="actionNameLabel">
280296
<constraints>

‎src/com/magento/idea/magento2plugin/actions/generation/dialog/NewUiComponentGridDialog.form

+17-4
Original file line numberDiff line numberDiff line change
@@ -407,15 +407,15 @@
407407
<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"/>
408408
</constraints>
409409
<properties>
410-
<text value="Action"/>
410+
<text value="Action Name"/>
411411
</properties>
412412
</component>
413413
<component id="2ec13" class="javax.swing.JLabel" binding="controllerLabel">
414414
<constraints>
415415
<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"/>
416416
</constraints>
417417
<properties>
418-
<text value="Controller"/>
418+
<text value="Action Path"/>
419419
</properties>
420420
</component>
421421
<component id="ddde2" class="javax.swing.JTextField" binding="route">
@@ -424,15 +424,25 @@
424424
<preferred-size width="150" height="-1"/>
425425
</grid>
426426
</constraints>
427-
<properties/>
427+
<properties>
428+
<toolTipText value="The unique name of your router"/>
429+
</properties>
430+
<clientProperties>
431+
<promptText class="java.lang.String" value="entity_name"/>
432+
</clientProperties>
428433
</component>
429434
<component id="2b2ed" class="javax.swing.JTextField" binding="controllerName">
430435
<constraints>
431436
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
432437
<preferred-size width="150" height="-1"/>
433438
</grid>
434439
</constraints>
435-
<properties/>
440+
<properties>
441+
<toolTipText value="Can consist of few directories, for an ex.: Product/Custom"/>
442+
</properties>
443+
<clientProperties>
444+
<promptText class="java.lang.String" value="Folder name for Action"/>
445+
</clientProperties>
436446
</component>
437447
<component id="d08e6" class="javax.swing.JTextField" binding="actionName">
438448
<constraints>
@@ -441,6 +451,9 @@
441451
</grid>
442452
</constraints>
443453
<properties/>
454+
<clientProperties>
455+
<promptText class="java.lang.String" value="Class name for Action"/>
456+
</clientProperties>
444457
</component>
445458
<component id="e7551" class="javax.swing.JLabel" binding="controllerGeneralLabel">
446459
<constraints>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
package com.magento.idea.magento2plugin.actions.groups;
7+
8+
import com.intellij.ide.actions.NonEmptyActionGroup;
9+
import com.intellij.openapi.actionSystem.AnAction;
10+
import com.intellij.openapi.actionSystem.AnActionEvent;
11+
import java.util.Arrays;
12+
import java.util.Comparator;
13+
import java.util.LinkedList;
14+
import java.util.List;
15+
import org.jetbrains.annotations.NotNull;
16+
17+
public class ContextActionsGroup extends NonEmptyActionGroup {
18+
19+
@Override
20+
public void update(final @NotNull AnActionEvent event) {
21+
if (getChildrenCount() > 0) {
22+
final AnAction[] actions = getChildren(event);
23+
final List<AnAction> originalActionList = new LinkedList<>(Arrays.asList(actions));
24+
final List<AnAction> sortedActionList = new LinkedList<>(Arrays.asList(actions));
25+
sortedActionList.sort(new ContextActionsComparator());
26+
27+
if (!originalActionList.equals(sortedActionList)) {
28+
removeAll();
29+
addAll(sortedActionList.toArray(new AnAction[0]));
30+
}
31+
}
32+
33+
super.update(event);
34+
}
35+
36+
private static class ContextActionsComparator implements Comparator<AnAction> {
37+
38+
@Override
39+
public int compare(final AnAction action1, final AnAction action2) {
40+
if (action1.getTemplateText() == null || action2.getTemplateText() == null) {
41+
return 0;
42+
}
43+
44+
return action1.getTemplateText().compareTo(action2.getTemplateText());
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)
Please sign in to comment.