|
1 | 1 | package com.intellij.plugins.thrift.editor;
|
2 | 2 |
|
3 |
| -import com.intellij.codeHighlighting.Pass; |
4 | 3 | import com.intellij.codeInsight.daemon.DaemonBundle;
|
5 |
| -import com.intellij.codeInsight.daemon.GutterIconNavigationHandler; |
6 | 4 | import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
7 | 5 | import com.intellij.codeInsight.daemon.LineMarkerProvider;
|
8 | 6 | import com.intellij.codeInsight.daemon.impl.PsiElementListNavigator;
|
|
13 | 11 | import com.intellij.plugins.thrift.util.ThriftPsiUtil;
|
14 | 12 | import com.intellij.psi.NavigatablePsiElement;
|
15 | 13 | import com.intellij.psi.PsiElement;
|
16 |
| -import com.intellij.util.Function; |
17 | 14 | import org.jetbrains.annotations.NotNull;
|
18 | 15 | import org.jetbrains.annotations.Nullable;
|
19 | 16 |
|
20 |
| -import java.awt.event.MouseEvent; |
21 | 17 | import java.util.List;
|
22 | 18 |
|
23 | 19 | /**
|
|
26 | 22 | public class ThriftLineMarkerProvider implements LineMarkerProvider {
|
27 | 23 | @Nullable
|
28 | 24 | @Override
|
29 |
| - public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element) { |
| 25 | + public LineMarkerInfo<PsiElement> getLineMarkerInfo(@NotNull PsiElement element) { |
30 | 26 | if (element instanceof ThriftDefinitionName) {
|
31 | 27 | return findImplementationsAndCreateMarker((ThriftDefinitionName)element);
|
32 | 28 | }
|
33 | 29 | return null;
|
34 | 30 | }
|
35 | 31 |
|
36 | 32 | @Nullable
|
37 |
| - private LineMarkerInfo findImplementationsAndCreateMarker(final ThriftDefinitionName definitionName) { |
| 33 | + private LineMarkerInfo<PsiElement> findImplementationsAndCreateMarker(final ThriftDefinitionName definitionName) { |
38 | 34 | final List<NavigatablePsiElement> implementations = ThriftPsiUtil.findImplementations(definitionName);
|
39 | 35 | if (implementations.isEmpty()) {
|
40 | 36 | return null;
|
41 | 37 | }
|
42 |
| - return new LineMarkerInfo<PsiElement>( |
| 38 | + return new LineMarkerInfo<>( |
43 | 39 | definitionName,
|
44 | 40 | definitionName.getTextRange(),
|
45 | 41 | AllIcons.Gutter.ImplementedMethod,
|
46 |
| - Pass.UPDATE_ALL, |
47 |
| - new Function<PsiElement, String>() { |
48 |
| - @Override |
49 |
| - public String fun(PsiElement element) { |
50 |
| - return DaemonBundle.message("interface.is.implemented.too.many"); |
51 |
| - } |
52 |
| - }, |
53 |
| - new GutterIconNavigationHandler<PsiElement>() { |
54 |
| - @Override |
55 |
| - public void navigate(MouseEvent e, PsiElement elt) { |
56 |
| - PsiElementListNavigator.openTargets( |
57 |
| - e, |
58 |
| - implementations.toArray(new NavigatablePsiElement[implementations.size()]), |
59 |
| - DaemonBundle.message("navigation.title.implementation.method", definitionName.getText(), implementations.size()), |
60 |
| - "Implementations of " + definitionName.getText(), |
61 |
| - new DefaultPsiElementCellRenderer() |
62 |
| - ); |
63 |
| - } |
64 |
| - }, |
65 |
| - GutterIconRenderer.Alignment.RIGHT |
| 42 | + element -> DaemonBundle.message("interface.is.implemented.too.many"), |
| 43 | + (e, elt) -> PsiElementListNavigator.openTargets( |
| 44 | + e, |
| 45 | + implementations.toArray(new NavigatablePsiElement[0]), |
| 46 | + DaemonBundle.message("navigation.title.implementation.method", definitionName.getText(), implementations.size()), |
| 47 | + "Implementations of " + definitionName.getText(), |
| 48 | + new DefaultPsiElementCellRenderer() |
| 49 | + ), |
| 50 | + GutterIconRenderer.Alignment.RIGHT, |
| 51 | + () -> DaemonBundle.message("interface.is.implemented.too.many") |
66 | 52 | );
|
67 | 53 | }
|
68 | 54 | }
|
0 commit comments