mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't highlight new Insets() if it's passed as a parameter to () -> JBInsets function
This commit is contained in:
@@ -52,6 +52,16 @@ public class UseDPIAwareInsetsInspection extends InternalInspection {
|
||||
final PsiType type = expression.getType();
|
||||
final PsiExpressionList arguments = expression.getArgumentList();
|
||||
if (type != null && arguments != null && type.equalsToText("java.awt.Insets")) {
|
||||
if (expression.getParent() instanceof PsiExpressionList) {
|
||||
PsiElement parent = expression.getParent();
|
||||
PsiElement superParent = parent.getParent();
|
||||
if (superParent instanceof PsiMethodCallExpression) {
|
||||
PsiType methodType = ((PsiMethodCallExpression)superParent).getType();
|
||||
if (methodType != null && methodType.equalsToText(JBInsets.class.getName())) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
final JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
|
||||
final PsiClass jbuiClass = facade.findClass(JBUI.class.getName(), GlobalSearchScope.allScope(project));
|
||||
if (jbuiClass != null && facade.getResolveHelper().isAccessible(jbuiClass, expression, jbuiClass)) {
|
||||
|
||||
Reference in New Issue
Block a user