void (@NotNull ActionContext context, @NotNull PsiCaseLabelElement element, @NotNull ModPsiUpdater updater) { PsiCaseLabelElement labelElement = updater.getWritable(myLabelElementPointer.getElement()); if (labelElement == null) return; PsiSwitchLabelStatementBase moveBeforeLabel = PsiImplUtil.getSwitchLabel(element); PsiSwitchLabelStatementBase labelStatement = PsiImplUtil.getSwitchLabel(labelElement); if (moveBeforeLabel == null || labelStatement == null) return; PsiCodeBlock scope = ObjectUtils.tryCast(moveBeforeLabel.getParent(), PsiCodeBlock.class); if (scope == null) return; PsiSwitchLabelStatementBase nextLabel = PsiTreeUtil.getNextSiblingOfType(labelStatement, PsiSwitchLabelStatementBase.class); PsiElement afterLast = nextLabel == null ? scope.getRBrace() : nextLabel; if (afterLast == null) return; PsiElement last = afterLast.getPrevSibling(); scope.addRangeBefore(labelStatement, last, moveBeforeLabel); scope.deleteChildRange(labelStatement, last); }