void (@NotNull PsiElement element, @NotNull ActionContext context, @NotNull ModPsiUpdater updater) { if (!(element instanceof GrSwitchStatement)) return; final List<PsiEnumConstant> constants = findUnusedConstants((GrSwitchStatement)element); if (constants.isEmpty()) return; final PsiEnumConstant first = constants.get(0); final PsiClass aClass = first.getContainingClass(); if (aClass == null) return; String qName = aClass.getQualifiedName(); final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(context.project()); PsiElement anchor = findAnchor(element); for (PsiEnumConstant constant : constants) { final GrCaseSection section = factory.createSwitchSection("case " + qName + "." + constant.getName() + ":\n break"); final PsiElement added = element.addBefore(section, anchor); JavaCodeStyleManager.getInstance(context.project()).shortenClassReferences(added); } }