Skip to content

Commit e69522f

Browse files
committed
Merge branch '4.3.0-develop' of github.com:magento/magento2-phpstorm-plugin into 963-bug-composer-json-generation
2 parents 3dcfc39 + c8d2559 commit e69522f

File tree

4 files changed

+102
-1
lines changed

4 files changed

+102
-1
lines changed

resources/META-INF/plugin.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@
6161
<!-- Context dependent actions -->
6262
<action id="MagentoCreateRoutesFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewRoutesXmlAction"/>
6363
<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"/>
65+
<action id="MagentoCreateAclFile" class="com.magento.idea.magento2plugin.actions.context.xml.NewAclXmlAction"/>
6466
<!-- Context dependent actions -->
6567
<separator/>
6668
<add-to-group group-id="NewGroup" anchor="before" relative-to-action="NewXml"/>
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0"?>
22
#parse("XML File Header.xml")
3-
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
3+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
45
</config>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
package com.magento.idea.magento2plugin.actions.context.xml;
7+
8+
import com.intellij.ide.fileTemplates.actions.AttributesDefaults;
9+
import com.intellij.psi.PsiDirectory;
10+
import com.intellij.psi.PsiFile;
11+
import com.magento.idea.magento2plugin.actions.context.AbstractContextAction;
12+
import com.magento.idea.magento2plugin.magento.files.ModuleAclXml;
13+
import com.magento.idea.magento2plugin.magento.packages.ComponentType;
14+
import com.magento.idea.magento2plugin.magento.packages.Package;
15+
import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil;
16+
import org.jetbrains.annotations.NotNull;
17+
18+
public class NewAclXmlAction extends AbstractContextAction {
19+
20+
public static final String ACTION_NAME = "Magento 2 ACL File";
21+
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 acl.xml file";
22+
23+
/**
24+
* New acl.xml file generation action constructor.
25+
*/
26+
public NewAclXmlAction() {
27+
super(ACTION_NAME, ACTION_DESCRIPTION, ModuleAclXml.getInstance());
28+
}
29+
30+
@Override
31+
protected boolean isVisible(
32+
final @NotNull GetMagentoModuleUtil.MagentoModuleData moduleData,
33+
final @NotNull PsiDirectory targetDirectory,
34+
final PsiFile targetFile
35+
) {
36+
return targetDirectory.getName().equals(Package.moduleBaseAreaDir)
37+
&& moduleData.getType().equals(ComponentType.module);
38+
}
39+
40+
@Override
41+
protected AttributesDefaults getProperties(
42+
final @NotNull AttributesDefaults defaults,
43+
final @NotNull GetMagentoModuleUtil.MagentoModuleData moduleData,
44+
final PsiDirectory targetDirectory,
45+
final PsiFile targetFile
46+
) {
47+
return defaults;
48+
}
49+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
package com.magento.idea.magento2plugin.actions.context.xml;
7+
8+
import com.intellij.ide.fileTemplates.actions.AttributesDefaults;
9+
import com.intellij.psi.PsiDirectory;
10+
import com.intellij.psi.PsiFile;
11+
import com.magento.idea.magento2plugin.actions.context.AbstractContextAction;
12+
import com.magento.idea.magento2plugin.magento.files.ModuleWebApiXmlFile;
13+
import com.magento.idea.magento2plugin.magento.packages.ComponentType;
14+
import com.magento.idea.magento2plugin.magento.packages.Package;
15+
import com.magento.idea.magento2plugin.util.magento.GetMagentoModuleUtil;
16+
import org.jetbrains.annotations.NotNull;
17+
18+
public class NewWebapiXmlAction extends AbstractContextAction {
19+
20+
public static final String ACTION_NAME = "Magento 2 WEB API File";
21+
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 webapi.xml file";
22+
23+
/**
24+
* New webapi.xml file generation action constructor.
25+
*/
26+
public NewWebapiXmlAction() {
27+
super(ACTION_NAME, ACTION_DESCRIPTION, new ModuleWebApiXmlFile());
28+
}
29+
30+
@Override
31+
protected boolean isVisible(
32+
final @NotNull GetMagentoModuleUtil.MagentoModuleData moduleData,
33+
final @NotNull PsiDirectory targetDirectory,
34+
final PsiFile targetFile
35+
) {
36+
return targetDirectory.getName().equals(Package.moduleBaseAreaDir)
37+
&& moduleData.getType().equals(ComponentType.module);
38+
}
39+
40+
@Override
41+
protected AttributesDefaults getProperties(
42+
final @NotNull AttributesDefaults defaults,
43+
final @NotNull GetMagentoModuleUtil.MagentoModuleData moduleData,
44+
final PsiDirectory targetDirectory,
45+
final PsiFile targetFile
46+
) {
47+
return defaults;
48+
}
49+
}

0 commit comments

Comments
 (0)