diff --git a/idea/idea-gradle/res/messages/KotlinIdeaGradleBundle.properties b/idea/idea-gradle/res/messages/KotlinIdeaGradleBundle.properties
index 8845a2368ae..6ef930f986e 100644
--- a/idea/idea-gradle/res/messages/KotlinIdeaGradleBundle.properties
+++ b/idea/idea-gradle/res/messages/KotlinIdeaGradleBundle.properties
@@ -1,5 +1,28 @@
-action.text.standalone=Add as standalone script
-action.label.text.load.script.configuration=Load related Gradle project
+notification.outsideAnything.text=Code insight unavailable (related Gradle project not linked)
+notification.outsideAnything.linkAction=Link Gradle project
+notification.wasNotImportedAfterCreation.text=Code insight unavailable (Gradle project not imported)
+action.label.import.project=Import Project
+action.text.load.script.configurations=Load Script Configurations
+action.description.load.script.configurations=Gradle Kotlin DSL script configuration has been changed. Load changes to get script code insight without loading the external Gradle project.
+action.label.enable.auto.import=Enable Auto-Import
+notification.notEvaluatedInLastImport.text=Code insight unavailable (configuration for this script wasn't received during last import)
+notification.notEvaluatedInLastImport.addAsStandaloneAction=Add as standalone script
+notification.notEvaluatedInLastImport.info=
\
+
The Gradle project that evaluates this script needs to be imported to get it analyzed by the IDE.\
+Try reimport linked Gradle project or link a new Gradle project that evaluates this script.
\
+
\
+
Alternatively, you can mark this script as standalone and its configuration will be loaded separately.
\
+
\
+
NOTE: Each standalone script requires separate Gradle configuration phase to be executed on update. \
+This can be expensive for large Gradle projects.
\
+
+notification.standalone.text=Standalone script
+notification.standalone.disableScriptAction=Disable script
+notification.standalone.info=\
+
Configuration for this script will be loaded separately from Gradle project Sync. \
+
\
+
This can be expensive for large Gradle projects.
\
+
action.text.install=Install
action.text.show.kotlin.gradle.dsl.logs.in=Show Kotlin Gradle DSL Logs in {0}
build.0.project=Build {0}
@@ -38,12 +61,10 @@ text.couldn.t.configure.kotlin.gradle.plugin.automatically=Couldn't configure ko
text.default.kotlin.gradle.script=Default Kotlin Gradle Script
text.gradle.dsl.logs.cannot.be.found.automatically.see.how.to.find.logs=Gradle DSL Logs cannot be found automatically.
See how to find logs here.
text.see.manual.installation.instructions=See manual installation instructions here.
-text.the.associated.gradle.project.isn.t.imported=Cannot find related Gradle project. Kotlin DSL Code insight unavailable.
text.was.modified={0} was modified
title.configure.kotlin.gradle.plugin=Configure Kotlin-Gradle Plugin
title.kotlin.build.script=Gradle Kotlin DSL Scripts errors
title.update.language.version=Update Language Version
-tool.tip.text.the.external.gradle.project.needs.to.be.imported.to.get.this.script.analyzed=The external Gradle project needs to be imported to get this script analyzed.
Load related Gradle project to add it to the list of imported Gradle Projects.
display.name.kotlin.multiplatform=Kotlin/Multiplatform
display.name.kotlin.jvm=Kotlin/JVM
display.name.kotlin.js.for.node.js=Kotlin/JS for Node.js
@@ -52,9 +73,3 @@ comman.name.configure.kotlin=Configure Kotlin
command.name.configure.0=Configure {0}
notification.title.script.configuration.has.been.changed=Script configurations has been changed.
notification.text.script.configuration.has.been.changed=Gradle Project needs to be imported to load changes.
-script.configurations.will.be.available.after.import=Gradle Kotlin DSL script configuration is missing. Import project to get script code insight.
-script.configurations.will.be.available.after.load.changes=Gradle Kotlin DSL script configuration is missing. Load Script Configurations to get script code insight.
-action.label.import.project=Import Project
-action.label.enable.auto.import=Enable Auto-Import
-action.text.load.script.configurations=Load Script Configurations
-action.description.load.script.configurations=Gradle Kotlin DSL script configuration has been changed. Load changes to get script code insight without loading the external Gradle project.
diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt
index 345d5213cb7..48d56e2dc23 100644
--- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt
+++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/GradleImportHelper.kt
@@ -33,7 +33,6 @@ fun runPartialGradleImport(project: Project) {
}
}
-fun getMissingConfigurationNotificationText() = KotlinIdeaGradleBundle.message("script.configurations.will.be.available.after.import")
fun getMissingConfigurationActionText() = KotlinIdeaGradleBundle.message("action.label.import.project")
fun autoReloadScriptConfigurations(project: Project): Boolean {
diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/MissingGradleScriptConfigurationNotificationProvider.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/MissingGradleScriptConfigurationNotificationProvider.kt
index f347c01ef06..b774f982ede 100644
--- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/MissingGradleScriptConfigurationNotificationProvider.kt
+++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/MissingGradleScriptConfigurationNotificationProvider.kt
@@ -29,48 +29,37 @@ class MissingGradleScriptConfigurationNotificationProvider(private val project:
val scriptUnderRoot = rootsManager.findScriptBuildRoot(file) ?: return null
return when (scriptUnderRoot.notificationKind) {
dontCare -> null
- outsideAnyting -> EditorNotificationPanel().apply {
- text("Code insight unavailable (related Gradle project not linked)")
- // todo: Code insight unavailable (cannot find related Gradle project)
- createActionLabel("Link related Gradle project") {
+ outsideAnything -> EditorNotificationPanel().apply {
+ text(KotlinIdeaGradleBundle.message("notification.outsideAnything.text"))
+ createActionLabel(KotlinIdeaGradleBundle.message("notification.outsideAnything.linkAction")) {
runPartialGradleImport(project)
}
}
wasNotImportedAfterCreation -> EditorNotificationPanel().apply {
- text("Code insight unavailable (Gradle project Sync required)")
+ text(KotlinIdeaGradleBundle.message("notification.wasNotImportedAfterCreation.text"))
createActionLabel(getMissingConfigurationActionText()) {
runPartialGradleImport(project)
}
}
notEvaluatedInLastImport -> EditorNotificationPanel().apply {
- text(KotlinIdeaGradleBundle.message("text.the.associated.gradle.project.isn.t.imported"))
+ text(KotlinIdeaGradleBundle.message(KotlinIdeaGradleBundle.message("notification.notEvaluatedInLastImport.text")))
- createActionLabel(KotlinIdeaGradleBundle.message("action.text.standalone")) {
+ createActionLabel(KotlinIdeaGradleBundle.message("notification.notEvaluatedInLastImport.info")) {
rootsManager.updateStandaloneScripts {
addStandaloneScript(file.path)
}
}
- contextHelp(
- KotlinIdeaGradleBundle.message("tool.tip.text.the.external.gradle.project.needs.to.be.imported.to.get.this.script.analyzed")
- )
+ contextHelp(KotlinIdeaGradleBundle.message("notification.notEvaluatedInLastImport.addAsStandaloneAction"))
}
standalone -> EditorNotificationPanel().apply {
- text("Standalone script")
- createActionLabel("Disable script") {
+ text(KotlinIdeaGradleBundle.message("notification.standalone.text"))
+ createActionLabel(KotlinIdeaGradleBundle.message("notification.standalone.disableScriptAction")) {
rootsManager.updateStandaloneScripts {
removeStandaloneScript(file.path)
}
}
- contextHelp(
- """
-\
-
Configuration for this script will be loaded separately from Gradle project Sync. \
-
-
This can be expensive for large Gradle projects.
\
-
- """
- )
+ contextHelp(KotlinIdeaGradleBundle.message("notification.standalone.info"))
}
}
}
diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsLocator.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsLocator.kt
index fdf9038f50b..66de9b60f83 100644
--- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsLocator.kt
+++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsLocator.kt
@@ -53,9 +53,10 @@ abstract class GradleBuildRootsLocator {
return findScriptBuildRoot(filePath, searchNearestLegacy = false)?.root as? GradleBuildRoot
}
+ @Suppress("EnumEntryName")
enum class NotificationKind {
dontCare, // one of: imported, inside linked legacy gradle build
- outsideAnyting, // suggest link related gradle build or just say that there is no one
+ outsideAnything, // suggest link related gradle build or just say that there is no one
wasNotImportedAfterCreation, // project not yet imported after this file was created
notEvaluatedInLastImport, // all other scripts, suggest to sync or mark as standalone
standalone
@@ -78,7 +79,7 @@ abstract class GradleBuildRootsLocator {
get() = when {
isImported -> NotificationKind.dontCare
standalone -> NotificationKind.standalone
- nearest == null -> NotificationKind.outsideAnyting
+ nearest == null -> NotificationKind.outsideAnything
nearest.importing -> NotificationKind.dontCare
else -> when (nearest) {
is Legacy -> NotificationKind.dontCare
diff --git a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsManager.kt b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsManager.kt
index 2e711f01e21..9d9af82a870 100644
--- a/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsManager.kt
+++ b/idea/idea-gradle/src/org/jetbrains/kotlin/idea/scripting/gradle/roots/GradleBuildRootsManager.kt
@@ -137,10 +137,7 @@ class GradleBuildRootsManager(val project: Project) : GradleBuildRootsLocator(),
val mergedData = if (sync.failed && oldRoot is Imported) merge(oldRoot.data, newData) else newData
val lastModifiedFilesReset = LastModifiedFiles()
- val newRoot = tryCreateImportedRoot(
- sync.workingDir,
- lastModifiedFilesReset
- ) { mergedData } ?: return
+ val newRoot = tryCreateImportedRoot(sync.workingDir, lastModifiedFilesReset) { mergedData } ?: return
GradleBuildRootDataSerializer.write(newRoot.dir ?: return, mergedData)
newRoot.saveLastModifiedFiles()