Document (CharSequence text, @Nullable TemplateContext context, Project project) { if (context != null) { for (TemplateContextType type : TemplateManagerImpl.getAllContextTypes()) { if (context.isEnabled(type)) { return type.createDocument(text, project); } } } return EditorFactory.getInstance().createDocument(text); }