void (@NotNull Project project, @NotNull PsiElement element, @NotNull ModPsiUpdater updater) { PsiCatchSection catchSection = ObjectUtils.tryCast(element.getParent(), PsiCatchSection.class); if (catchSection == null) return; PsiParameter parameter = catchSection.getParameter(); if (parameter == null) return; String parameterName = parameter.getName(); FileTemplate template = FileTemplateManager.getInstance(project).getCodeTemplate(JavaTemplateUtil.TEMPLATE_CATCH_BODY); Properties props = FileTemplateManager.getInstance(project).getDefaultProperties(); props.setProperty(FileTemplate.ATTRIBUTE_EXCEPTION, parameterName); props.setProperty(FileTemplate.ATTRIBUTE_EXCEPTION_TYPE, parameter.getType().getCanonicalText()); PsiDirectory directory = catchSection.getContainingFile().getContainingDirectory(); if (directory != null) { JavaTemplateUtil.setPackageNameAttribute(props, directory); } try { PsiCodeBlock block = PsiElementFactory.getInstance(project).createCodeBlockFromText("{\n" + template.getText(props) + "\n}", null); Objects.requireNonNull(catchSection.getCatchBlock()).replace(block); } catch (ProcessCanceledException ce) { throw ce; } catch (Exception e) { throw new IncorrectOperationException("Incorrect file template", (Throwable)e); } }