Example usage for com.intellij.openapi.fileTypes FileTypeConsumer FileTypeConsumer

List of usage examples for com.intellij.openapi.fileTypes FileTypeConsumer FileTypeConsumer

Introduction

In this page you can find the example usage for com.intellij.openapi.fileTypes FileTypeConsumer FileTypeConsumer.

Prototype

FileTypeConsumer

Source Link

Usage

From source file:org.intellij.images.fileTypes.impl.ImageFileTypeManagerImpl.java

License:Apache License

@Inject
public ImageFileTypeManagerImpl() {
    FileTypeConsumer consumer = new FileTypeConsumer() {
        @Override/*from   ww  w  .j av  a2 s . co m*/
        public void consume(@Nonnull FileType fileType) {
            consume(fileType, fileType.getDefaultExtension());
        }

        @Override
        public void consume(@Nonnull FileType fileType, @NonNls String extensions) {
            myFileTypes.put(fileType, extensions);
        }

        @Override
        public void consume(@Nonnull FileType fileType, FileNameMatcher... matchers) {
            throw new UnsupportedOperationException();
        }

        @Nullable
        @Override
        public FileType getStandardFileTypeByName(@Nonnull @NonNls String name) {
            throw new UnsupportedOperationException();
        }
    };

    ImageIO.scanForPlugins();
    for (ImageFileTypeProvider provider : ImageFileTypeProvider.EP_NAME.getExtensionList()) {
        provider.register(consumer);
    }
}