mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
tooltips for INFORMATION level: default change to 'no' (IDEA-181493)
initially one who wanted to provide some fixes without highlighting should created ProblemDescriptor manually and disable tooltip explicitly; looks like it's too tedious to teach all inspection authors to do so and all existing usages were similar: disable if INFORMATION. Let's apply as default
This commit is contained in:
+2
-5
@@ -93,11 +93,8 @@ public class AnonymousCanBeLambdaInspection extends AbstractBaseJavaLocalInspect
|
||||
type = ProblemHighlightType.INFORMATION;
|
||||
}
|
||||
}
|
||||
ProblemDescriptorBase descriptor = new ProblemDescriptorBase(parent, parent, "Anonymous #ref #loc can be replaced with lambda",
|
||||
new LocalQuickFix[]{new ReplaceWithLambdaFix()},
|
||||
type, false, rangeInElement,
|
||||
type != ProblemHighlightType.INFORMATION, true);
|
||||
holder.registerProblem(descriptor);
|
||||
holder.registerProblem(parent, "Anonymous #ref #loc can be replaced with lambda",
|
||||
type, rangeInElement, new ReplaceWithLambdaFix());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+3
-6
@@ -88,12 +88,9 @@ public class AnonymousCanBeMethodReferenceInspection extends AbstractBaseJavaLoc
|
||||
ProblemHighlightType type = methodReferenceCandidate.mySafeQualifier && methodReferenceCandidate.myConformsCodeStyle
|
||||
? ProblemHighlightType.LIKE_UNUSED_SYMBOL
|
||||
: ProblemHighlightType.INFORMATION;
|
||||
ProblemDescriptorBase descriptor = new ProblemDescriptorBase(parent, parent,
|
||||
"Anonymous #ref #loc can be replaced with method reference",
|
||||
new LocalQuickFix[]{new ReplaceWithMethodRefFix()},
|
||||
type, false, rangeInElement,
|
||||
type != ProblemHighlightType.INFORMATION, true);
|
||||
holder.registerProblem(descriptor);
|
||||
holder.registerProblem(parent,
|
||||
"Anonymous #ref #loc can be replaced with method reference",
|
||||
type, rangeInElement, new ReplaceWithMethodRefFix());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,9 @@ public class OptionalIsPresentInspection extends AbstractBaseJavaLocalInspection
|
||||
|
||||
void registerProblem(ProblemsHolder holder, PsiExpression condition, OptionalIsPresentCase scenario) {
|
||||
if(this != NONE) {
|
||||
holder.registerProblem(holder.getManager().createProblemDescriptor(condition,
|
||||
"Can be replaced with single expression in functional style",
|
||||
this != INFO,
|
||||
this == INFO ? ProblemHighlightType.INFORMATION : ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
true,
|
||||
new OptionalIsPresentFix(scenario)));
|
||||
holder.registerProblem(condition, "Can be replaced with single expression in functional style",
|
||||
this == INFO ? ProblemHighlightType.INFORMATION : ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
new OptionalIsPresentFix(scenario));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -100,8 +100,8 @@ public class Java8MapForEachInspection extends AbstractBaseJavaLocalInspectionTo
|
||||
else {
|
||||
range = new TextRange(0, firstChild.getTextLength());
|
||||
}
|
||||
holder.registerProblem(new ProblemDescriptorBase(firstChild, firstChild, InspectionsBundle.message("inspection.map.foreach.message"),
|
||||
new LocalQuickFix[]{new ReplaceWithMapForEachFix()}, type, false, range, type != ProblemHighlightType.INFORMATION, holder.isOnTheFly()));
|
||||
holder.registerProblem(loop.getFirstChild(), InspectionsBundle.message("inspection.map.foreach.message"),
|
||||
type, range, new ReplaceWithMapForEachFix());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ public abstract class InspectionManagerBase extends InspectionManager {
|
||||
@NotNull ProblemHighlightType highlightType,
|
||||
boolean onTheFly,
|
||||
boolean isAfterEndOfLine) {
|
||||
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, isAfterEndOfLine, null, true, onTheFly);
|
||||
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, isAfterEndOfLine, null, highlightType != ProblemHighlightType.INFORMATION, onTheFly);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,7 +91,7 @@ public abstract class InspectionManagerBase extends InspectionManager {
|
||||
@NotNull ProblemHighlightType highlightType,
|
||||
boolean onTheFly,
|
||||
LocalQuickFix... fixes) {
|
||||
return new ProblemDescriptorBase(startElement, endElement, descriptionTemplate, fixes, highlightType, false, null, true, onTheFly);
|
||||
return new ProblemDescriptorBase(startElement, endElement, descriptionTemplate, fixes, highlightType, false, null, highlightType != ProblemHighlightType.INFORMATION, onTheFly);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -102,7 +102,7 @@ public abstract class InspectionManagerBase extends InspectionManager {
|
||||
@NotNull final ProblemHighlightType highlightType,
|
||||
boolean onTheFly,
|
||||
final LocalQuickFix... fixes) {
|
||||
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, false, rangeInElement, true, onTheFly);
|
||||
return new ProblemDescriptorBase(psiElement, psiElement, descriptionTemplate, fixes, highlightType, false, rangeInElement, highlightType != ProblemHighlightType.INFORMATION, onTheFly);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user