void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiTryStatement tryStatement = PsiTreeUtil.getParentOfType(element, PsiTryStatement.class); if (tryStatement == null || tryStatement.getResourceList() != null || tryStatement.getParent() == null) { return; } PsiCodeBlock tryBlock = tryStatement.getTryBlock(); if (tryBlock == null) { return; } if (!(tryStatement.getParent() instanceof PsiCodeBlock)) { tryStatement = BlockUtils.expandSingleStatementToBlockStatement(tryStatement); tryBlock = Objects.requireNonNull(tryStatement.getTryBlock()); } final PsiElement first = tryBlock.getFirstBodyElement(); final PsiElement last = tryBlock.getLastBodyElement(); if (first != null && last != null) { tryStatement.getParent().addRangeAfter(first, last, tryStatement); } tryStatement.delete(); }