@Override
  protected boolean buildTemplateAndStart(final @NotNull Collection<PsiReference> refs,
                                          @NotNull Collection<Pair<PsiElement, TextRange>> stringUsages,
                                          final @NotNull PsiElement scope,
                                          final @NotNull PsiFile containingFile) {
    PsiFile fileCopy = (PsiFile)containingFile.copy();
    try {
      myElementInCopy = PsiTreeUtil.findSameElementInCopy(myElementToRename, fileCopy);
    }
    catch (IllegalStateException | UnsupportedOperationException e) {
      // Unsupported synthetic element?
      myElementInCopy = null;
    }
    if (appendAdditionalElement(refs, stringUsages)) {
      return super.buildTemplateAndStart(refs, stringUsages, scope, containingFile);
    }
    else {
      final RenameChooser renameChooser = new RenameChooser(myEditor) {
        @Override
        protected void runRenameTemplate(Collection<Pair<PsiElement, TextRange>> stringUsages) {
          if (!VariableInplaceRenamer.super.buildTemplateAndStart(refs, stringUsages, scope, containingFile)) {
            VariableInplaceRenameHandler.performDialogRename(myElementToRename,
                                                             myEditor,
                                                             DataManager.getInstance().getDataContext(myEditor.getContentComponent()),
                                                             myInitialName);
          }
        }
      };
      renameChooser.showChooser(refs, stringUsages);
    }
    return true;
  }
@Override
  protected boolean buildTemplateAndStart(final @NotNull Collection<PsiReference> refs,
                                          @NotNull Collection<Pair<PsiElement, TextRange>> stringUsages,
                                          final @NotNull PsiElement scope,
                                          final @NotNull PsiFile containingFile)