void (@NotNull Project project, @NotNull ProblemDescriptor desc) { final PsiClass clazz = PsiTreeUtil.getParentOfType(desc.getPsiElement(), PsiClass.class); if (clazz == null) { return; // no class to fix } GenerateToStringActionHandler handler = ApplicationManager.getApplication().getService(GenerateToStringActionHandler.class); handler.executeActionQuickFix(project, clazz); }