From 5951e7500a32b767e494d606b0cf8b131c0266a2 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Thu, 16 Jul 2020 13:02:02 +0200 Subject: [PATCH] Register KOTLIN_BUNDLED via application component in 193 #KTI-299 Fixed --- .../META-INF/plugin.xml.193 | 7 ++- .../idea/PluginStartupComponent.java.193 | 46 +++++++++++++++++++ .../kotlin/idea/PluginStartupListener.kt | 0 .../kotlin/idea/PluginStartupListener.kt.192 | 0 .../kotlin/idea/PluginStartupListener.kt.193 | 31 ------------- 5 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt delete mode 100644 idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt.192 delete mode 100644 idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt.193 diff --git a/idea/resources-descriptors/META-INF/plugin.xml.193 b/idea/resources-descriptors/META-INF/plugin.xml.193 index 19c256a4353..865ee127d1e 100644 --- a/idea/resources-descriptors/META-INF/plugin.xml.193 +++ b/idea/resources-descriptors/META-INF/plugin.xml.193 @@ -66,6 +66,12 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + + + org.jetbrains.kotlin.idea.PluginStartupComponent + + + @@ -80,7 +86,6 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. - diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 b/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 new file mode 100644 index 00000000000..87ed061e3eb --- /dev/null +++ b/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.193 @@ -0,0 +1,46 @@ +/* + * Copyright 2010-2020 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.application.PathMacros; +import com.intellij.openapi.components.BaseComponent; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.kotlin.utils.PathUtil; + +public class PluginStartupComponent implements BaseComponent { + + private static final String KOTLIN_BUNDLED = "KOTLIN_BUNDLED"; + + @Override + @NotNull + public String getComponentName() { + return PluginStartupComponent.class.getName(); + } + + @Override + public void initComponent() { + registerPathVariable(); + } + + private static void registerPathVariable() { + PathMacros macros = PathMacros.getInstance(); + macros.setMacro(KOTLIN_BUNDLED, PathUtil.getKotlinPathsForIdeaPlugin().getHomePath().getPath()); + } + + @Override + public void disposeComponent() {} +} diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt b/idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt.192 b/idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt.192 deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt.193 b/idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt.193 deleted file mode 100644 index 908049cbb9c..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/PluginStartupListener.kt.193 +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * 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.idea - -import com.intellij.ide.ApplicationInitializedListener -import com.intellij.openapi.application.PathMacros -import org.jetbrains.kotlin.utils.PathUtil.kotlinPathsForIdeaPlugin - -/** - * Some actions have to be performed before loading and opening any project. - * - * E.g. path variables have to be registered in advance as modules could rely on some path variables. - */ -class PluginStartupListener : ApplicationInitializedListener { - - override fun componentsInitialized() { - registerPathVariable() - } - - private fun registerPathVariable() { - val macros = PathMacros.getInstance() - macros.setMacro(KOTLIN_BUNDLED_PATH_VARIABLE, kotlinPathsForIdeaPlugin.homePath.path) - } - - companion object { - const val KOTLIN_BUNDLED_PATH_VARIABLE = "KOTLIN_BUNDLED" - } -} \ No newline at end of file