|
17 | 17 | import consulo.language.psi.PsiElementVisitor; |
18 | 18 | import consulo.language.psi.PsiFile; |
19 | 19 | import consulo.language.psi.PsiLanguageInjectionHost; |
| 20 | +import consulo.localize.LocalizeValue; |
20 | 21 | import consulo.xml.codeInspection.XmlSuppressableInspectionTool; |
21 | 22 | import consulo.xml.psi.xml.XmlAttributeValue; |
22 | | -import org.jetbrains.annotations.Nls; |
23 | | - |
24 | 23 | import jakarta.annotation.Nonnull; |
25 | 24 | import jakarta.annotation.Nullable; |
| 25 | + |
26 | 26 | import java.util.List; |
27 | 27 |
|
28 | 28 | /** |
29 | 29 | * @author peter |
30 | 30 | */ |
31 | 31 | public abstract class AbstractAopInspection extends XmlSuppressableInspectionTool { |
32 | | - public boolean isEnabledByDefault() { |
33 | | - return true; |
34 | | - } |
| 32 | + public boolean isEnabledByDefault() { |
| 33 | + return true; |
| 34 | + } |
35 | 35 |
|
36 | | - @Nonnull |
37 | | - @Override |
38 | | - public HighlightDisplayLevel getDefaultLevel() { |
39 | | - return HighlightDisplayLevel.WARNING; |
40 | | - } |
| 36 | + @Nonnull |
| 37 | + @Override |
| 38 | + public HighlightDisplayLevel getDefaultLevel() { |
| 39 | + return HighlightDisplayLevel.WARNING; |
| 40 | + } |
41 | 41 |
|
42 | | - @Nullable |
43 | | - @Override |
44 | | - public Language getLanguage() { |
45 | | - return AopPointcutExpressionLanguage.getInstance(); |
46 | | - } |
| 42 | + @Nullable |
| 43 | + @Override |
| 44 | + public Language getLanguage() { |
| 45 | + return AopPointcutExpressionLanguage.getInstance(); |
| 46 | + } |
47 | 47 |
|
48 | | - @Nonnull |
49 | | - public PsiElementVisitor buildVisitor(@Nonnull final ProblemsHolder holder, final boolean isOnTheFly) { |
50 | | - return new PsiElementVisitor() { |
51 | | - @Override public void visitElement(final PsiElement element) { |
52 | | - if (element instanceof PsiLiteralExpression || element instanceof XmlAttributeValue) { |
53 | | - checkElement(element, holder); |
54 | | - } |
55 | | - } |
56 | | - }; |
57 | | - } |
| 48 | + @Nonnull |
| 49 | + public PsiElementVisitor buildVisitor(@Nonnull final ProblemsHolder holder, final boolean isOnTheFly) { |
| 50 | + return new PsiElementVisitor() { |
| 51 | + @Override |
| 52 | + public void visitElement(final PsiElement element) { |
| 53 | + if (element instanceof PsiLiteralExpression || element instanceof XmlAttributeValue) { |
| 54 | + checkElement(element, holder); |
| 55 | + } |
| 56 | + } |
| 57 | + }; |
| 58 | + } |
58 | 59 |
|
59 | | - protected void checkElement(final PsiElement element, final ProblemsHolder holder) { |
60 | | - InjectedLanguageManager.getInstance(element.getProject()).enumerate(element, new PsiLanguageInjectionHost.InjectedPsiVisitor() { |
61 | | - public void visit(@Nonnull PsiFile file, @Nonnull List<PsiLanguageInjectionHost.Shred> places) { |
62 | | - if (file instanceof AopPointcutExpressionFile && file.getContext() == element) { |
63 | | - final AopPointcutExpressionFile aopFile = (AopPointcutExpressionFile)file; |
64 | | - final LocalAopModel model = aopFile.getAopModel(); |
65 | | - final PsiMethod method = model.getPointcutMethod(); |
66 | | - if (method != null) { |
67 | | - checkAopMethod(method, model, holder, aopFile); |
68 | | - } |
69 | | - } |
70 | | - } |
71 | | - }); |
72 | | - } |
| 60 | + protected void checkElement(final PsiElement element, final ProblemsHolder holder) { |
| 61 | + InjectedLanguageManager.getInstance(element.getProject()).enumerate(element, new PsiLanguageInjectionHost.InjectedPsiVisitor() { |
| 62 | + public void visit(@Nonnull PsiFile file, @Nonnull List<PsiLanguageInjectionHost.Shred> places) { |
| 63 | + if (file instanceof AopPointcutExpressionFile && file.getContext() == element) { |
| 64 | + final AopPointcutExpressionFile aopFile = (AopPointcutExpressionFile) file; |
| 65 | + final LocalAopModel model = aopFile.getAopModel(); |
| 66 | + final PsiMethod method = model.getPointcutMethod(); |
| 67 | + if (method != null) { |
| 68 | + checkAopMethod(method, model, holder, aopFile); |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + }); |
| 73 | + } |
73 | 74 |
|
74 | | - protected abstract void checkAopMethod(final PsiMethod pointcutMethod, final LocalAopModel model, final ProblemsHolder holder, |
75 | | - final AopPointcutExpressionFile aopFile); |
| 75 | + protected abstract void checkAopMethod( |
| 76 | + final PsiMethod pointcutMethod, final LocalAopModel model, final ProblemsHolder holder, |
| 77 | + final AopPointcutExpressionFile aopFile |
| 78 | + ); |
76 | 79 |
|
77 | | - @Nls |
78 | | - @Nonnull |
79 | | - public String getGroupDisplayName() { |
80 | | - return ""; |
81 | | - } |
| 80 | + @Nonnull |
| 81 | + @Override |
| 82 | + public LocalizeValue getGroupDisplayName() { |
| 83 | + return LocalizeValue.empty(); |
| 84 | + } |
82 | 85 | } |
0 commit comments