@Override
  public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file) {
    final PsiElement element = PsiUtilBase.getElementAtCaret(editor);
    final PsiClass psiClass = PsiTreeUtil.getParentOfType(element, PsiClass.class);
    if (psiClass == null) return;

    final PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
    String annotation = "";
    if (PsiUtil.isAvailable(JavaFeature.ANNOTATIONS, file)) {
      annotation = "@SuppressWarnings({\"MethodOverridesStaticMethodOfSuperclass\", \"UnusedDeclaration\"})";
    }
    final PsiMethod createUI = factory.createMethodFromText(annotation +
                                                            "\npublic static javax.swing.plaf.ComponentUI createUI(javax.swing.JComponent c) {" +
                                                        "\n  return new " + psiClass.getName() + "();\n}", psiClass);
    final PsiMethod newMethod = (PsiMethod)psiClass.add(CodeStyleManager.getInstance(project).reformat(createUI));
    JavaCodeStyleManager.getInstance(project).shortenClassReferences(newMethod);
    final PsiReturnStatement returnStatement = PsiTreeUtil.findChildOfType(newMethod, PsiReturnStatement.class);
    if (returnStatement != null) {
      final int offset = returnStatement.getTextRange().getEndOffset();
      editor.getCaretModel().moveToOffset(offset - 2);
    }
  }
@Override
  public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file)