EA-86898 - assert: CaretImpl.lambda$doSetSelection$

open another editor if fix is invoked from method call
This commit is contained in:
Anna Kozlova
2016-09-01 16:38:42 +03:00
parent 50e1965c91
commit 2c10bed32b
2 changed files with 5 additions and 3 deletions
@@ -135,7 +135,7 @@ public class MethodReturnTypeFix extends LocalQuickFixAndIntentionActionOnPsiEle
}
if (statementToSelect != null) {
Editor editorForMethod = getEditorForMethod(myMethod, project, editor, statementToSelect.getContainingFile());
Editor editorForMethod = getEditorForMethod(myMethod, project, editor, file);
if (editorForMethod != null) {
selectReturnValueInEditor(statementToSelect, editorForMethod);
}
@@ -308,7 +308,9 @@ public class MethodReturnTypeFix extends LocalQuickFixAndIntentionActionOnPsiEle
}
static void selectReturnValueInEditor(final PsiReturnStatement returnStatement, final Editor editor) {
TextRange range = returnStatement.getReturnValue().getTextRange();
final PsiExpression returnValue = returnStatement.getReturnValue();
LOG.assertTrue(returnValue != null, returnStatement);
TextRange range = returnValue.getTextRange();
int offset = range.getStartOffset();
editor.getCaretModel().moveToOffset(offset);
@@ -119,7 +119,7 @@ make.vararg.parameter.last.family=Make vararg parameter last
make.vararg.parameter.last.text=Move ''{0}'' to the end of the list
fix.parameter.type.family=Fix Parameter Type
fix.parameter.type.text=Make ''{0}'' take parameter of type ''{1}'' here
fix.return.type.family=Fix Return Type
fix.return.type.family=Fix return type
fix.return.type.text=Make ''{0}'' return ''{1}''
fix.throws.list.family=Fix Throws List
fix.throws.list.add.exception=Add ''{0}'' to ''{1}'' throws list