private boolean invokeImpl(final Project project, final GrIntroduceContext context, final Editor editor) {
    try {
      if (!CommonRefactoringUtil.checkReadOnlyStatus(project, context.getOccurrences())) {
        return false;
      }
      checkOccurrences(context.getOccurrences());


      if (isInplace(context.getEditor(), context.getPlace())) {
        Map<OccurrencesChooser.ReplaceChoice, List<Object>> occurrencesMap = getOccurrenceOptions(context);
        new IntroduceOccurrencesChooser(editor).showChooser(occurrencesMap,choice->
                    getIntroducer(context, choice).startInplaceIntroduceTemplate());
      }
      else {
        final Settings settings = showDialog(context);
        if (settings == null) return false;

        CommandProcessor.getInstance().executeCommand(context.getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> {
          runRefactoring(context, settings);
        }), getRefactoringName(), null);
      }

      return true;
    }
    catch (GrRefactoringError e) {
      CommonRefactoringUtil.showErrorHint(project, editor, RefactoringBundle.getCannotRefactorMessage(e.getMessage()), getRefactoringName(), getHelpID());
      return false;
    }
  }
private boolean invokeImpl(final Project project, final GrIntroduceContext context, final Editor editor)