void (@NotNull ActionContext context, @NotNull ModPsiUpdater updater) { context = context.withFile(updater.getWritable(context.file())); PsiElement element = context.findLeaf(); if (element == null) return; PsiSwitchLabelStatementBase statement = findLabelStatement(context, element); PsiElement result = null; if (statement instanceof PsiSwitchLabelStatement labelStatement) { PsiCaseLabelElementList labelElementList = labelStatement.getCaseLabelElementList(); if (labelElementList != null && labelElementList.getElementCount() > 1) { PsiCaseLabelElement labelElement = findLabelElement(element, labelElementList, context); Branch branch = Branch.fromLabel(labelStatement); if (branch != null) { if (isInList(labelElement, labelElementList)) { result = moveLabelElementAfter(labelStatement, labelElement); } else { result = splitLabelValues(labelStatement); } } } else { PsiSwitchLabelStatement lastSiblingLabel = findLastSiblingLabel(labelStatement, true); if (lastSiblingLabel != null) { result = moveLabelAfter(labelStatement, lastSiblingLabel); } else { PsiStatement previousSibling = getPrevSiblingOfType(statement, PsiStatement.class); if (previousSibling instanceof PsiSwitchLabelStatement previousLabelStatement) { result = copyLabelTo(labelStatement, previousLabelStatement); } } } } else if (statement instanceof PsiSwitchLabeledRuleStatement labeledRule) { PsiCaseLabelElementList labelElementList = labeledRule.getCaseLabelElementList(); if (labelElementList != null) { PsiCaseLabelElement labelElement = findLabelElement(element, labelElementList, context); if (isInList(labelElement, labelElementList)) { result = moveRuleAfter(labelElement, labeledRule); } else { result = splitRule(labelElementList, labeledRule); } } } if (result != null) { updater.moveTo(result); } }