This commit is contained in:
Alexey Kudravtsev
2014-10-09 13:39:20 +04:00
parent e0b200c5ac
commit 3f172e9ecd
7 changed files with 22 additions and 11 deletions
@@ -37,8 +37,9 @@ public class SuppressManagerImpl extends SuppressManager {
return SuppressIntentionActionFromFix.convertBatchToSuppressIntentionActions(batchSuppressActions);
}
@NotNull
@Override
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, String toolShortName) {
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, @NotNull String toolShortName) {
return createBatchSuppressActions(HighlightDisplayKey.find(toolShortName));
}
@@ -28,5 +28,6 @@ public interface InspectionSuppressor {
/**
* @see com.intellij.codeInspection.BatchSuppressableTool#getBatchSuppressActions(com.intellij.psi.PsiElement)
*/
SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, String toolShortName);
@NotNull
SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, @NotNull String toolShortName);
}
@@ -17,7 +17,10 @@
package org.jetbrains.plugins.groovy.codeInspection;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.BatchSuppressManager;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.SuppressQuickFix;
import com.intellij.codeInspection.SuppressionUtil;
import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.text.StringUtil;
@@ -45,7 +48,8 @@ import java.util.regex.Matcher;
* @author peter
*/
public abstract class GroovySuppressableInspectionTool extends LocalInspectionTool {
public static SuppressQuickFix[] getSuppressActions(String name) {
@NotNull
public static SuppressQuickFix[] getSuppressActions(@NotNull String name) {
final HighlightDisplayKey displayKey = HighlightDisplayKey.find(name);
return new SuppressQuickFix[] {
new SuppressByGroovyCommentFix(displayKey),
@@ -27,8 +27,9 @@ public class GroovyInspectionSuppressor implements InspectionSuppressor {
return GroovySuppressableInspectionTool.getElementToolSuppressedIn(element, name) != null;
}
@NotNull
@Override
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, String toolShortName) {
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, @NotNull String toolShortName) {
return GroovySuppressableInspectionTool.getSuppressActions(toolShortName);
}
}
@@ -25,8 +25,9 @@ public class XmlInspectionSuppressor implements InspectionSuppressor{
return XmlSuppressionProvider.isSuppressed(element, toolId);
}
@NotNull
@Override
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, String toolShortName) {
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, @NotNull String toolShortName) {
return XmlSuppressableInspectionTool.getSuppressFixes(toolShortName);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,16 +28,18 @@ import org.jetbrains.annotations.NotNull;
public abstract class XmlSuppressableInspectionTool extends LocalInspectionTool implements BatchSuppressableTool {
@NonNls static final String ALL = "ALL";
public static SuppressQuickFix[] getSuppressFixes(final String shortName) {
@NotNull
public static SuppressQuickFix[] getSuppressFixes(@NotNull String shortName) {
return getSuppressFixes(shortName, new DefaultXmlSuppressionProvider());
}
public static SuppressQuickFix[] getSuppressFixes(final String shortName, XmlSuppressionProvider provider) {
@NotNull
public static SuppressQuickFix[] getSuppressFixes(@NotNull String shortName, @NotNull XmlSuppressionProvider provider) {
final String id = HighlightDisplayKey.find(shortName).getID();
return new SuppressQuickFix[]{new SuppressTagStatic(id, provider), new SuppressForFile(id, provider), new SuppressAllForFile(provider)};
}
public static abstract class XmlSuppressFix implements SuppressQuickFix {
public abstract static class XmlSuppressFix implements SuppressQuickFix {
protected final String myId;
protected final XmlSuppressionProvider myProvider;
@@ -47,8 +47,9 @@ public abstract class XmlSuppressionProvider implements InspectionSuppressor {
public abstract void suppressForTag(@NotNull PsiElement element, @NotNull String inspectionId);
@NotNull
@Override
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, String toolShortName) {
public SuppressQuickFix[] getSuppressActions(@Nullable PsiElement element, @NotNull String toolShortName) {
return XmlSuppressableInspectionTool.getSuppressFixes(toolShortName, this);
}