private static void invokeOnElement(Project project, PsiElement element, Editor editor) {
    if (element instanceof PyLambdaExpression) {
      showCannotRefactorErrorHint(project, editor, PyBundle.message("refactoring.change.signature.error.lambda.call"));
      return;
    }
    if (!(element instanceof PyFunction function)) {
      showCannotRefactorErrorHint(project, editor, PyBundle.message("refactoring.change.signature.error.wrong.caret.position.method.name"));
      return;
    }

    if (PyPsiIndexUtil.isNotUnderSourceRoot(project, element.getContainingFile())) {
      showCannotRefactorErrorHint(project, editor, PyBundle.message("refactoring.change.signature.error.not.under.source.root"));
      return;
    }

    final PyFunction superMethod = getSuperMethod(function);
    if (superMethod == null) {
      return;
    }
    if (!superMethod.equals(element)) {
      element = superMethod;
      if (PyPsiIndexUtil.isNotUnderSourceRoot(project, superMethod.getContainingFile())) {
        return;
      }
    }

    final PyParameter[] parameters = function.getParameterList().getParameters();
    for (PyParameter p : parameters) {
      if (p instanceof PyTupleParameter) {
        showCannotRefactorErrorHint(project, editor, PyBundle.message("refactoring.change.signature.error.tuple.parameters"));
        return;
      }
    }

    final PyMethodDescriptor method = new PyMethodDescriptor((PyFunction)element);
    final PyChangeSignatureDialog dialog = new PyChangeSignatureDialog(project, method);
    dialog.show();
  }
private static void invokeOnElement(Project project, PsiElement element, Editor editor)