@@ -35,43 +35,54 @@ public LineMarkerInfo<?> getLineMarkerInfo(@NotNull PsiElement psiElement) {
35
35
return null ;
36
36
}
37
37
38
- @ Nullable
39
- public LineMarkerInfo <?> collect ( PsiElement psiElement ) {
40
- if (! Symfony2ProjectComponent . isEnabled ( psiElement ) || psiElement . getNode (). getElementType () != PhpTokenTypes . IDENTIFIER ) {
41
- return null ;
38
+ @ Override
39
+ public void collectSlowLineMarkers ( @ NotNull List <? extends PsiElement > psiElements , @ NotNull Collection <? super LineMarkerInfo <?>> results ) {
40
+ if ( psiElements . isEmpty ( ) || ! Symfony2ProjectComponent . isEnabled ( psiElements . get ( 0 )) ) {
41
+ return ;
42
42
}
43
43
44
- PsiElement method = psiElement . getParent ();
45
- if (!( method instanceof Method ) || !(( Method ) method ). getAccess (). isPublic ( )) {
46
- return null ;
47
- }
44
+ for ( PsiElement psiElement : psiElements ) {
45
+ if ( psiElement . getNode (). getElementType () != PhpTokenTypes . IDENTIFIER || !(psiElement . getParent () instanceof Method method )) {
46
+ continue ;
47
+ }
48
48
49
- List <GotoRelatedItem > gotoRelatedItems = getGotoRelatedItems ((Method ) method );
49
+ LineMarkerInfo <?> lineMarkerInfo = collect (psiElement , method );
50
+ if (lineMarkerInfo != null ) {
51
+ results .add (lineMarkerInfo );
52
+ }
53
+ }
54
+ }
50
55
51
- if (gotoRelatedItems .isEmpty ()) {
56
+ @ Nullable
57
+ public LineMarkerInfo <?> collect (@ NotNull PsiElement psiElement , Method method ) {
58
+ if (!method .getAccess ().isPublic ()) {
52
59
return null ;
53
60
}
54
61
55
- // only one item dont need popover
56
- if (gotoRelatedItems .size () == 1 ) {
62
+ List <GotoRelatedItem > gotoRelatedItems = getGotoRelatedItems (method );
63
+ if (gotoRelatedItems .isEmpty ()) {
64
+ return null ;
65
+ }
57
66
67
+ // only one item don't need popover
68
+ if (gotoRelatedItems .size () == 1 ) {
58
69
GotoRelatedItem gotoRelatedItem = gotoRelatedItems .get (0 );
59
70
60
71
// hell: find any possible small icon
61
72
Icon icon = null ;
62
- if (gotoRelatedItem instanceof RelatedPopupGotoLineMarker .PopupGotoRelatedItem ) {
73
+ if (gotoRelatedItem instanceof RelatedPopupGotoLineMarker .PopupGotoRelatedItem ) {
63
74
icon = ((RelatedPopupGotoLineMarker .PopupGotoRelatedItem ) gotoRelatedItem ).getSmallIcon ();
64
75
}
65
76
66
- if (icon == null ) {
77
+ if (icon == null ) {
67
78
icon = Symfony2Icons .SYMFONY_LINE_MARKER ;
68
79
}
69
80
70
81
NavigationGutterIconBuilder <PsiElement > builder = NavigationGutterIconBuilder .create (icon ).
71
82
setTargets (gotoRelatedItems .get (0 ).getElement ());
72
83
73
84
String customName = gotoRelatedItems .get (0 ).getCustomName ();
74
- if (customName != null ) {
85
+ if (customName != null ) {
75
86
builder .setTooltipText (customName );
76
87
}
77
88
@@ -90,27 +101,12 @@ public LineMarkerInfo<?> collect(PsiElement psiElement) {
90
101
}
91
102
92
103
public static List <GotoRelatedItem > getGotoRelatedItems (Method method ) {
93
-
94
104
List <GotoRelatedItem > gotoRelatedItems = new ArrayList <>();
95
-
96
105
ControllerActionGotoRelatedCollectorParameter parameter = new ControllerActionGotoRelatedCollectorParameter (method , gotoRelatedItems );
97
- for (ControllerActionGotoRelatedCollector extension : EP_NAME .getExtensions ()) {
106
+ for (ControllerActionGotoRelatedCollector extension : EP_NAME .getExtensions ()) {
98
107
extension .collectGotoRelatedItems (parameter );
99
108
}
100
109
101
110
return gotoRelatedItems ;
102
111
}
103
-
104
- @ Override
105
- public void collectSlowLineMarkers (@ NotNull List <? extends PsiElement > psiElements , @ NotNull Collection <? super LineMarkerInfo <?>> results ) {
106
-
107
- for (PsiElement psiElement : psiElements ) {
108
- LineMarkerInfo <?> lineMarkerInfo = collect (psiElement );
109
- if (lineMarkerInfo != null ) {
110
- results .add (lineMarkerInfo );
111
- }
112
- }
113
-
114
- }
115
-
116
112
}
0 commit comments