diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/internal/ReactivePostOpenProjectActionsAction.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/internal/ReactivePostOpenProjectActionsAction.kt index e8d0fb76708..2c240015b87 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/internal/ReactivePostOpenProjectActionsAction.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/actions/internal/ReactivePostOpenProjectActionsAction.kt @@ -7,13 +7,12 @@ package org.jetbrains.kotlin.idea.actions.internal import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.project.impl.ProjectImpl -import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent +import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService class ReactivePostOpenProjectActionsAction : AnAction() { override fun actionPerformed(e: AnActionEvent) { - val project = e.project as? ProjectImpl ?: return - val configureComponent = project.getComponentInstancesOfType(KotlinConfigurationCheckerComponent::class.java).single() - configureComponent.performProjectPostOpenActions() + val project = e.project ?: return + val configurationChecker = KotlinConfigurationCheckerService.getInstanceIfNotDisposed(project) ?: return + configurationChecker.performProjectPostOpenActions() } } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinExternalSystemSyncListener.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinExternalSystemSyncListener.kt index ad3777f9951..d0908375116 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinExternalSystemSyncListener.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinExternalSystemSyncListener.kt @@ -20,19 +20,19 @@ import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskNotificationListenerAdapter import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType import com.intellij.openapi.project.Project -import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent +import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService class KotlinExternalSystemSyncListener : ExternalSystemTaskNotificationListenerAdapter() { override fun onStart(id: ExternalSystemTaskId, workingDir: String) { val project = id.findResolvedProject() ?: return KotlinMigrationProjectComponent.getInstanceIfNotDisposed(project)?.onImportAboutToStart() - KotlinConfigurationCheckerComponent.getInstanceIfNotDisposed(project)?.syncStarted() + KotlinConfigurationCheckerService.getInstanceIfNotDisposed(project)?.syncStarted() } override fun onEnd(id: ExternalSystemTaskId) { // At this point changes might be still not applied to project structure yet. val project = id.findResolvedProject() ?: return - KotlinConfigurationCheckerComponent.getInstanceIfNotDisposed(project)?.syncDone() + KotlinConfigurationCheckerService.getInstanceIfNotDisposed(project)?.syncDone() } } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt index 9ed60b36e0f..1347f4568f8 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/KotlinSetupEnvironmentNotificationProvider.kt @@ -26,7 +26,7 @@ import com.intellij.ui.EditorNotifications import org.jetbrains.kotlin.idea.KotlinFileType import org.jetbrains.kotlin.idea.KotlinJvmBundle import org.jetbrains.kotlin.idea.KotlinLanguage -import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent +import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService import org.jetbrains.kotlin.idea.project.TargetPlatformDetector import org.jetbrains.kotlin.idea.util.application.runWriteAction import org.jetbrains.kotlin.idea.versions.SuppressNotificationState @@ -60,9 +60,9 @@ class KotlinSetupEnvironmentNotificationProvider(private val myProject: Project) return createSetupSdkPanel(myProject, psiFile) } - val configurationCheckerComponent = KotlinConfigurationCheckerComponent.getInstanceIfNotDisposed(module.project) ?: return null + val configurationChecker = KotlinConfigurationCheckerService.getInstanceIfNotDisposed(module.project) ?: return null - if (!configurationCheckerComponent.isSyncing && + if (!configurationChecker.isSyncing && isNotConfiguredNotificationRequired(module.toModuleGroup()) && !hasAnyKotlinRuntimeInScope(module) && UnsupportedAbiVersionNotificationPanelProvider.collectBadRoots(module).isEmpty() diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerComponent.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerComponent.kt index 2d61f3011bd..73b8135f6e4 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerComponent.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerComponent.kt @@ -16,80 +16,5 @@ package org.jetbrains.kotlin.idea.configuration.ui -import com.intellij.notification.NotificationDisplayType -import com.intellij.notification.NotificationsConfiguration -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.runReadAction -import com.intellij.openapi.components.ProjectComponent -import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataImportListener -import com.intellij.openapi.project.Project -import com.intellij.openapi.startup.StartupManager -import org.jetbrains.kotlin.idea.configuration.getModulesWithKotlinFiles -import org.jetbrains.kotlin.idea.configuration.notifyOutdatedBundledCompilerIfNecessary -import org.jetbrains.kotlin.idea.configuration.ui.notifications.notifyKotlinStyleUpdateIfNeeded -import org.jetbrains.kotlin.idea.project.getAndCacheLanguageLevelByDependencies -import org.jetbrains.kotlin.idea.util.runReadActionInSmartMode -import java.util.concurrent.atomic.AtomicInteger - -class KotlinConfigurationCheckerComponent(val project: Project) : ProjectComponent { - private val syncDepth = AtomicInteger() - - init { - NotificationsConfiguration.getNotificationsConfiguration() - .register(CONFIGURE_NOTIFICATION_GROUP_ID, NotificationDisplayType.STICKY_BALLOON, true) - - val connection = project.messageBus.connect() - connection.subscribe(ProjectDataImportListener.TOPIC, ProjectDataImportListener { - notifyOutdatedBundledCompilerIfNecessary(project) - }) - - notifyKotlinStyleUpdateIfNeeded(project) - } - - override fun projectOpened() { - super.projectOpened() - - StartupManager.getInstance(project).registerPostStartupActivity { - performProjectPostOpenActions() - } - } - - fun performProjectPostOpenActions() { - ApplicationManager.getApplication().executeOnPooledThread { - val modulesWithKotlinFiles = project.runReadActionInSmartMode { - getModulesWithKotlinFiles(project) - } - for (module in modulesWithKotlinFiles) { - runReadAction { - if (project.isDisposed) return@runReadAction - module.getAndCacheLanguageLevelByDependencies() - } - } - } - } - - val isSyncing: Boolean get() = syncDepth.get() > 0 - - fun syncStarted() { - syncDepth.incrementAndGet() - } - - fun syncDone() { - syncDepth.decrementAndGet() - } - - companion object { - const val CONFIGURE_NOTIFICATION_GROUP_ID = "Configure Kotlin in Project" - - fun getInstanceIfNotDisposed(project: Project): KotlinConfigurationCheckerComponent? { - return runReadAction { - if (!project.isDisposed) { - project.getComponent(KotlinConfigurationCheckerComponent::class.java) - ?: error("Can't find ${KotlinConfigurationCheckerComponent::class} component") - } else { - null - } - } - } - } +class KotlinConfigurationCheckerComponent { } diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerComponent.kt.192 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerComponent.kt.192 new file mode 100644 index 00000000000..f17693cf2d1 --- /dev/null +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerComponent.kt.192 @@ -0,0 +1,97 @@ +/* + * 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.configuration.ui + +import com.intellij.notification.NotificationDisplayType +import com.intellij.notification.NotificationsConfiguration +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.application.runReadAction +import com.intellij.openapi.components.ProjectComponent +import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataImportListener +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupManager +import org.jetbrains.kotlin.idea.configuration.getModulesWithKotlinFiles +import org.jetbrains.kotlin.idea.configuration.notifyOutdatedBundledCompilerIfNecessary +import org.jetbrains.kotlin.idea.configuration.ui.notifications.notifyKotlinStyleUpdateIfNeeded +import org.jetbrains.kotlin.idea.project.getAndCacheLanguageLevelByDependencies +import org.jetbrains.kotlin.idea.util.runReadActionInSmartMode +import java.util.concurrent.atomic.AtomicInteger + +typealias KotlinConfigurationCheckerService = KotlinConfigurationCheckerComponent + +class KotlinConfigurationCheckerComponent(val project: Project) : ProjectComponent { + private val syncDepth = AtomicInteger() + + init { + NotificationsConfiguration.getNotificationsConfiguration() + .register(CONFIGURE_NOTIFICATION_GROUP_ID, NotificationDisplayType.STICKY_BALLOON, true) + + val connection = project.messageBus.connect() + connection.subscribe(ProjectDataImportListener.TOPIC, ProjectDataImportListener { + notifyOutdatedBundledCompilerIfNecessary(project) + }) + + notifyKotlinStyleUpdateIfNeeded(project) + } + + override fun projectOpened() { + super.projectOpened() + + StartupManager.getInstance(project).registerPostStartupActivity { + performProjectPostOpenActions() + } + } + + fun performProjectPostOpenActions() { + ApplicationManager.getApplication().executeOnPooledThread { + val modulesWithKotlinFiles = project.runReadActionInSmartMode { + getModulesWithKotlinFiles(project) + } + for (module in modulesWithKotlinFiles) { + runReadAction { + if (project.isDisposed) return@runReadAction + module.getAndCacheLanguageLevelByDependencies() + } + } + } + } + + val isSyncing: Boolean get() = syncDepth.get() > 0 + + fun syncStarted() { + syncDepth.incrementAndGet() + } + + fun syncDone() { + syncDepth.decrementAndGet() + } + + companion object { + const val CONFIGURE_NOTIFICATION_GROUP_ID = "Configure Kotlin in Project" + + fun getInstanceIfNotDisposed(project: Project): KotlinConfigurationCheckerComponent? { + return runReadAction { + if (!project.isDisposed) { + project.getComponent(KotlinConfigurationCheckerComponent::class.java) + ?: error("Can't find ${KotlinConfigurationCheckerComponent::class} component") + } else { + null + } + } + } + } +} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerService.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerService.kt new file mode 100644 index 00000000000..9c8f242789f --- /dev/null +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/KotlinConfigurationCheckerService.kt @@ -0,0 +1,93 @@ +/* + * 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.configuration.ui + +import com.intellij.notification.NotificationDisplayType +import com.intellij.notification.NotificationsConfiguration +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.application.runReadAction +import com.intellij.openapi.externalSystem.service.project.manage.ProjectDataImportListener +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupActivity +import org.jetbrains.kotlin.idea.configuration.getModulesWithKotlinFiles +import org.jetbrains.kotlin.idea.configuration.notifyOutdatedBundledCompilerIfNecessary +import org.jetbrains.kotlin.idea.configuration.ui.notifications.notifyKotlinStyleUpdateIfNeeded +import org.jetbrains.kotlin.idea.project.getAndCacheLanguageLevelByDependencies +import org.jetbrains.kotlin.idea.util.runReadActionInSmartMode +import java.util.concurrent.atomic.AtomicInteger + +class KotlinConfigurationCheckerStartupActivity : StartupActivity.DumbAware { + override fun runActivity(project: Project) { + NotificationsConfiguration.getNotificationsConfiguration() + .register( + KotlinConfigurationCheckerService.CONFIGURE_NOTIFICATION_GROUP_ID, + NotificationDisplayType.STICKY_BALLOON, true + ) + + val connection = project.messageBus.connect(project) + connection.subscribe(ProjectDataImportListener.TOPIC, ProjectDataImportListener { + notifyOutdatedBundledCompilerIfNecessary(project) + }) + + notifyKotlinStyleUpdateIfNeeded(project) + + KotlinConfigurationCheckerService.getInstanceIfNotDisposed(project)?.performProjectPostOpenActions() + } +} + +class KotlinConfigurationCheckerService(val project: Project) { + private val syncDepth = AtomicInteger() + + fun performProjectPostOpenActions() { + ApplicationManager.getApplication().executeOnPooledThread { + val modulesWithKotlinFiles = project.runReadActionInSmartMode { + getModulesWithKotlinFiles(project) + } + for (module in modulesWithKotlinFiles) { + runReadAction { + if (project.isDisposed) return@runReadAction + module.getAndCacheLanguageLevelByDependencies() + } + } + } + } + + val isSyncing: Boolean get() = syncDepth.get() > 0 + + fun syncStarted() { + syncDepth.incrementAndGet() + } + + fun syncDone() { + syncDepth.decrementAndGet() + } + + companion object { + const val CONFIGURE_NOTIFICATION_GROUP_ID = "Configure Kotlin in Project" + + fun getInstanceIfNotDisposed(project: Project): KotlinConfigurationCheckerService? { + return runReadAction { + if (!project.isDisposed) { + project.getService(KotlinConfigurationCheckerService::class.java) + ?: error("Can't find ${KotlinConfigurationCheckerService::class} service") + } else { + null + } + } + } + } +} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/notifications/ConfigureKotlinNotification.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/notifications/ConfigureKotlinNotification.kt index d010b948544..a07e078f72f 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/notifications/ConfigureKotlinNotification.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/configuration/ui/notifications/ConfigureKotlinNotification.kt @@ -14,7 +14,7 @@ import org.jetbrains.kotlin.idea.KotlinJvmBundle import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator import org.jetbrains.kotlin.idea.configuration.getConfigurationPossibilitiesForConfigureNotification import org.jetbrains.kotlin.idea.configuration.getConfiguratorByName -import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent +import org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService import javax.swing.event.HyperlinkEvent data class ConfigureKotlinNotificationState( @@ -28,7 +28,7 @@ class ConfigureKotlinNotification( excludeModules: List, val notificationState: ConfigureKotlinNotificationState ) : Notification( - KotlinConfigurationCheckerComponent.CONFIGURE_NOTIFICATION_GROUP_ID, KotlinJvmBundle.message("configure.kotlin"), + KotlinConfigurationCheckerService.CONFIGURE_NOTIFICATION_GROUP_ID, KotlinJvmBundle.message("configure.kotlin"), notificationState.notificationString, NotificationType.WARNING, NotificationListener { notification, event -> diff --git a/idea/resources/META-INF/jvm-common.xml b/idea/resources/META-INF/jvm-common.xml new file mode 100644 index 00000000000..84f4ec4f286 --- /dev/null +++ b/idea/resources/META-INF/jvm-common.xml @@ -0,0 +1,239 @@ + + + + org.jetbrains.kotlin.idea.JvmPluginStartupComponent + + + + + + org.jetbrains.kotlin.idea.compiler.KotlinCompilerManager + + + org.jetbrains.kotlin.idea.scratch.ScratchFileModuleInfoProvider + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/idea/resources/META-INF/jvm.xml b/idea/resources/META-INF/jvm.xml index 4cff3b894ad..c2f9fde42c4 100644 --- a/idea/resources/META-INF/jvm.xml +++ b/idea/resources/META-INF/jvm.xml @@ -1,242 +1,9 @@ - - - org.jetbrains.kotlin.idea.JvmPluginStartupComponent - - - - - - org.jetbrains.kotlin.idea.compiler.KotlinCompilerManager - - - org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent - - - org.jetbrains.kotlin.idea.scratch.ScratchFileModuleInfoProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/idea/resources/META-INF/jvm.xml.192 b/idea/resources/META-INF/jvm.xml.192 new file mode 100644 index 00000000000..11ca8b73320 --- /dev/null +++ b/idea/resources/META-INF/jvm.xml.192 @@ -0,0 +1,8 @@ + + + + org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent + + + + diff --git a/idea/resources/META-INF/jvm.xml.201 b/idea/resources/META-INF/jvm.xml.201 index bfd3905fbd1..ec2ca5116fc 100644 --- a/idea/resources/META-INF/jvm.xml.201 +++ b/idea/resources/META-INF/jvm.xml.201 @@ -1,231 +1,13 @@ - - - org.jetbrains.kotlin.idea.JvmPluginStartupComponent - - - - - - org.jetbrains.kotlin.idea.compiler.KotlinCompilerManager - - - org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent - - - org.jetbrains.kotlin.idea.scratch.ScratchFileModuleInfoProvider - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/idea/resources/META-INF/plugin.xml b/idea/resources/META-INF/plugin.xml index abb444e76c6..1dbbb7a4c92 100644 --- a/idea/resources/META-INF/plugin.xml +++ b/idea/resources/META-INF/plugin.xml @@ -44,6 +44,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + diff --git a/idea/resources/META-INF/plugin.xml.191 b/idea/resources/META-INF/plugin.xml.191 index 887134806f2..95c0da268f6 100644 --- a/idea/resources/META-INF/plugin.xml.191 +++ b/idea/resources/META-INF/plugin.xml.191 @@ -43,6 +43,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + diff --git a/idea/resources/META-INF/plugin.xml.192 b/idea/resources/META-INF/plugin.xml.192 index 0c0aecba01f..dd06fbcc939 100644 --- a/idea/resources/META-INF/plugin.xml.192 +++ b/idea/resources/META-INF/plugin.xml.192 @@ -43,6 +43,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + diff --git a/idea/resources/META-INF/plugin.xml.201 b/idea/resources/META-INF/plugin.xml.201 index dc9f200f8f7..0a2c73f00ba 100644 --- a/idea/resources/META-INF/plugin.xml.201 +++ b/idea/resources/META-INF/plugin.xml.201 @@ -44,6 +44,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + diff --git a/idea/resources/META-INF/plugin.xml.as35 b/idea/resources/META-INF/plugin.xml.as35 index e8fdcd4009a..34a8a53d4ea 100644 --- a/idea/resources/META-INF/plugin.xml.as35 +++ b/idea/resources/META-INF/plugin.xml.as35 @@ -44,6 +44,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + diff --git a/idea/resources/META-INF/plugin.xml.as36 b/idea/resources/META-INF/plugin.xml.as36 index e79b67fb965..0ed3e561674 100644 --- a/idea/resources/META-INF/plugin.xml.as36 +++ b/idea/resources/META-INF/plugin.xml.as36 @@ -44,6 +44,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + diff --git a/idea/resources/META-INF/plugin.xml.as40 b/idea/resources/META-INF/plugin.xml.as40 index 5e8c44f6c44..2d027728d77 100644 --- a/idea/resources/META-INF/plugin.xml.as40 +++ b/idea/resources/META-INF/plugin.xml.as40 @@ -43,6 +43,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. + diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupActivity.java.191 b/idea/src/org/jetbrains/kotlin/idea/PluginStartupActivity.java.191 deleted file mode 100644 index a60f0e72cbb..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/PluginStartupActivity.java.191 +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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; - - -public class PluginStartupActivity { - - -} diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.191 b/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.191 deleted file mode 100644 index b7379d8f51f..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/PluginStartupComponent.java.191 +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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.application.ApplicationManager; -import com.intellij.openapi.application.PathMacros; -import com.intellij.openapi.components.BaseComponent; -import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.editor.EditorFactory; -import com.intellij.openapi.editor.event.DocumentEvent; -import com.intellij.openapi.editor.event.DocumentListener; -import com.intellij.openapi.fileEditor.FileDocumentManager; -import com.intellij.openapi.updateSettings.impl.UpdateChecker; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.search.searches.IndexPatternSearch; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.diagnostics.DiagnosticFactory; -import org.jetbrains.kotlin.diagnostics.Errors; -import org.jetbrains.kotlin.idea.reporter.KotlinReportSubmitter; -import org.jetbrains.kotlin.idea.search.ideaExtensions.KotlinTodoSearcher; -import org.jetbrains.kotlin.js.resolve.diagnostics.ErrorsJs; -import org.jetbrains.kotlin.resolve.jvm.diagnostics.ErrorsJvm; -import org.jetbrains.kotlin.resolve.konan.diagnostics.ErrorsNative; -import org.jetbrains.kotlin.utils.PathUtil; - -import java.io.File; -import java.io.IOException; - -import static org.jetbrains.kotlin.idea.TestResourceBundleKt.registerAdditionalResourceBundleInTests; - -public class PluginStartupComponent implements BaseComponent { - private static final Logger LOG = Logger.getInstance(PluginStartupComponent.class); - - private static final String KOTLIN_BUNDLED = "KOTLIN_BUNDLED"; - - public static PluginStartupComponent getInstance() { - return ApplicationManager.getApplication().getComponent(PluginStartupComponent.class); - } - - @Override - @NotNull - public String getComponentName() { - return PluginStartupComponent.class.getName(); - } - - @Override - public void initComponent() { - if (ApplicationManager.getApplication().isUnitTestMode()) { - registerAdditionalResourceBundleInTests(); - } - - registerPathVariable(); - initializeDiagnostics(); - - try { - // API added in 15.0.2 - UpdateChecker.INSTANCE.getExcludedFromUpdateCheckPlugins().add("org.jetbrains.kotlin"); - } - catch (Throwable throwable) { - LOG.debug("Excluding Kotlin plugin updates using old API", throwable); - UpdateChecker.getDisabledToUpdatePlugins().add("org.jetbrains.kotlin"); - } - EditorFactory.getInstance().getEventMulticaster().addDocumentListener(new DocumentListener() { - @Override - public void documentChanged(@NotNull DocumentEvent e) { - VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(e.getDocument()); - if (virtualFile != null && virtualFile.getFileType() == KotlinFileType.INSTANCE) { - KotlinPluginUpdater.Companion.getInstance().kotlinFileEdited(virtualFile); - } - } - }); - - ServiceManager.getService(IndexPatternSearch.class).registerExecutor(new KotlinTodoSearcher()); - - KotlinPluginCompatibilityVerifier.checkCompatibility(); - - KotlinReportSubmitter.Companion.setupReportingFromRelease(); - - //todo[Sedunov]: wait for fix in platform to avoid misunderstood from Java newbies (also ConfigureKotlinInTempDirTest) - //KotlinSdkType.Companion.setUpIfNeeded(); - } - - /* - Concurrent access to Errors may lead to the class loading dead lock because of non-trivial initialization in Errors. - As a work-around, all Error classes are initialized beforehand. - It doesn't matter what exact diagnostic factories are used here. - */ - private static void initializeDiagnostics() { - consumeFactory(Errors.DEPRECATION); - consumeFactory(ErrorsJvm.ACCIDENTAL_OVERRIDE); - consumeFactory(ErrorsJs.CALL_FROM_UMD_MUST_BE_JS_MODULE_AND_JS_NON_MODULE); - consumeFactory(ErrorsNative.INCOMPATIBLE_THROWS_INHERITED); - } - - private static void consumeFactory(DiagnosticFactory factory) { - //noinspection ResultOfMethodCallIgnored - factory.getClass(); - } - - private static void registerPathVariable() { - PathMacros macros = PathMacros.getInstance(); - macros.setMacro(KOTLIN_BUNDLED, PathUtil.getKotlinPathsForIdeaPlugin().getHomePath().getPath()); - } - - private String aliveFlagPath; - - public synchronized String getAliveFlagPath() { - if (this.aliveFlagPath == null) { - try { - File flagFile = File.createTempFile("kotlin-idea-", "-is-running"); - flagFile.deleteOnExit(); - this.aliveFlagPath = flagFile.getAbsolutePath(); - } - catch (IOException e) { - this.aliveFlagPath = ""; - } - } - return this.aliveFlagPath; - } - - public synchronized void resetAliveFlag() { - if (this.aliveFlagPath != null) { - File flagFile = new File(this.aliveFlagPath); - if (flagFile.exists()) { - if (flagFile.delete()) { - this.aliveFlagPath = null; - } - } - } - } - - @Override - public void disposeComponent() {} -} diff --git a/idea/src/org/jetbrains/kotlin/idea/PluginStartupService.java.191 b/idea/src/org/jetbrains/kotlin/idea/PluginStartupService.java.191 deleted file mode 100644 index 9a3ed2b5a68..00000000000 --- a/idea/src/org/jetbrains/kotlin/idea/PluginStartupService.java.191 +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ApplicationManager; - -import java.io.File; -import java.io.IOException; - -public class PluginStartupService { - - -}