Java 类com.intellij.psi.impl.cache.impl.todo.TodoIndexers 实例源码

项目:intellij-ce-playground    文件:PlatformIdTableBuilding.java   
@Nullable
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType, final VirtualFile virtualFile) {
  final DataIndexer<TodoIndexEntry, Integer, FileContent> indexer = ourTodoIndexers.get(fileType);

  if (indexer != null) {
    return indexer;
  }

  final DataIndexer<TodoIndexEntry, Integer, FileContent> extIndexer;
  if (fileType instanceof SubstitutedFileType && !((SubstitutedFileType)fileType).isSameFileType()) {
    SubstitutedFileType sft = (SubstitutedFileType)fileType;
    extIndexer =
      new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), virtualFile), getTodoIndexer(sft.getFileType(), virtualFile));
  }
  else {
    extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
  }
  if (extIndexer != null) {
    return extIndexer;
  }

  if (fileType instanceof LanguageFileType) {
    final Language lang = ((LanguageFileType)fileType).getLanguage();
    final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
    final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens() : null;
    if (commentTokens != null) {
      return new TokenSetTodoIndexer(commentTokens, virtualFile);
    }
  }

  if (fileType instanceof CustomSyntaxTableFileType) {
    return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, virtualFile);
  }

  return null;
}
项目:intellij-ce-playground    文件:XmlCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(HtmlFileType.INSTANCE, "html;htm;sht;shtm;shtml");
  appEnvironment.registerFileType(XHtmlFileType.INSTANCE, "xhtml");
  appEnvironment.registerFileType(DTDFileType.INSTANCE, "dtd;ent;mod;elt");

  appEnvironment.registerFileType(XmlFileType.INSTANCE, "xml;xsd;tld;xsl;jnlp;wsdl;jhm;ant;xul;xslt;rng;fxml");

  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XMLLanguage.INSTANCE, new XmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(DTDLanguage.INSTANCE, new DtdSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(HTMLLanguage.INSTANCE, new HtmlSyntaxHighlighterFactory());
  SyntaxHighlighterFactory.LANGUAGE_FACTORY.addExplicitExtension(XHTMLLanguage.INSTANCE, new XhtmlSyntaxHighlighterFactory());

  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XMLLanguage.INSTANCE, new XMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, DTDLanguage.INSTANCE, new DTDParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, HTMLLanguage.INSTANCE, new HTMLParserDefinition());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, XHTMLLanguage.INSTANCE, new XHTMLParserDefinition());

  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlIdIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XmlFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, DTDFileType.INSTANCE, new XmlTodoIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, XHtmlFileType.INSTANCE, new XHtmlTodoIndexer());

  appEnvironment.addExtension(MetaDataContributor.EP_NAME, new XmlApplicationComponent());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlNamespaceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new SchemaTypeInheritanceIndex());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlTagNamesIndex());
  appEnvironment.addExtension(StandardResourceProvider.EP_NAME, new InternalResourceProvider());

  appEnvironment.registerApplicationComponent(PathMacros.class, new PathMacrosImpl());
  appEnvironment.registerApplicationService(ExternalResourceManager.class, new ExternalResourceManagerExImpl());
  appEnvironment.registerApplicationService(XmlFoldingSettings.class, new XmlFoldingSettings());
  Language[] myLanguages = new Language[]{XMLLanguage.INSTANCE, HTMLLanguage.INSTANCE, XHTMLLanguage.INSTANCE, DTDLanguage.INSTANCE};
  for (Language myLanguage : myLanguages) {
    appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, myLanguage, new XmlFoldingBuilder());
    appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, myLanguage, new XmlFindUsagesProvider());
    appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, myLanguage, new XmlASTFactory());
  }
}
项目:intellij-ce-playground    文件:PropertiesCoreEnvironment.java   
public ApplicationEnvironment(CoreApplicationEnvironment appEnvironment) {
  appEnvironment.registerFileType(PropertiesFileType.INSTANCE, "properties");
  appEnvironment.addExplicitExtension(SyntaxHighlighterFactory.LANGUAGE_FACTORY, PropertiesLanguage.INSTANCE,
                                      new PropertiesSyntaxHighlighterFactory());
  appEnvironment.addExplicitExtension(LanguageParserDefinitions.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesParserDefinition());
  appEnvironment.addExtension(FileBasedIndexExtension.EXTENSION_POINT_NAME, new XmlPropertiesIndex());
  appEnvironment.addExtension(StubIndexExtension.EP_NAME, new PropertyKeyIndex());

  appEnvironment.registerApplicationService(PropertiesQuickFixFactory.class, new EmptyPropertiesQuickFixFactory());
  appEnvironment.registerApplicationService(PropertiesRefactoringSettings.class, new PropertiesRefactoringSettings());
  appEnvironment.addExplicitExtension(LanguageAnnotators.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesAnnotator());
  appEnvironment.addExplicitExtension(LanguageFindUsages.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFindUsagesProvider());

  appEnvironment.addExplicitExtension(LanguageASTFactory.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesASTFactory());
  appEnvironment.addExplicitExtension(LanguageFolding.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesFoldingBuilder());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyImpl.class, new PropertyManipulator());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyKeyImpl.class, new PropertyKeyManipulator());
  appEnvironment.addExplicitExtension(ElementManipulators.INSTANCE, PropertyValueImpl.class, new PropertyValueManipulator());

  final StubElementTypeHolderEP stubElementTypeHolderBean = new StubElementTypeHolderEP();
  stubElementTypeHolderBean.holderClass = PropertiesElementTypes.class.getName();
  appEnvironment.addExtension(StubElementTypeHolderEP.EP_NAME, stubElementTypeHolderBean);

  appEnvironment.addExplicitExtension(LanguageCommenters.INSTANCE, PropertiesLanguage.INSTANCE, new PropertiesCommenter());
  appEnvironment.addExplicitExtension(IdIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesIdIndexer());
  appEnvironment.addExplicitExtension(TodoIndexers.INSTANCE, PropertiesFileType.INSTANCE, new PropertiesTodoIndexer());

  appEnvironment.addExtension(IconProvider.EXTENSION_POINT_NAME, new XmlPropertiesIconProvider());
}
项目:tools-idea    文件:PlatformIdTableBuilding.java   
@Nullable
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType, final VirtualFile virtualFile) {
  final DataIndexer<TodoIndexEntry, Integer, FileContent> indexer = ourTodoIndexers.get(fileType);

  if (indexer != null) {
    return indexer;
  }

  final DataIndexer<TodoIndexEntry, Integer, FileContent> extIndexer;
  if (fileType instanceof SubstitutedFileType) {
    SubstitutedFileType sft = (SubstitutedFileType)fileType;
    extIndexer =
      new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), virtualFile), getTodoIndexer(sft.getFileType(), virtualFile));
  }
  else {
    extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
  }
  if (extIndexer != null) {
    return extIndexer;
  }

  if (fileType instanceof LanguageFileType) {
    final Language lang = ((LanguageFileType)fileType).getLanguage();
    final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
    final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens() : null;
    if (commentTokens != null) {
      return new TokenSetTodoIndexer(commentTokens, virtualFile);
    }
  }

  if (fileType instanceof CustomSyntaxTableFileType) {
    return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, virtualFile);
  }

  return null;
}
项目:consulo    文件:PlatformIdTableBuilding.java   
@javax.annotation.Nullable
public static DataIndexer<TodoIndexEntry, Integer, FileContent> getTodoIndexer(FileType fileType, Project project, final VirtualFile virtualFile) {
  final DataIndexer<TodoIndexEntry, Integer, FileContent> extIndexer;
  if (fileType instanceof SubstitutedFileType && !((SubstitutedFileType)fileType).isSameFileType()) {
    SubstitutedFileType sft = (SubstitutedFileType)fileType;
    extIndexer = new CompositeTodoIndexer(getTodoIndexer(sft.getOriginalFileType(), project, virtualFile), getTodoIndexer(sft.getFileType(), project, virtualFile));
  }
  else {
    extIndexer = TodoIndexers.INSTANCE.forFileType(fileType);
  }
  if (extIndexer != null) {
    return extIndexer;
  }

  if (fileType instanceof LanguageFileType) {
    final Language lang = ((LanguageFileType)fileType).getLanguage();
    final ParserDefinition parserDef = LanguageParserDefinitions.INSTANCE.forLanguage(lang);
    LanguageVersion languageVersion = LanguageVersionUtil.findLanguageVersion(lang, project, virtualFile);
    final TokenSet commentTokens = parserDef != null ? parserDef.getCommentTokens(languageVersion) : null;
    if (commentTokens != null) {
      return new TokenSetTodoIndexer(commentTokens, languageVersion, virtualFile, project);
    }
  }

  if (fileType instanceof CustomSyntaxTableFileType) {
    return new TokenSetTodoIndexer(ABSTRACT_FILE_COMMENT_TOKENS, null, virtualFile, project);
  }

  return null;
}
项目:intellij-ce-playground    文件:PlatformIdTableBuilding.java   
public static boolean isTodoIndexerRegistered(@NotNull FileType fileType) {
  return ourTodoIndexers.containsKey(fileType) || TodoIndexers.INSTANCE.forFileType(fileType) != null || fileType instanceof InternalFileType;
}
项目:tools-idea    文件:PlatformIdTableBuilding.java   
public static boolean isTodoIndexerRegistered(FileType fileType) {
  return ourTodoIndexers.containsKey(fileType) || TodoIndexers.INSTANCE.forFileType(fileType) != null;
}
项目:consulo    文件:PlatformIdTableBuilding.java   
public static boolean isTodoIndexerRegistered(@Nonnull FileType fileType) {
  return TodoIndexers.INSTANCE.forFileType(fileType) != null;
}