void (@NotNull ActionContext context, @NotNull PsiCaseLabelElementList list, @NotNull ModPsiUpdater updater) { PsiCaseLabelElement[] elements = list.getElements(); if (elements.length != 1 || !(elements[0] instanceof PsiDefaultCaseLabelElement)) { return; } PsiElement parent = list.getParent(); if (!(parent instanceof PsiSwitchLabelStatementBase caseLabels)) { return; } String dummyText; CommentTracker tracker = new CommentTracker(); if (parent instanceof PsiSwitchLabeledRuleStatement ruleStatement) { dummyText = "default -> " + (ruleStatement.getBody() != null ? ruleStatement.getBody().getText() : ""); tracker.markUnchanged(ruleStatement.getBody()); } else { dummyText = "default:" ; } PsiStatement dummy = JavaPsiFacade.getElementFactory(context.project()).createStatementFromText(dummyText, list); PsiElement replaced = tracker.replace(caseLabels, dummy); tracker.insertCommentsBefore(replaced); }