mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
unused declaration: show nodes with error suffix if error severity is chosen IDEA-177356
This commit is contained in:
+2
-11
@@ -127,7 +127,7 @@ public class DefaultInspectionToolPresentation implements InspectionToolPresenta
|
||||
@Nullable
|
||||
@Override
|
||||
public HighlightSeverity getSeverity(@NotNull RefElement element) {
|
||||
final PsiElement psiElement = element.getPointer().getContainingFile();
|
||||
final PsiElement psiElement = ((RefElement)element.getRefManager().getRefinedElement(element)).getPointer().getContainingFile();
|
||||
if (psiElement != null) {
|
||||
final GlobalInspectionContextImpl context = getContext();
|
||||
final String shortName = getSeverityDelegateName();
|
||||
@@ -405,16 +405,7 @@ public class DefaultInspectionToolPresentation implements InspectionToolPresenta
|
||||
@NonNls Element problemClassElement = new Element(InspectionsBundle.message("inspection.export.results.problem.element.tag"));
|
||||
problemClassElement.addContent(myToolWrapper.getDisplayName());
|
||||
|
||||
final HighlightSeverity severity;
|
||||
if (refEntity instanceof RefElement){
|
||||
final RefElement refElement = (RefElement)refEntity;
|
||||
severity = getSeverity(refElement);
|
||||
}
|
||||
else {
|
||||
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(getContext().getProject()).getCurrentProfile();
|
||||
final HighlightDisplayLevel level = profile.getErrorLevel(HighlightDisplayKey.find(myToolWrapper.getShortName()), psiElement);
|
||||
severity = level.getSeverity();
|
||||
}
|
||||
final HighlightSeverity severity = InspectionToolPresentation.getSeverity(refEntity, psiElement, this);
|
||||
|
||||
if (severity != null) {
|
||||
ProblemHighlightType problemHighlightType = descriptor instanceof ProblemDescriptor
|
||||
|
||||
@@ -15,8 +15,11 @@
|
||||
*/
|
||||
package com.intellij.codeInspection.ui;
|
||||
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.codeInspection.CommonProblemDescriptor;
|
||||
import com.intellij.codeInspection.InspectionProfile;
|
||||
import com.intellij.codeInspection.ProblemDescriptionsProcessor;
|
||||
import com.intellij.codeInspection.ex.*;
|
||||
import com.intellij.codeInspection.reference.RefElement;
|
||||
@@ -24,6 +27,8 @@ import com.intellij.codeInspection.reference.RefEntity;
|
||||
import com.intellij.codeInspection.reference.RefModule;
|
||||
import com.intellij.codeInspection.ui.util.SynchronizedBidiMultiMap;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -136,4 +141,21 @@ public interface InspectionToolPresentation extends ProblemDescriptionsProcessor
|
||||
void amnesty(@NotNull CommonProblemDescriptor descriptor);
|
||||
|
||||
void exclude(@NotNull CommonProblemDescriptor descriptor);
|
||||
|
||||
static HighlightSeverity getSeverity(@Nullable RefEntity entity,
|
||||
@Nullable PsiElement psiElement,
|
||||
@NotNull InspectionToolPresentation presentation) {
|
||||
HighlightSeverity severity;
|
||||
if (entity instanceof RefElement){
|
||||
final RefElement refElement = (RefElement)entity;
|
||||
severity = presentation.getSeverity(refElement);
|
||||
}
|
||||
else {
|
||||
final InspectionProfile profile = InspectionProjectProfileManager.getInstance(presentation.getContext().getProject()).getCurrentProfile();
|
||||
final HighlightDisplayLevel
|
||||
level = profile.getErrorLevel(HighlightDisplayKey.find(presentation.getToolWrapper().getShortName()), psiElement);
|
||||
severity = level.getSeverity();
|
||||
}
|
||||
return severity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.codeInspection.InspectionsBundle;
|
||||
import com.intellij.codeInspection.reference.RefDirectory;
|
||||
import com.intellij.codeInspection.reference.RefElement;
|
||||
import com.intellij.codeInspection.reference.RefEntity;
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
import gnu.trove.TObjectIntHashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -141,7 +142,11 @@ public class RefElementNode extends SuppressableInspectionTreeNode {
|
||||
@Override
|
||||
protected void visitProblemSeverities(TObjectIntHashMap<HighlightDisplayLevel> counter) {
|
||||
if (!isExcluded() && isLeaf() && !getPresentation().isProblemResolved(getElement()) && !getPresentation().isSuppressed(getElement())) {
|
||||
counter.put(HighlightDisplayLevel.WARNING, counter.get(HighlightDisplayLevel.WARNING) + 1);
|
||||
HighlightSeverity severity = InspectionToolPresentation.getSeverity(getElement(), null, getPresentation());
|
||||
HighlightDisplayLevel level = HighlightDisplayLevel.find(severity);
|
||||
if (!counter.adjustValue(level, 1)) {
|
||||
counter.put(level, 1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.visitProblemSeverities(counter);
|
||||
|
||||
Reference in New Issue
Block a user