@Override
  public void invoke(final @NotNull Project project, Editor editor, final PsiFile file) throws IncorrectOperationException {
    PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
    final PsiClass psiClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);

    LOG.assertTrue(psiClass != null);
    if (shouldCreateInnerClass(psiClass)) {
      if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
      createInnerClass(psiClass);
      return;
    }
    if (PsiUtil.isLocalClass(psiClass)) {
      if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
      createLocalClass(psiClass);
      return;
    }
    if (ScratchUtil.isScratch(PsiUtilCore.getVirtualFile(psiClass))) {
      createSameFileClass(suggestTargetClassName(psiClass), psiClass);
      return;
    }
    createTopLevelClass(psiClass);
  }
@Override
  public void invoke(final @NotNull Project project, Editor editor, final PsiFile file)