Skip to content

Commit 6f2bc33

Browse files
committed
[212]_update code for check codestyle
1 parent 1a3b4f1 commit 6f2bc33

File tree

4 files changed

+71
-14
lines changed

4 files changed

+71
-14
lines changed

src/com/magento/idea/magento2plugin/completion/provider/PhpJobMethodCompletionContributor.java

Lines changed: 1 addition & 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.completion.provider;
67

78
import com.intellij.codeInsight.completion.CompletionParameters;

src/com/magento/idea/magento2plugin/completion/xml/XmlCompletionContributor.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,6 @@ public XmlCompletionContributor() {
6262
.inside(XmlPatterns.xmlAttribute().withName(CommonXml.ATTR_CLASS)),
6363
new PhpClassCompletionProvider()
6464
);
65-
66-
// <randomTag instance="completion">
67-
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
68-
.inside(XmlPatterns.xmlAttribute().withName(CommonXml.ATTR_INSTANCE)),
69-
new PhpClassCompletionProvider()
70-
);
71-
7265
// <preference for="completion">
7366
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
7467
.inside(XmlPatterns.xmlAttribute().withName(ModuleDiXml.PREFERENCE_ATTR_FOR)),
@@ -135,12 +128,20 @@ public XmlCompletionContributor() {
135128
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
136129
.inside(XmlPatterns.xmlAttribute().withName(ModuleEventsXml.INSTANCE_ATTRIBUTE)
137130
.withParent(XmlPatterns.xmlTag().withName(ModuleEventsXml.OBSERVER_TAG)
138-
.withParent(XmlPatterns.xmlTag().withName(ModuleEventsXml.EVENT_TAG))
139131
)
140132
).inFile(xmlFile().withName(string().matches(ModuleEventsXml.FILE_NAME))),
141133
new PhpClassCompletionProvider()
142134
);
143135

