Add internal action for reactivating post-open project activity
This commit is contained in:
@@ -6,7 +6,8 @@ dependencies {
|
||||
compile(project(":compiler:light-classes"))
|
||||
compile(project(":compiler:frontend.java"))
|
||||
compileOnly(intellijDep()) { includeJars("annotations", "openapi", "idea", "extensions", "util", "velocity", "boot", "gson",
|
||||
"swingx-core", "forms_rt", "jdom", "log4j", "guava", "asm-all", rootProject = rootProject) }
|
||||
"swingx-core", "forms_rt", "jdom", "log4j", "guava", "asm-all", "picocontainer",
|
||||
rootProject = rootProject) }
|
||||
compileOnly(commonDep("com.google.code.findbugs", "jsr305"))
|
||||
|
||||
compileOnly(intellijPluginDep("junit")) { includeJars("idea-junit") }
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2000-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.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
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
+20
-16
@@ -70,26 +70,30 @@ class KotlinConfigurationCheckerComponent(project: Project) : AbstractProjectCom
|
||||
super.projectOpened()
|
||||
|
||||
StartupManager.getInstance(myProject).registerPostStartupActivity {
|
||||
ApplicationManager.getApplication().executeOnPooledThread {
|
||||
DumbService.getInstance(myProject).waitForSmartMode()
|
||||
performProjectPostOpenActions()
|
||||
}
|
||||
}
|
||||
|
||||
for (module in getModulesWithKotlinFiles(myProject)) {
|
||||
module.getAndCacheLanguageLevelByDependencies()
|
||||
}
|
||||
fun performProjectPostOpenActions() {
|
||||
ApplicationManager.getApplication().executeOnPooledThread {
|
||||
DumbService.getInstance(myProject).waitForSmartMode()
|
||||
|
||||
val libraries = findOutdatedKotlinLibraries(myProject)
|
||||
if (!libraries.isEmpty()) {
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
notifyOutdatedKotlinRuntime(myProject, libraries)
|
||||
}
|
||||
}
|
||||
if (!isSyncing) {
|
||||
val excludeModules = collectModulesWithOutdatedRuntime(libraries)
|
||||
showConfigureKotlinNotificationIfNeeded(myProject, excludeModules)
|
||||
} else {
|
||||
notificationPostponed = true
|
||||
for (module in getModulesWithKotlinFiles(myProject)) {
|
||||
module.getAndCacheLanguageLevelByDependencies()
|
||||
}
|
||||
|
||||
val libraries = findOutdatedKotlinLibraries(myProject)
|
||||
if (!libraries.isEmpty()) {
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
notifyOutdatedKotlinRuntime(myProject, libraries)
|
||||
}
|
||||
}
|
||||
if (!isSyncing) {
|
||||
val excludeModules = collectModulesWithOutdatedRuntime(libraries)
|
||||
showConfigureKotlinNotificationIfNeeded(myProject, excludeModules)
|
||||
} else {
|
||||
notificationPostponed = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,11 @@
|
||||
class="org.jetbrains.kotlin.idea.internal.makeBackup.CreateIncrementalCompilationBackup">
|
||||
<add-to-group group-id="KotlinInternalGroup"/>
|
||||
</action>
|
||||
|
||||
<action id="ReactivePostOpenProjectActionsAction" class="org.jetbrains.kotlin.idea.actions.internal.ReactivePostOpenProjectActionsAction"
|
||||
text="Kotlin Project Post-Open Activity">
|
||||
<add-to-group group-id="KotlinInternalGroup"/>
|
||||
</action>
|
||||
</actions>
|
||||
|
||||
<extensions defaultExtensionNs="com.intellij">
|
||||
|
||||
Reference in New Issue
Block a user