From 12e0efe212191ba75ed7d5063424c5209143653b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Wawrzyk?= <lwawrzyk@virtuslab.com>
Date: Mon, 3 Aug 2020 13:04:23 +0200
Subject: [PATCH] Revert file type registration change (#91)

---
 .../plugins/thrift/ThriftFileTypeLoader.java      | 15 +++++++++++++++
 thrift/src/main/resources/META-INF/plugin.xml     |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 thrift/src/main/java/com/intellij/plugins/thrift/ThriftFileTypeLoader.java

diff --git a/thrift/src/main/java/com/intellij/plugins/thrift/ThriftFileTypeLoader.java b/thrift/src/main/java/com/intellij/plugins/thrift/ThriftFileTypeLoader.java
new file mode 100644
index 00000000..6a766acb
--- /dev/null
+++ b/thrift/src/main/java/com/intellij/plugins/thrift/ThriftFileTypeLoader.java
@@ -0,0 +1,15 @@
+package com.intellij.plugins.thrift;
+
+import com.intellij.openapi.fileTypes.FileTypeConsumer;
+import com.intellij.openapi.fileTypes.FileTypeFactory;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Created by fkorotkov.
+ */
+public class ThriftFileTypeLoader extends FileTypeFactory {
+  @Override
+  public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
+    fileTypeConsumer.consume(ThriftFileType.INSTANCE);
+  }
+}
diff --git a/thrift/src/main/resources/META-INF/plugin.xml b/thrift/src/main/resources/META-INF/plugin.xml
index 4c0d9126..48f43b88 100644
--- a/thrift/src/main/resources/META-INF/plugin.xml
+++ b/thrift/src/main/resources/META-INF/plugin.xml
@@ -122,7 +122,7 @@
     <!-- Add your application components here -->
   </application-components>
   <extensions defaultExtensionNs="com.intellij">
-    <fileType name="Thrift" extensions="thrift" language="thrift" implementationClass="com.intellij.plugins.thrift.ThriftFileType"/>
+    <fileTypeFactory implementation="com.intellij.plugins.thrift.ThriftFileTypeLoader"/>
     <lang.parserDefinition language="thrift" implementationClass="com.intellij.plugins.thrift.lang.parser.ThriftParserDefinition"/>
     <completion.contributor language="any" implementationClass="com.intellij.plugins.thrift.completion.ThriftKeywordCompletionContributor"/>
     <itemPresentationProvider forClass="com.intellij.plugins.thrift.lang.psi.ThriftTopLevelDeclaration"