mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 06:51:17 +07:00
cleanup, notnull
This commit is contained in:
@@ -27,11 +27,12 @@ package com.intellij.codeInspection.deadCode;
|
||||
import com.intellij.codeInspection.ex.InspectionTool;
|
||||
import com.intellij.codeInspection.reference.*;
|
||||
import com.intellij.codeInspection.util.RefFilter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class RefUnreachableFilter extends RefFilter {
|
||||
protected InspectionTool myTool;
|
||||
|
||||
public RefUnreachableFilter(final InspectionTool tool) {
|
||||
public RefUnreachableFilter(@NotNull InspectionTool tool) {
|
||||
myTool = tool;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,9 +26,10 @@ package com.intellij.codeInspection.deadCode;
|
||||
|
||||
import com.intellij.codeInspection.ex.InspectionTool;
|
||||
import com.intellij.codeInspection.reference.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class UnreferencedFilter extends RefUnreachableFilter {
|
||||
public UnreferencedFilter(final InspectionTool tool) {
|
||||
public UnreferencedFilter(@NotNull InspectionTool tool) {
|
||||
super(tool);
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -528,7 +528,7 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
|
||||
}
|
||||
|
||||
private static class WeakUnreferencedFilter extends UnreferencedFilter {
|
||||
private WeakUnreferencedFilter(final InspectionTool tool) {
|
||||
private WeakUnreferencedFilter(@NotNull InspectionTool tool) {
|
||||
super(tool);
|
||||
}
|
||||
|
||||
@@ -770,7 +770,8 @@ public class UnusedDeclarationInspection extends FilteringInspectionTool {
|
||||
if (descriptor instanceof ProblemDescriptor) {
|
||||
if (DELETE.equals(hint)) {
|
||||
return new PermanentDeleteFix(((ProblemDescriptor)descriptor).getPsiElement());
|
||||
} else if (COMMENT.equals(hint)) {
|
||||
}
|
||||
if (COMMENT.equals(hint)) {
|
||||
return new CommentOutFix(((ProblemDescriptor)descriptor).getPsiElement());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,45 +200,4 @@ public interface HighlightInfoType {
|
||||
return myToolKey;
|
||||
}
|
||||
}
|
||||
|
||||
class HighlightInfoTypeSeverityByKeyAttrBySeverity implements HighlightInfoType {
|
||||
static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.HighlightInfoType.HighlightInfoTypeSeverityByKeyAttrBySeverity");
|
||||
|
||||
private final HighlightDisplayKey mySeverityKey;
|
||||
|
||||
public HighlightInfoTypeSeverityByKeyAttrBySeverity(HighlightDisplayKey severityKey) {
|
||||
mySeverityKey = severityKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public HighlightSeverity getSeverity(final PsiElement psiElement) {
|
||||
InspectionProfile profile = psiElement == null
|
||||
? (InspectionProfile)InspectionProfileManager.getInstance().getRootProfile()
|
||||
: InspectionProjectProfileManager.getInstance(psiElement.getProject()).getInspectionProfile();
|
||||
HighlightDisplayLevel level = profile.getErrorLevel(mySeverityKey, psiElement);
|
||||
LOG.assertTrue(level != HighlightDisplayLevel.DO_NOT_SHOW);
|
||||
return level.getSeverity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextAttributesKey getAttributesKey() {
|
||||
final HighlightSeverity severity = getSeverity(null);
|
||||
final HighlightInfoTypeImpl infoType = SeverityRegistrar.getInstance().getHighlightInfoTypeBySeverity(severity);
|
||||
return infoType != null
|
||||
? infoType.getAttributesKey()
|
||||
: severity == HighlightSeverity.ERROR
|
||||
? CodeInsightColors.ERRORS_ATTRIBUTES
|
||||
: severity == HighlightSeverity.WARNING
|
||||
? CodeInsightColors.WARNINGS_ATTRIBUTES
|
||||
: severity == HighlightSeverity.WEAK_WARNING
|
||||
? CodeInsightColors.WEAK_WARNING_ATTRIBUTES
|
||||
: CodeInsightColors.INFO_ATTRIBUTES;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
public String toString() {
|
||||
return "HighlightInfoTypeSeverityByKeyAttrBySeverity[severity=" + mySeverityKey + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.intellij.openapi.util.JDOMExternalizableStringList;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProfileManagerImpl;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManagerImpl;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import gnu.trove.THashMap;
|
||||
@@ -151,20 +150,18 @@ public class SeverityRegistrar implements JDOMExternalizable, Comparator<Highlig
|
||||
ourMap.clear();
|
||||
ourRendererColors.clear();
|
||||
final List children = element.getChildren(INFO);
|
||||
if (children != null){
|
||||
for (Object child : children) {
|
||||
final Element infoElement = (Element)child;
|
||||
for (Object child : children) {
|
||||
final Element infoElement = (Element)child;
|
||||
|
||||
final SeverityBasedTextAttributes highlightInfo = new SeverityBasedTextAttributes();
|
||||
highlightInfo.readExternal(infoElement);
|
||||
final SeverityBasedTextAttributes highlightInfo = new SeverityBasedTextAttributes();
|
||||
highlightInfo.readExternal(infoElement);
|
||||
|
||||
Color color = null;
|
||||
final String colorStr = infoElement.getAttributeValue(COLOR);
|
||||
if (colorStr != null){
|
||||
color = new Color(Integer.parseInt(colorStr, 16));
|
||||
}
|
||||
registerSeverity(highlightInfo, color);
|
||||
Color color = null;
|
||||
final String colorStr = infoElement.getAttributeValue(COLOR);
|
||||
if (colorStr != null){
|
||||
color = new Color(Integer.parseInt(colorStr, 16));
|
||||
}
|
||||
registerSeverity(highlightInfo, color);
|
||||
}
|
||||
myOrder.clear();
|
||||
|
||||
|
||||
+1
-1
@@ -126,6 +126,7 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Collection<CommonProblemDescriptor> getProblemDescriptors() {
|
||||
return getProblemToElements().keySet();
|
||||
}
|
||||
@@ -143,7 +144,6 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
|
||||
|
||||
@Override
|
||||
public void ignoreElement(@NotNull final RefEntity refEntity) {
|
||||
if (refEntity == null) return;
|
||||
getProblemElements().remove(refEntity);
|
||||
getQuickFixActions().remove(refEntity);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.codeInspection.ex.InspectionTool;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ui.LayeredIcon;
|
||||
import com.intellij.util.IconUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Enumeration;
|
||||
@@ -44,6 +45,7 @@ public class InspectionNode extends InspectionTreeNode {
|
||||
return getTool().getDisplayName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public InspectionTool getTool() {
|
||||
return (InspectionTool)getUserObject();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user