IDEA-120290 Deprecated methods in import popup.

This commit is contained in:
peter
2014-02-28 17:06:28 +01:00
parent 10ab0f9534
commit 3c4c1390fb
@@ -200,7 +200,7 @@ public class StaticImportMethodFix implements IntentionAction {
//do not show methods from default package
&& !((PsiJavaFile)file).getPackageName().isEmpty()
&& PsiUtil.isAccessible(file.getProject(), method, element, containingClass)) {
if (method.isDeprecated()) {
if (isEffectivelyDeprecated(method)) {
deprecated.put(containingClass, method);
return processCondition();
}
@@ -209,6 +209,20 @@ public class StaticImportMethodFix implements IntentionAction {
return processCondition();
}
private boolean isEffectivelyDeprecated(PsiMethod method) {
if (method.isDeprecated()) {
return true;
}
PsiClass aClass = method.getContainingClass();
while (aClass != null) {
if (aClass.isDeprecated()) {
return true;
}
aClass = aClass.getContainingClass();
}
return false;
}
private boolean processCondition() {
return (applicableList.isEmpty() ? list : applicableList).size() + deprecated.size() < 50;
}