Skip to content

Commit 7efc8ec

Browse files
committed
Fixed CheckStyle issues
1 parent 00305e5 commit 7efc8ec

File tree

4 files changed

+42
-13
lines changed

4 files changed

+42
-13
lines changed

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.actions.generation;
67

78
import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -17,10 +18,10 @@
1718
import com.jetbrains.php.lang.psi.elements.PhpClass;
1819
import com.magento.idea.magento2plugin.MagentoIcons;
1920
import com.magento.idea.magento2plugin.actions.generation.dialog.CreateAPluginDialog;
21+
import com.magento.idea.magento2plugin.project.Settings;
2022
import com.magento.idea.magento2plugin.util.GetFirstClassOfFile;
2123
import com.magento.idea.magento2plugin.util.magento.plugin.IsPluginAllowedForMethod;
2224
import org.jetbrains.annotations.NotNull;
23-
import com.magento.idea.magento2plugin.project.Settings;
2425

2526
public class CreateAPluginAction extends DumbAwareAction {
2627
public static final String ACTION_NAME = "Create a new Plugin for this method";
@@ -30,12 +31,18 @@ public class CreateAPluginAction extends DumbAwareAction {
3031
private Method targetMethod;
3132
private PhpClass targetClass;
3233

34+
/**
35+
* Constructor.
36+
*/
3337
public CreateAPluginAction() {
3438
super(ACTION_NAME, ACTION_DESCRIPTION, MagentoIcons.MODULE);
3539
this.isPluginAllowed = IsPluginAllowedForMethod.getInstance();
3640
this.getFirstClassOfFile = GetFirstClassOfFile.getInstance();
3741
}
3842

43+
/**
44+
* Updates the state of action.
45+
*/
3946
@Override
4047
public void update(final AnActionEvent event) {
4148
targetClass = null;// NOPMD
@@ -46,9 +53,9 @@ public void update(final AnActionEvent event) {
4653
final PsiFile psiFile = pair.getFirst();
4754
final PhpClass phpClass = pair.getSecond();
4855
if (phpClass == null
49-
|| !(psiFile instanceof PhpFile)
50-
|| phpClass.isFinal()
51-
|| this.targetMethod == null
56+
|| !(psiFile instanceof PhpFile)
57+
|| phpClass.isFinal()
58+
|| this.targetMethod == null
5259
) {
5360
this.setStatus(event, false);
5461
return;
@@ -88,7 +95,11 @@ private Pair<PsiFile, PhpClass> findPhpClass(@NotNull final AnActionEvent event)
8895
return Pair.create(psiFile, phpClass);
8996
}
9097

91-
private void fetchTargetMethod(@NotNull final AnActionEvent event, final PsiFile psiFile, final PhpClass phpClass) {
98+
private void fetchTargetMethod(
99+
@NotNull final AnActionEvent event,
100+
final PsiFile psiFile,
101+
final PhpClass phpClass
102+
) {
92103
final Caret caret = event.getData(PlatformDataKeys.CARET);
93104
if (caret == null) {
94105
return;
@@ -98,12 +109,14 @@ private void fetchTargetMethod(@NotNull final AnActionEvent event, final PsiFile
98109
if (element == null) {
99110
return;
100111
}
101-
if (element instanceof Method && element.getParent() == phpClass && isPluginAllowed.check((Method) element)) {
112+
if (element instanceof Method && element.getParent()
113+
== phpClass && isPluginAllowed.check((Method) element)) {
102114
this.targetMethod = (Method) element;
103115
return;
104116
}
105117
final PsiElement parent = element.getParent();
106-
if (parent instanceof Method && parent.getParent() == phpClass && isPluginAllowed.check((Method) parent)) {
118+
if (parent instanceof Method && parent.getParent()
119+
== phpClass && isPluginAllowed.check((Method) parent)) {
107120
this.targetMethod = (Method) parent;
108121
}
109122
}

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.actions.generation;
67

78
import com.intellij.lang.ASTNode;
@@ -35,6 +36,9 @@ public CreateAnObserverAction() {
3536
super(ACTION_NAME, ACTION_DESCRIPTION, MagentoIcons.MODULE);
3637
}
3738

39+
/**
40+
* Updates the state of action.
41+
*/
3842
@Override
3943
public void update(final AnActionEvent event) {
4044
final Project project = event.getData(PlatformDataKeys.PROJECT);
@@ -78,10 +82,12 @@ private PsiElement getElement(@NotNull final AnActionEvent event) {
7882
}
7983

8084
private boolean isObserverEventNameClicked(@NotNull final PsiElement element) {
81-
return checkIsElementStringLiteral(element) &&
82-
checkIsParametersList(element.getParent().getParent()) &&
83-
checkIsMethodReference(element.getParent().getParent().getParent()) &&
84-
checkIsEventDispatchMethod((MethodReference) element.getParent().getParent().getParent());
85+
return checkIsElementStringLiteral(element)
86+
&& checkIsParametersList(element.getParent().getParent())
87+
&& checkIsMethodReference(element.getParent().getParent().getParent())
88+
&& checkIsEventDispatchMethod(
89+
(MethodReference) element.getParent().getParent().getParent()
90+
);
8591
}
8692

8793
private boolean checkIsParametersList(@NotNull final PsiElement element) {
@@ -119,7 +125,8 @@ private boolean checkIsElementStringLiteral(@NotNull final PsiElement element) {
119125
}
120126
final IElementType elementType = astNode.getElementType();
121127

122-
return elementType == PhpTokenTypes.STRING_LITERAL || elementType == PhpTokenTypes.STRING_LITERAL_SINGLE_QUOTE;
128+
return elementType == PhpTokenTypes.STRING_LITERAL
129+
|| elementType == PhpTokenTypes.STRING_LITERAL_SINGLE_QUOTE;
123130
}
124131

125132
private void setStatus(final AnActionEvent event, final boolean status) {

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.actions.generation;
67

78
import com.intellij.ide.IdeView;
8-
import com.intellij.openapi.actionSystem.*;
9+
import com.intellij.openapi.actionSystem.AnAction;
10+
import com.intellij.openapi.actionSystem.AnActionEvent;
11+
import com.intellij.openapi.actionSystem.CommonDataKeys;
12+
import com.intellij.openapi.actionSystem.DataContext;
13+
import com.intellij.openapi.actionSystem.LangDataKeys;
914
import com.intellij.openapi.project.Project;
1015
import com.intellij.psi.PsiDirectory;
1116
import com.magento.idea.magento2plugin.MagentoIcons;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright © Magento, Inc. All rights reserved.
33
* See COPYING.txt for license details.
44
*/
5+
56
package com.magento.idea.magento2plugin.actions.generation;
67

78
import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -29,6 +30,9 @@ public OverrideClassByAPreferenceAction() {
2930
this.getFirstClassOfFile = GetFirstClassOfFile.getInstance();
3031
}
3132

33+
/**
34+
* Updates the state of action.
35+
*/
3236
@Override
3337
public void update(final AnActionEvent event) {
3438
targetClass = null;// NOPMD

0 commit comments

Comments
 (0)