LocalQuickFix (Object... infos) { PsiSwitchLabelStatementBase lbl = (PsiSwitchLabelStatementBase)infos[0]; if (lbl instanceof PsiSwitchLabelStatement) { PsiElement lastDefaultStmt = PsiTreeUtil.skipWhitespacesAndCommentsBackward(PsiTreeUtil.getNextSiblingOfType(lbl, PsiSwitchLabelStatementBase.class)); if (!(lastDefaultStmt instanceof PsiBreakStatement || lastDefaultStmt instanceof PsiYieldStatement)) { return null; } PsiSwitchLabelStatementBase prevLbl = PsiTreeUtil.getPrevSiblingOfType(lbl, PsiSwitchLabelStatementBase.class); if (prevLbl != null) { PsiElement prevStat = PsiTreeUtil.skipWhitespacesAndCommentsBackward(lbl); if (!(prevStat instanceof PsiBreakStatement || prevStat instanceof PsiYieldStatement)) { return null; } } } return LocalQuickFix.from(new MakeDefaultLastCaseFix(lbl)); }