@Override
  public boolean checkAvailable(@NotNull Editor editor, @NotNull PsiFile file, @NotNull MoveInfo info, boolean down) {
    if (!(file instanceof PsiJavaFile)) return false;
    if (!super.checkAvailable(editor, file, info, down)) return false;

    final Document document = editor.getDocument();
    int startOffset = document.getLineStartOffset(info.toMove.startLine);
    int endOffset = getLineStartSafeOffset(document, info.toMove.endLine);
    List<PsiSwitchLabelStatement> statements = new SmartList<>();
    PsiElement firstElement = null;
    for (PsiElement element : CodeInsightUtil.findStatementsInRange(file, startOffset, endOffset)) {
      if (element instanceof PsiSwitchLabelStatement) {
        statements.add((PsiSwitchLabelStatement)element);
      }
      else if (statements.isEmpty()) {
        firstElement = element;
      }
    }
    if (statements.isEmpty()) return false;
    if (firstElement != null) return info.prohibitMove(); // nonsensical selection

    PsiSwitchLabelStatement firstToMove = getThisCaseBlockStart(statements.get(0));
    PsiSwitchLabelStatement lastStatement = statements.get(statements.size() - 1);
    PsiElement nextCaseBlockStart = getNextCaseBlockStart(lastStatement);
    PsiElement lastToMove = PsiTreeUtil.skipWhitespacesBackward(nextCaseBlockStart);
    assert lastToMove != null;

    LineRange range = createRange(document, firstToMove, lastToMove);
    if (range == null) return info.prohibitMove();
    info.toMove = range;

    PsiElement firstToMove2;
    PsiElement lastToMove2;
    if (down) {
      if (!(nextCaseBlockStart instanceof PsiSwitchLabelStatement) || nextCaseBlockStart == lastStatement) return info.prohibitMove();
      firstToMove2 = nextCaseBlockStart;
      nextCaseBlockStart = getNextCaseBlockStart((PsiSwitchLabelStatement)firstToMove2);
      lastToMove2 = PsiTreeUtil.skipWhitespacesBackward(nextCaseBlockStart);
      assert lastToMove2 != null;
    }
    else {
      lastToMove2 = PsiTreeUtil.skipWhitespacesBackward(firstToMove);
      if (lastToMove2 == null) return info.prohibitMove();
      firstToMove2 = PsiTreeUtil.getPrevSiblingOfType(lastToMove2, PsiSwitchLabelStatement.class);
      if (firstToMove2 == null) return info.prohibitMove();
      firstToMove2 = getThisCaseBlockStart((PsiSwitchLabelStatement)firstToMove2);
    }
    LineRange range2 = createRange(document, firstToMove2, lastToMove2);
    if (range2 == null) return info.prohibitMove();
    info.toMove2 = range2;
    return true;
  }
@Override
  public boolean checkAvailable(@NotNull Editor editor, @NotNull PsiFile file, @NotNull MoveInfo info, boolean down)