From abec17168591847a9edea2bb1d93deb231312aaa Mon Sep 17 00:00:00 2001 From: Alexey Sedunov Date: Fri, 28 Sep 2018 18:49:00 +0300 Subject: [PATCH] Native: Register '.klib' extension through FileTypeFactory --- .../konan/KotlinNativeApplicationComponent.kt | 31 ------------------- .../ide/konan/KotlinNativeFileTypeFactory.kt | 17 ++++++++++ idea/src/META-INF/native.xml | 4 +-- 3 files changed, 18 insertions(+), 34 deletions(-) delete mode 100644 idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeApplicationComponent.kt create mode 100644 idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeFileTypeFactory.kt diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeApplicationComponent.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeApplicationComponent.kt deleted file mode 100644 index ad92fd7efed..00000000000 --- a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeApplicationComponent.kt +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license - * that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.ide.konan - -import com.intellij.ide.highlighter.ArchiveFileType -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.ApplicationComponent -import com.intellij.openapi.fileTypes.FileTypeManager -import org.jetbrains.kotlin.konan.library.KLIB_FILE_EXTENSION - -class KotlinNativeApplicationComponent : ApplicationComponent { - - override fun getComponentName(): String = "KotlinNativeApplicationComponent" - - override fun initComponent() { - ApplicationManager.getApplication().runWriteAction { - FileTypeManager.getInstance().associateExtension(ArchiveFileType.INSTANCE, KLIB_FILE_EXTENSION) - } - - // TODO: Move this to Kotlin/Native plugin for CLion and AppCode (see KT-26717): -// val extensionPoint = Extensions.getRootArea().getExtensionPoint(TipAndTrickBean.EP_NAME) -// for (name in arrayOf("Kotlin.html", "Kotlin_project.html", "Kotlin_mix.html", "Kotlin_Java_convert.html")) { -// TipAndTrickBean.findByFileName(name)?.let { -// extensionPoint.unregisterExtension(it) -// } -// } - } -} diff --git a/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeFileTypeFactory.kt b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeFileTypeFactory.kt new file mode 100644 index 00000000000..b9538b111a6 --- /dev/null +++ b/idea/idea-native/src/org/jetbrains/kotlin/ide/konan/KotlinNativeFileTypeFactory.kt @@ -0,0 +1,17 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.ide.konan + +import com.intellij.ide.highlighter.ArchiveFileType +import com.intellij.openapi.fileTypes.FileTypeConsumer +import com.intellij.openapi.fileTypes.FileTypeFactory +import org.jetbrains.kotlin.konan.library.KLIB_FILE_EXTENSION + +class KotlinNativeFileTypeFactory : FileTypeFactory() { + override fun createFileTypes(consumer: FileTypeConsumer) { + consumer.consume(ArchiveFileType.INSTANCE, KLIB_FILE_EXTENSION) + } +} \ No newline at end of file diff --git a/idea/src/META-INF/native.xml b/idea/src/META-INF/native.xml index 17287236692..accd1c17412 100644 --- a/idea/src/META-INF/native.xml +++ b/idea/src/META-INF/native.xml @@ -1,8 +1,5 @@ - - org.jetbrains.kotlin.ide.konan.KotlinNativeApplicationComponent - org.jetbrains.kotlin.ide.konan.decompiler.KotlinNativeLoadingMetadataCache @@ -16,6 +13,7 @@ +