PsiFile (@NotNull final Language lang) { ParserDefinition def = LanguageParserDefinitions.INSTANCE.forLanguage(lang); if (def == null) return null; if (lang == getTemplateDataLanguage()) { PsiFileImpl file = (PsiFileImpl)def.createFile(this); file.setContentElementType(RestPythonElementTypes.PYTHON_BLOCK_DATA); return file; } else if (lang.getID().equals("DjangoTemplate")) { PsiFileImpl file = (PsiFileImpl)def.createFile(this); file.setContentElementType(RestPythonElementTypes.DJANGO_BLOCK_DATA); return file; } else if (lang == RestLanguage.INSTANCE) { return def.createFile(this); } return null; }