From 0815eab3a5b8fc91a59606faf5da26b4eeba8cec Mon Sep 17 00:00:00 2001 From: Michael Nedzelsky Date: Mon, 6 Apr 2015 10:16:23 +0300 Subject: [PATCH] add KotlinJavaScriptMetaFileType --- .../KotlinJavaScriptMetaFileType.kt | 38 +++++++++++++++++++ idea/src/META-INF/plugin.xml | 7 ++++ .../KotlinJavaScriptMetaFileTypeFactory.kt | 27 +++++++++++++ 3 files changed, 72 insertions(+) create mode 100644 idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KotlinJavaScriptMetaFileType.kt create mode 100644 idea/src/org/jetbrains/kotlin/idea/KotlinJavaScriptMetaFileTypeFactory.kt diff --git a/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KotlinJavaScriptMetaFileType.kt b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KotlinJavaScriptMetaFileType.kt new file mode 100644 index 00000000000..7b975c27772 --- /dev/null +++ b/idea/idea-analysis/src/org/jetbrains/kotlin/idea/decompiler/KotlinJavaScriptMetaFileType.kt @@ -0,0 +1,38 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea.decompiler + +import com.intellij.openapi.fileTypes.FileType +import com.intellij.openapi.vfs.VirtualFile +import org.jetbrains.kotlin.serialization.js.KotlinJavascriptSerializationUtil + +public object KotlinJavaScriptMetaFileType : FileType { + + override fun getName() = "KJSM" + + override fun getDescription() = "Kotlin JavaScript meta file" + + override fun getDefaultExtension() = KotlinJavascriptSerializationUtil.CLASS_METADATA_FILE_EXTENSION + + override fun getIcon() = null + + override fun isBinary() = true + + override fun isReadOnly() = true + + override fun getCharset(file: VirtualFile, content: ByteArray) = null +} \ No newline at end of file diff --git a/idea/src/META-INF/plugin.xml b/idea/src/META-INF/plugin.xml index 530e8dd6f46..b353d30624e 100644 --- a/idea/src/META-INF/plugin.xml +++ b/idea/src/META-INF/plugin.xml @@ -231,6 +231,7 @@ + @@ -1004,6 +1005,12 @@ + + + + + + diff --git a/idea/src/org/jetbrains/kotlin/idea/KotlinJavaScriptMetaFileTypeFactory.kt b/idea/src/org/jetbrains/kotlin/idea/KotlinJavaScriptMetaFileTypeFactory.kt new file mode 100644 index 00000000000..c8a2cacbac8 --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/KotlinJavaScriptMetaFileTypeFactory.kt @@ -0,0 +1,27 @@ +/* + * Copyright 2010-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jetbrains.kotlin.idea + +import com.intellij.openapi.fileTypes.FileTypeConsumer +import com.intellij.openapi.fileTypes.FileTypeFactory +import org.jetbrains.kotlin.idea.decompiler.KotlinJavaScriptMetaFileType + +public class KotlinJavaScriptMetaFileTypeFactory : FileTypeFactory() { + override fun createFileTypes(consumer: FileTypeConsumer) { + consumer.consume(KotlinJavaScriptMetaFileType, KotlinJavaScriptMetaFileType.getDefaultExtension()) + } +}