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:light-classes"))
|
||||||
compile(project(":compiler:frontend.java"))
|
compile(project(":compiler:frontend.java"))
|
||||||
compileOnly(intellijDep()) { includeJars("annotations", "openapi", "idea", "extensions", "util", "velocity", "boot", "gson",
|
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(commonDep("com.google.code.findbugs", "jsr305"))
|
||||||
|
|
||||||
compileOnly(intellijPluginDep("junit")) { includeJars("idea-junit") }
|
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()
|
super.projectOpened()
|
||||||
|
|
||||||
StartupManager.getInstance(myProject).registerPostStartupActivity {
|
StartupManager.getInstance(myProject).registerPostStartupActivity {
|
||||||
ApplicationManager.getApplication().executeOnPooledThread {
|
performProjectPostOpenActions()
|
||||||
DumbService.getInstance(myProject).waitForSmartMode()
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (module in getModulesWithKotlinFiles(myProject)) {
|
fun performProjectPostOpenActions() {
|
||||||
module.getAndCacheLanguageLevelByDependencies()
|
ApplicationManager.getApplication().executeOnPooledThread {
|
||||||
}
|
DumbService.getInstance(myProject).waitForSmartMode()
|
||||||
|
|
||||||
val libraries = findOutdatedKotlinLibraries(myProject)
|
for (module in getModulesWithKotlinFiles(myProject)) {
|
||||||
if (!libraries.isEmpty()) {
|
module.getAndCacheLanguageLevelByDependencies()
|
||||||
ApplicationManager.getApplication().invokeLater {
|
}
|
||||||
notifyOutdatedKotlinRuntime(myProject, libraries)
|
|
||||||
}
|
val libraries = findOutdatedKotlinLibraries(myProject)
|
||||||
}
|
if (!libraries.isEmpty()) {
|
||||||
if (!isSyncing) {
|
ApplicationManager.getApplication().invokeLater {
|
||||||
val excludeModules = collectModulesWithOutdatedRuntime(libraries)
|
notifyOutdatedKotlinRuntime(myProject, libraries)
|
||||||
showConfigureKotlinNotificationIfNeeded(myProject, excludeModules)
|
|
||||||
} else {
|
|
||||||
notificationPostponed = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!isSyncing) {
|
||||||
|
val excludeModules = collectModulesWithOutdatedRuntime(libraries)
|
||||||
|
showConfigureKotlinNotificationIfNeeded(myProject, excludeModules)
|
||||||
|
} else {
|
||||||
|
notificationPostponed = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,11 @@
|
|||||||
class="org.jetbrains.kotlin.idea.internal.makeBackup.CreateIncrementalCompilationBackup">
|
class="org.jetbrains.kotlin.idea.internal.makeBackup.CreateIncrementalCompilationBackup">
|
||||||
<add-to-group group-id="KotlinInternalGroup"/>
|
<add-to-group group-id="KotlinInternalGroup"/>
|
||||||
</action>
|
</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>
|
</actions>
|
||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
|
|||||||
Reference in New Issue
Block a user