|
2 | 2 | * Copyright © Magento, Inc. All rights reserved. |
3 | 3 | * See COPYING.txt for license details. |
4 | 4 | */ |
| 5 | + |
5 | 6 | package com.magento.idea.magento2plugin.linemarker.php; |
6 | 7 |
|
7 | 8 | import com.intellij.codeInsight.daemon.LineMarkerInfo; |
8 | 9 | import com.intellij.codeInsight.daemon.LineMarkerProvider; |
9 | 10 | import com.intellij.codeInsight.navigation.NavigationGutterIconBuilder; |
10 | | -import com.intellij.lang.jsgraphql.GraphQLIcons; |
| 11 | +import com.intellij.lang.jsgraphql.icons.GraphQLIcons; |
11 | 12 | import com.intellij.psi.PsiElement; |
12 | 13 | import com.intellij.psi.util.PsiTreeUtil; |
13 | 14 | import com.jetbrains.php.lang.psi.elements.PhpClass; |
14 | 15 | import com.magento.idea.magento2plugin.project.Settings; |
15 | 16 | import com.magento.idea.magento2plugin.util.magento.graphql.GraphQlUsagesCollector; |
16 | 17 | import com.magento.idea.magento2plugin.util.magento.graphql.GraphQlUtil; |
17 | | -import org.jetbrains.annotations.NotNull; |
18 | | -import org.jetbrains.annotations.Nullable; |
19 | | - |
20 | 18 | import java.util.Collection; |
21 | 19 | import java.util.List; |
| 20 | +import org.jetbrains.annotations.NotNull; |
| 21 | +import org.jetbrains.annotations.Nullable; |
22 | 22 |
|
23 | 23 | public class GraphQlResolverUsageLineMarkerProvider implements LineMarkerProvider { |
24 | | - @Nullable |
| 24 | + |
25 | 25 | @Override |
26 | | - public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement psiElement) { |
| 26 | + public @Nullable LineMarkerInfo<?> getLineMarkerInfo(final @NotNull PsiElement psiElement) { |
27 | 27 | return null; |
28 | 28 | } |
29 | 29 |
|
30 | 30 | @Override |
31 | | - public void collectSlowLineMarkers(@NotNull List<? extends PsiElement> psiElements, @NotNull Collection<? super LineMarkerInfo<?>> collection) { |
32 | | - if (psiElements.size() > 0) { |
33 | | - if (!Settings.isEnabled(psiElements.get(0).getProject())) { |
34 | | - return; |
35 | | - } |
| 31 | + public void collectSlowLineMarkers( |
| 32 | + final @NotNull List<? extends PsiElement> psiElements, |
| 33 | + final @NotNull Collection<? super LineMarkerInfo<?>> collection |
| 34 | + ) { |
| 35 | + if (!psiElements.isEmpty() && !Settings.isEnabled(psiElements.get(0).getProject())) { |
| 36 | + return; |
36 | 37 | } |
37 | 38 |
|
38 | | - for (PsiElement psiElement : psiElements) { |
| 39 | + for (final PsiElement psiElement : psiElements) { |
39 | 40 | if (psiElement instanceof PhpClass) { |
40 | | - List<? extends PsiElement> results; |
41 | | - |
42 | 41 | if (!GraphQlUtil.isResolver((PhpClass) psiElement)) { |
43 | 42 | return; |
44 | 43 | } |
45 | | - GraphQlUsagesCollector collector = new GraphQlUsagesCollector(); |
46 | | - results = collector.getGraphQLUsages((PhpClass) psiElement); |
| 44 | + final GraphQlUsagesCollector collector = new GraphQlUsagesCollector();//NOPMD |
| 45 | + final List<? extends PsiElement> results = collector.getGraphQLUsages( |
| 46 | + (PhpClass) psiElement |
| 47 | + ); |
47 | 48 |
|
48 | | - if (results.size() > 0 ) { |
| 49 | + if (!results.isEmpty()) { |
49 | 50 | collection.add(NavigationGutterIconBuilder |
50 | 51 | .create(GraphQLIcons.FILE) |
51 | 52 | .setTargets(results) |
|
0 commit comments