private void addStatementKeywords() {
    if (psiElement()
      .withText("}")
      .withParent(psiElement(PsiCodeBlock.class).withParent(or(psiElement(PsiTryStatement.class), psiElement(PsiCatchSection.class))))
      .accepts(myPrevLeaf)) {
      addKeyword(new OverridableSpace(createKeyword(PsiKeyword.CATCH), JavaTailTypes.CATCH_LPARENTH));
      addKeyword(new OverridableSpace(createKeyword(PsiKeyword.FINALLY), JavaTailTypes.FINALLY_LBRACE));
      List<LookupElement> elements = CatchLookupElement.create(myPrevLeaf);
      for (LookupElement element : elements) {
        addKeyword(element);
      }
      if (myPrevLeaf.getParent().getNextSibling() instanceof PsiErrorElement) {
        return;
      }
    }

    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.SWITCH), JavaTailTypes.SWITCH_LPARENTH));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.WHILE), JavaTailTypes.WHILE_LPARENTH));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.DO), JavaTailTypes.DO_LBRACE));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.FOR), JavaTailTypes.FOR_LPARENTH));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.IF), JavaTailTypes.IF_LPARENTH));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.TRY), JavaTailTypes.TRY_LBRACE));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.THROW), TailTypes.insertSpaceType()));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.NEW), TailTypes.insertSpaceType()));
    addKeyword(new OverridableSpace(createKeyword(PsiKeyword.SYNCHRONIZED), JavaTailTypes.SYNCHRONIZED_LPARENTH));

    if (PsiUtil.isAvailable(JavaFeature.ASSERTIONS, myPosition)) {
      addKeyword(new OverridableSpace(createKeyword(PsiKeyword.ASSERT), TailTypes.insertSpaceType()));
    }

    if (!psiElement().inside(PsiSwitchExpression.class).accepts(myPosition) ||
        psiElement().inside(PsiLambdaExpression.class).accepts(myPosition)) {
      addKeyword(createReturnKeyword());
    }

    if (psiElement().withText(";").withSuperParent(2, PsiIfStatement.class).accepts(myPrevLeaf) ||
        psiElement().withText("}").withSuperParent(3, PsiIfStatement.class).accepts(myPrevLeaf)) {
      LookupElement elseKeyword = new OverridableSpace(createKeyword(PsiKeyword.ELSE), TailTypes.humbleSpaceBeforeWordType());
      CharSequence text = myParameters.getEditor().getDocument().getCharsSequence();
      int offset = myParameters.getOffset();
      while (text.length() > offset && Character.isWhitespace(text.charAt(offset))) {
        offset++;
      }
      if (text.length() > offset + PsiKeyword.ELSE.length() &&
          text.subSequence(offset, offset + PsiKeyword.ELSE.length()).toString().equals(PsiKeyword.ELSE) &&
          Character.isWhitespace(text.charAt(offset + PsiKeyword.ELSE.length()))) {
        elseKeyword = PrioritizedLookupElement.withPriority(elseKeyword, -1);
      }
      addKeyword(elseKeyword);
    }
  }
private void addStatementKeywords()