@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext) {
    int offset = editor.getCaretModel().getOffset();
    editor.getScrollingModel().scrollToCaret(ScrollType.MAKE_VISIBLE);
    PsiElement element = file.findElementAt(offset);

    while (true) {
      if (element == null || element instanceof PsiFile) {
        String message = RefactoringBundle
          .getCannotRefactorMessage(RefactoringBundle.message("the.caret.should.be.positioned.inside.a.class.to.pull.members.from"));
        CommonRefactoringUtil.showErrorHint(project, editor, message, getRefactoringName(), HelpID.MEMBERS_PULL_UP);
        return;
      }


      if (!CommonRefactoringUtil.checkReadOnlyStatus(project, element)) return;


      if (element instanceof GrTypeDefinition || element instanceof GrField || element instanceof GrMethod) {
        invoke(project, new PsiElement[]{element}, dataContext);
        return;
      }

      element = element.getParent();
    }
  }
@Override
  public void invoke(@NotNull Project project, Editor editor, PsiFile file, DataContext dataContext)