void (IntroduceOperation operation, PsiElement statement) { if (statement instanceof PyAssignmentStatement) { PyTargetExpression target = (PyTargetExpression) ((PyAssignmentStatement)statement).getTargets() [0]; final List<PsiElement> occurrences = operation.getOccurrences(); final PsiElement occurrence = findOccurrenceUnderCaret(occurrences, operation.getEditor()); PsiElement elementForCaret = occurrence != null ? occurrence : target; operation.getEditor().getCaretModel().moveToOffset(elementForCaret.getTextRange().getStartOffset()); final InplaceVariableIntroducer<PsiElement> introducer = new PyInplaceVariableIntroducer(target, operation, occurrences); introducer.performInplaceRefactoring(new LinkedHashSet<>(operation.getSuggestedNames())); } }