@Override
  @Nullable
  protected PsiFile createFile(@NotNull final Language lang) {
    if (lang == getTemplateDataLanguage()) {

      final PsiFileImpl file =
          (PsiFileImpl)
              LanguageParserDefinitions.INSTANCE.forLanguage(StdLanguages.HTML).createFile(this);
      file.setContentElementType(EmbeddedPerlTokens.HTML_TEMPLATE_DATA);
      return file;
    }

    if (lang == getBaseLanguage()) {
      return LanguageParserDefinitions.INSTANCE.forLanguage(lang).createFile(this);
    }
    return null;
  }
Esempio n. 2
0
 protected void init(
     @NotNull final IElementType elementType, final IElementType contentElementType) {
   myElementType = elementType;
   setContentElementType(contentElementType);
 }