Java 类com.intellij.openapi.fileTypes.FileTypeFactory 实例源码

项目:consulo    文件:PluginAdvertiserEditorNotificationProvider.java   
@RequiredReadAction
@Nullable
@Override
public EditorNotificationPanel createNotificationPanel(@Nonnull VirtualFile file, @Nonnull FileEditor fileEditor) {
  if (file.getFileType() != PlainTextFileType.INSTANCE && !(file.getFileType() instanceof AbstractFileType)) return null;

  final String extension = file.getExtension();
  if (extension == null) {
    return null;
  }

  if (myEnabledExtensions.contains(extension) || UnknownFeaturesCollector.getInstance(myProject).isIgnored(createFileFeatureForIgnoring(file))) return null;

  UnknownExtension fileFeatureForChecking = new UnknownExtension(FileTypeFactory.FILE_TYPE_FACTORY_EP.getName(), file.getName());

  List<IdeaPluginDescriptor> allPlugins = PluginsAdvertiserHolder.getLoadedPluginDescriptors();

  Set<IdeaPluginDescriptor> byFeature = PluginsAdvertiser.findByFeature(allPlugins, fileFeatureForChecking);
  if (!byFeature.isEmpty()) {
    return createPanel(file, byFeature, allPlugins);

  }
  return null;
}
项目:consulo    文件:PluginsAdvertiser.java   
private static boolean isMyFeature(String value, UnknownExtension feature) {
  if (feature.getExtensionKey().equals(FileTypeFactory.FILE_TYPE_FACTORY_EP.getName())) {
    FileNameMatcher matcher = FileNameMatcherFactory.getInstance().createMatcher(value);

    return matcher.accept(feature.getValue());
  }
  else {
    return value.equals(feature.getValue());
  }
}
项目:intellij-ce-playground    文件:PluginAdvertiserEditorNotificationProvider.java   
private static UnknownFeature createExtensionFeature(String extension) {
  return new UnknownFeature(FileTypeFactory.FILE_TYPE_FACTORY_EP.getName(), "File Type", extension);
}
项目:consulo    文件:PluginAdvertiserEditorNotificationProvider.java   
@Nonnull
private static UnknownExtension createFileFeatureForIgnoring(VirtualFile virtualFile) {
  return new UnknownExtension(FileTypeFactory.FILE_TYPE_FACTORY_EP.getName(), "*." + virtualFile.getExtension());
}