Skip to content

Commit 646e288

Browse files
Code refactoring after code review
1 parent 5f17af6 commit 646e288

16 files changed

+35
-20
lines changed

src/com/magento/idea/magento2plugin/actions/generation/NewWebApiInterfaceAction.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.magento.idea.magento2plugin.MagentoIcons;
1414
import com.magento.idea.magento2plugin.actions.generation.dialog.NewInterfaceForServiceDialog;
1515
import com.magento.idea.magento2plugin.project.Settings;
16+
import com.magento.idea.magento2plugin.util.RegExUtil;
1617
import com.magento.idea.magento2plugin.util.magento.IsFileInEditableModuleUtil;
1718
import com.magento.idea.magento2plugin.util.php.PhpPsiElementsUtil;
1819
import org.jetbrains.annotations.NotNull;
@@ -45,6 +46,15 @@ public void update(final @NotNull AnActionEvent event) {
4546
|| !IsFileInEditableModuleUtil.execute(phpClass.getContainingFile())) {
4647
return;
4748
}
49+
// Excluding API generators for Test/ and *Test.php files
50+
// in order to not overload the context menu.
51+
final String filename = phpClass.getContainingFile().getName();
52+
53+
if (filename.matches(RegExUtil.Magento.TEST_FILE_NAME)
54+
|| phpClass.getPresentableFQN().matches(RegExUtil.Magento.TEST_CLASS_FQN)) {
55+
return;
56+
}
57+
4858
currentPhpClass = phpClass;
4959
setIsAvailableForEvent(event, true);
5060
}

src/com/magento/idea/magento2plugin/actions/generation/data/php/WebApiInterfaceData.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class WebApiInterfaceData {
1818
private final List<Method> methods;
1919

2020
/**
21-
* Web Api interface DTO constructor.
21+
* Web API interface DTO constructor.
2222
*
2323
* @param moduleName String
2424
* @param classFqn String

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
8181
</constraints>
8282
<properties>
83-
<text value="Api For Class"/>
83+
<text value="API For Class"/>
8484
</properties>
8585
</component>
8686
<component id="a5a78" class="javax.swing.JTextField" binding="serviceMethodsField">
@@ -123,15 +123,15 @@
123123
<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"/>
124124
</constraints>
125125
<properties>
126-
<text value="Api Description"/>
126+
<text value="API Description"/>
127127
</properties>
128128
</component>
129129
<component id="1b056" class="javax.swing.JLabel" binding="nameFieldLabel">
130130
<constraints>
131131
<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"/>
132132
</constraints>
133133
<properties>
134-
<text value="Api Name"/>
134+
<text value="API Name"/>
135135
</properties>
136136
</component>
137137
<component id="6ea78" class="javax.swing.JTextField" binding="nameField">

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
public class NewInterfaceForServiceDialog extends AbstractDialog {
4646

4747
private static final String SERVICE_METHODS = "Covered Methods";
48-
private static final String NAME_FIELD = "Api Name";
49-
private static final String DESCRIPTION_FIELD = "Api Description";
48+
private static final String NAME_FIELD = "API Name";
49+
private static final String DESCRIPTION_FIELD = "API Description";
5050

5151
private final @NotNull Project project;
5252
private final String moduleName;
@@ -81,7 +81,7 @@ public class NewInterfaceForServiceDialog extends AbstractDialog {
8181
private JLabel descriptionFieldErrorMessage;//NOPMD
8282

8383
/**
84-
* New Web Api Interface for the php class.
84+
* New Web API Interface for the php class.
8585
*
8686
* @param project Project
8787
* @param directory PsiDirectory
@@ -128,7 +128,7 @@ public void windowClosing(final WindowEvent event) {
128128
}
129129

130130
/**
131-
* Open New Web Api interface for the php class dialog window.
131+
* Open New Web API interface for the php class dialog window.
132132
*
133133
* @param project Project
134134
* @param directory PsiDirectory

0 commit comments

Comments
 (0)