IRV: IDEA-80843 removal entries removes more than you expect

This commit is contained in:
anna
2012-02-06 10:59:50 +01:00
parent f6954b8f78
commit cea1d3ab71
2 changed files with 21 additions and 2 deletions
@@ -187,6 +187,14 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
getIgnoredElements().put(refEntity, problemDescriptors);
}
public void ignoreCurrentElementProblem(RefEntity refEntity, CommonProblemDescriptor descriptor) {
CommonProblemDescriptor[] descriptors = getIgnoredElements().get(refEntity);
if (descriptors == null) {
descriptors = new CommonProblemDescriptor[0];
}
getIgnoredElements().put(refEntity, ArrayUtil.append(descriptors, descriptor));
}
private static boolean isIgnoreProblem(QuickFix[] problemFixes, Set<QuickFix> fixes, int idx){
if (problemFixes == null || fixes == null) {
return true;
@@ -451,6 +459,17 @@ public abstract class DescriptorProviderInspection extends InspectionTool implem
return false;
}
public boolean isProblemResolved(RefEntity refEntity, CommonProblemDescriptor descriptor) {
if (getIgnoredElements() == null) return false;
for (RefEntity entity : getIgnoredElements().keySet()) {
if (Comparing.equal(entity, refEntity)) {
final CommonProblemDescriptor[] descriptors = getIgnoredElements().get(refEntity);
return ArrayUtil.contains(descriptor, descriptors);
}
}
return false;
}
public FileStatus getProblemStatus(final CommonProblemDescriptor descriptor) {
final GlobalInspectionContextImpl context = getContext();
if (context != null && context.getUIOptions().SHOW_DIFF_WITH_PREVIOUS_RUN){
@@ -95,11 +95,11 @@ public class ProblemDescriptionNode extends InspectionTreeNode {
public boolean isResolved() {
return myElement instanceof RefElement && myTool.isElementIgnored(myElement);
return myElement instanceof RefElement && myTool.isProblemResolved(myElement, getDescriptor());
}
public void ignoreElement() {
myTool.ignoreCurrentElement(getElement());
myTool.ignoreCurrentElementProblem(getElement(), getDescriptor());
}
public void amnesty() {