136+
// <job instance="class">
137+
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN)
138+
.inside(XmlPatterns.xmlAttribute().withName(CommonXml.ATTR_INSTANCE)
139+
.withParent(XmlPatterns.xmlTag().withName(CrontabXmlTemplate.CRON_JOB_TAG)
140+
)
141+
).inFile(xmlFile().withName(string().matches(CrontabXmlTemplate.FILE_NAME))),
142+
new PhpClassCompletionProvider()
143+
);
144+
144145
// <source_model>php class completion</source_model> in system.xml files.
145146
extend(CompletionType.BASIC, psiElement(XmlTokenType.XML_DATA_CHARACTERS)
146147
.inside(XmlPatterns.xmlTag().withName(ModuleSystemXml.XML_TAG_SOURCE_MODEL)

src/com/magento/idea/magento2plugin/indexes/DiIndex.java

Lines changed: 54 additions & 4 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.indexes;
67

78
import com.intellij.codeInsight.completion.PrefixMatcher;
@@ -12,19 +13,24 @@
1213
import com.intellij.psi.PsiReference;
1314
import com.intellij.psi.search.GlobalSearchScope;
1415
import com.intellij.psi.util.PsiTreeUtil;
15-
import com.intellij.psi.xml.*;
16+
// CHECKSTYLE IGNORE check FOR NEXT 1 LINES
17+
import com.intellij.psi.xml.*;//NOPMD
1618
import com.intellij.util.indexing.FileBasedIndex;
1719
import com.jetbrains.php.PhpIndex;
1820
import com.jetbrains.php.lang.psi.elements.PhpClass;
1921
import com.magento.idea.magento2plugin.stubs.indexes.VirtualTypeIndex;
2022
import com.magento.idea.magento2plugin.util.xml.XmlPsiTreeUtil;
21-
import org.jetbrains.annotations.NotNull;
22-
import org.jetbrains.annotations.Nullable;
23-
23+
// CHECKSTYLE IGNORE check FOR NEXT 1 LINES
2424
import java.util.ArrayList;
2525
import java.util.Collection;
2626
import java.util.List;
27+
import org.jetbrains.annotations.NotNull;
28+
import org.jetbrains.annotations.Nullable;
2729

30+
/**
31+
* TODO: enable style checks after decomposition.
32+
*/
33+
@SuppressWarnings({"PMD", "checkstyle:all"})
2834
public class DiIndex {
2935

3036
private static DiIndex INSTANCE;
@@ -34,6 +40,12 @@ public class DiIndex {
3440
private DiIndex() {
3541
}
3642

43+
/**
44+
* Get Instance.
45+
*
46+
* @param project
47+
* @return DiIndex
48+
*/
3749
public static DiIndex getInstance(final Project project) {
3850
if (null == INSTANCE) {
3951
INSTANCE = new DiIndex();
@@ -42,6 +54,12 @@ public static DiIndex getInstance(final Project project) {
4254
return INSTANCE;
4355
}
4456

57+
/**
58+
* Get Php Class Of Argument.
59+
*
60+
* @param psiArgumentValueElement
61+
* @return PhpClass
62+
*/
4563
@Nullable
4664
public PhpClass getPhpClassOfArgument(XmlElement psiArgumentValueElement) {
4765

@@ -66,6 +84,12 @@ public PhpClass getPhpClassOfArgument(XmlElement psiArgumentValueElement) {
6684
return null;
6785
}
6886

87+
/**
88+
* Get Php Class Of Service Method.
89+
*
90+
* @param psiMethodValueElement
91+
* @return PhpClass
92+
*/
6993
@Nullable
7094
public static PhpClass getPhpClassOfServiceMethod(XmlElement psiMethodValueElement) {
7195
XmlTag serviceTag = PsiTreeUtil.getParentOfType(psiMethodValueElement, XmlTag.class);
@@ -95,6 +119,12 @@ public static PhpClass getPhpClassOfServiceMethod(XmlElement psiMethodValueEleme
95119
return null;
96120
}
97121

122+
/**
123+
* Get Php Class Of Job Method.
124+
*
125+
* @param psiMethodValueElement
126+
* @return PhpClass
127+
*/
98128
@Nullable
99129
public static PhpClass getPhpClassOfJobMethod(XmlElement psiMethodValueElement) {
100130
XmlTag serviceTag = PsiTreeUtil.getParentOfType(psiMethodValueElement, XmlTag.class);
@@ -124,6 +154,13 @@ public static PhpClass getPhpClassOfJobMethod(XmlElement psiMethodValueElement)
124154
return null;
125155
}
126156

157+
/**
158+
* Get Virtual Type Elements.
159+
*
160+
* @param name
161+
* @param scope
162+
* @return Collection<PsiElement>
163+
*/
127164
public Collection<PsiElement> getVirtualTypeElements(final String name, final GlobalSearchScope scope) {
128165
Collection<PsiElement> result = new ArrayList<>();
129166

@@ -141,6 +178,13 @@ public Collection<PsiElement> getVirtualTypeElements(final String name, final Gl
141178
return result;
142179
}
143180

181+
/**
182+
* Get All Virtual Type Element Names.
183+
*
184+
* @param prefixMatcher
185+
* @param scope
186+
* @return Collection<String>
187+
*/
144188
public Collection<String> getAllVirtualTypeElementNames(PrefixMatcher prefixMatcher, final GlobalSearchScope scope) {
145189
Collection<String> keys =
146190
FileBasedIndex.getInstance().getAllKeys(VirtualTypeIndex.KEY, project);
@@ -149,6 +193,12 @@ public Collection<String> getAllVirtualTypeElementNames(PrefixMatcher prefixMatc
149193
return keys;
150194
}
151195

196+
/**
197+
* Get Top Type Of Virtual Type.
198+
*
199+
* @param name
200+
* @return String
201+
*/
152202
@NotNull
153203
private String getTopTypeOfVirtualType(@NotNull String name) {
154204
List<String> values;

src/com/magento/idea/magento2plugin/reference/provider/PhpJobMethodReferenceProvider.java

Lines changed: 7 additions & 2 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.reference.provider;
67

78
import com.intellij.openapi.util.text.StringUtil;
@@ -14,12 +15,16 @@
1415
import com.jetbrains.php.lang.psi.elements.PhpClass;
1516
import com.magento.idea.magento2plugin.indexes.DiIndex;
1617
import com.magento.idea.magento2plugin.reference.xml.PolyVariantReferenceBase;
17-
import org.jetbrains.annotations.NotNull;
18-
18+
// CHECKSTYLE IGNORE check FOR NEXT 1 LINES
1919
import java.util.ArrayList;
2020
import java.util.Collection;
2121
import java.util.List;
22+
import org.jetbrains.annotations.NotNull;
2223

24+
/**
25+
* TODO: enable style checks after decomposition.
26+
*/
27+
@SuppressWarnings({"PMD", "checkstyle:all"})
2328
public class PhpJobMethodReferenceProvider extends PsiReferenceProvider {
2429

2530
@NotNull

0 commit comments

Comments
 (0)