mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
invert boolean: disable for foreach params (IDEA-151634)
This commit is contained in:
+14
-5
@@ -66,13 +66,22 @@ public class JavaInvertBooleanDelegate extends InvertBooleanDelegate {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var instanceof PsiParameter && ((PsiParameter)var).getDeclarationScope() instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)((PsiParameter)var).getDeclarationScope();
|
||||
final PsiMethod superMethod = SuperMethodWarningUtil.checkSuperMethod(method, RefactoringBundle.message("to.refactor"));
|
||||
if (superMethod == null) {
|
||||
if (var instanceof PsiParameter) {
|
||||
final PsiElement declarationScope = ((PsiParameter)var).getDeclarationScope();
|
||||
if (declarationScope instanceof PsiMethod) {
|
||||
final PsiMethod method = (PsiMethod)declarationScope;
|
||||
final PsiMethod superMethod = SuperMethodWarningUtil.checkSuperMethod(method, RefactoringBundle.message("to.refactor"));
|
||||
if (superMethod == null) {
|
||||
return null;
|
||||
}
|
||||
var = superMethod.getParameterList().getParameters()[method.getParameterList().getParameterIndex((PsiParameter)var)];
|
||||
}
|
||||
else if (declarationScope instanceof PsiForeachStatement) {
|
||||
CommonRefactoringUtil.showErrorHint(project, editor,
|
||||
RefactoringBundle.message("invert.boolean.foreach"),
|
||||
InvertBooleanHandler.REFACTORING_NAME, InvertBooleanHandler.INVERT_BOOLEAN_HELP_ID);
|
||||
return null;
|
||||
}
|
||||
var = superMethod.getParameterList().getParameters()[method.getParameterList().getParameterIndex((PsiParameter)var)];
|
||||
}
|
||||
return var;
|
||||
}
|
||||
|
||||
@@ -713,6 +713,7 @@ invert.boolean.elements.header={0} to invert
|
||||
please.enter.a.valid.name.for.inverted.element=Please enter a valid name for inverted {0}
|
||||
invert.boolean.name.of.inverted.element=&Name of inverted {0}:
|
||||
invert.0.1=Invert {0} {1} and its usages
|
||||
invert.boolean.foreach=Foreach parameter initializer can't be inverted
|
||||
0.is.a.part.of.method.hierarchy.do.you.want.to.delete.multiple.parameters={0} is a part of method hierarchy. Do you want to delete multiple parameters?
|
||||
0.is.a.part.of.method.hierarchy.do.you.want.to.delete.multiple.type.parameters={0} is a part of method hierarchy. Do you want to delete multiple type parameters?
|
||||
move.inner.class.to.be.moved=Class to be moved
|
||||
|
||||
Reference in New Issue
Block a user