i18n: update bundle for idea-jvm
This commit is contained in:
@@ -66,4 +66,108 @@ script.choose.file=Choose script file
|
||||
|
||||
editor.editor.only=Editor only
|
||||
editor.preview.only=Preview only
|
||||
editor.editor.and.preview=Editor and preview
|
||||
editor.editor.and.preview=Editor and preview
|
||||
choose.configurator=Choose Configurator
|
||||
ignore=Ignore
|
||||
configure=Configure
|
||||
kotlin.not.configured=Kotlin not configured
|
||||
there.aren.t.configurators.available=There aren't configurators available
|
||||
all.modules.with.kotlin.files.are.configured=All modules with Kotlin files are configured
|
||||
added.0.requirement.to.module.info.in.1=Added {0} requirement to module-info in {1}
|
||||
updated.javascript.libraries.in.module.0=Updated JavaScript libraries in module {0}
|
||||
added.0.to.library.configuration=Added {0} to library configuration
|
||||
couldn.t.configure.library.jar.file.0.may.be.corrupted=Couldn''t configure library; JAR file {0} may be corrupted
|
||||
can.t.find.library.jar.file.0=Can''t find library JAR file {0}
|
||||
0.was.copied.to.1={0} was copied to {1}
|
||||
0.library.scope.has.changed.from.1.to.2.for.module.3={0} library scope has changed from {1} to {2} for module {3}
|
||||
0.library.was.added.to.module.1={0} library was added to module {1}
|
||||
0.library.was.created={0} library was created
|
||||
configure.kotlin=Configure Kotlin
|
||||
configure.0.in.1.project.br.2=Configure {0} in ''{1}'' project<br/> {2}
|
||||
kotlin.code.style=Kotlin Code Style
|
||||
default.code.style.was.updated.to.kotlin.coding.conventions=Default code style was updated to Kotlin Coding Conventions.
|
||||
apply.new.code.style=Apply new code style
|
||||
restore.old.settings=Restore old settings
|
||||
libraries.for.the.following.platform.are.also.present.in.the.module.dependencies.0=Libraries for the following platform are also present in the module dependencies: {0}
|
||||
no.target.platforms.selected=No target platforms selected
|
||||
kotlin.common.standard.library=Kotlin Common Standard Library
|
||||
create.kotlin.common.standard.library=Create Kotlin Common Standard Library
|
||||
kotlin.js=Kotlin/JS
|
||||
kotlin.java.runtime.library=Kotlin Java Runtime Library
|
||||
create.kotlin.java.runtime.library=Create Kotlin Java Runtime Library
|
||||
kotlin.javascript.library=Kotlin JavaScript Library
|
||||
create.kotlin.javascript.library=Create Kotlin JavaScript Library
|
||||
javascript.library.creation=JavaScript Library Creation
|
||||
java.runtime.library.creation=Java Runtime Library Creation
|
||||
js.files=JS files
|
||||
kotlin.project.with.a.javascript.target.based.on.the.intellij.idea.build.system=Kotlin project with a JavaScript target based on the IntelliJ IDEA build system
|
||||
kotlin.project.with.a.jvm.target.based.on.the.intellij.idea.build.system=Kotlin project with a JVM target based on the IntelliJ IDEA build system
|
||||
add.injection.comment=Add injection comment
|
||||
add.injection.annotation=Add injection annotation
|
||||
remove.injection.in.code.instructions=remove injection in-code instructions
|
||||
this.java.file.is.outside.of.java.source.roots.and.won.t.be.added.to.the.classpath=This .java file is outside of Java source roots and won't be added to the classpath.
|
||||
incompatible.api=Incompatible API
|
||||
kotlin.bytecode.decompiler=Kotlin Bytecode Decompiler
|
||||
failed.to.decompile.0.1=Failed to decompile {0}: {1}
|
||||
decompile=Decompile
|
||||
ir=IR
|
||||
jvm.8.target=JVM 8 target
|
||||
assertions=Assertions
|
||||
optimization=Optimization
|
||||
inline=Inline
|
||||
cannot.compile.0.to.bytecode=Cannot compile {0} to bytecode.
|
||||
create.backup.for.debugging.kotlin.incremental.compilation=Create backup for debugging Kotlin incremental compilation
|
||||
creating.backup.for.debugging.kotlin.incremental.compilation=Creating backup for debugging Kotlin incremental compilation
|
||||
creating.patch.0=Creating patch {0}
|
||||
copying.logs=Copying logs
|
||||
copying.project.s.system.dir=Copying project's system dir
|
||||
scanning.project.dir.0=Scanning project dir: {0}
|
||||
adding.file.to.backup.0=Adding file to backup: {0}
|
||||
created.backup=Created backup
|
||||
successfully.created.backup.0=Successfully created backup {0}
|
||||
update.runtime.library=Update Runtime Library
|
||||
this.language.feature.requires.version.0.or.later.of.the.kotlin.runtime.library.would.you.like.to.update.the.runtime.library.in.your.project=This language feature requires version {0} or later of the Kotlin runtime library. Would you like to update the runtime library in your project?
|
||||
could.not.find.script.file.0=Could not find script file: {0}
|
||||
file.was.not.specified=File was not specified
|
||||
run.kotlin.script=Run Kotlin script
|
||||
kotlin.script=Kotlin script
|
||||
exception.occurs.during.run.scratch.action=Exception occurs during Run Scratch Action
|
||||
there.were.compilation.errors.in.module.0=There were compilation errors in module {0}
|
||||
other.scratch.file.execution.is.in.progress=Other Scratch file execution is in progress
|
||||
exception.occurs.during.run.scratch.action1=Exception occurs during Run Scratch Action
|
||||
couldn.t.extract.line.info.from.line.0=Couldn''t extract line info from line: {0}
|
||||
couldn.t.compile.0=Couldn''t compile {0}
|
||||
couldn.t.find.ktfile.for.current.editor=Couldn't find KtFile for current editor
|
||||
couldn.t.get.scratch.execution.result.stopped.by.timeout.0.ms=Couldn''t get scratch execution result - stopped by timeout ({0} ms)
|
||||
running.kotlin.scratch=Running Kotlin Scratch...
|
||||
couldn.t.execute.statement.0=Couldn''t execute statement: {0}
|
||||
couldn.t.stop.repl.process=Couldn't stop REPL process
|
||||
check.bunch.files=Check &bunch files
|
||||
commit=Commit
|
||||
review=Review
|
||||
forgotten.bunch.files=Forgotten Bunch Files
|
||||
several.bunch.files.haven.t.been.updated.0.do.you.want.to.review.them.before.commit=Several bunch files haven''t been updated:\n\n{0}\n\nDo you want to review them before commit?
|
||||
update.kotlin.runtime.library=Update Kotlin Runtime Library
|
||||
automatic.library.version.update.for.maven.and.gradle.projects.is.currently.unsupported.please.update.your.build.scripts.manually=Automatic library version update for Maven and Gradle projects is currently unsupported. Please update your build scripts manually.
|
||||
library.update.failed=Library update failed
|
||||
failed.to.update.0.1=Failed to update {0}: {1}
|
||||
library.update.failed1=Library update failed
|
||||
failed.to.find.root.for.file.0=Failed to find root for file: {0}
|
||||
html.b.0.choice.0.1.1.some.kotlin.runtime.librar.0.choice.0.1.y.1.ies.b.1.choice.0.1.and.one.other.jar.1.and.1.other.jars.1.choice.0.has.0.have.an.unsupported.binary.format.html=<html><b>{0,choice,0#|1#|1<Some }Kotlin runtime librar{0,choice,0#|1#y|1<ies}</b>{1,choice,0#|1# and one other jar|1< and {1} other jars} {1,choice,0#has|0<have} an unsupported binary format.</html>
|
||||
replace=Replace
|
||||
downgrade=Downgrade
|
||||
update=Update
|
||||
0.choice.0.1.1.all.kotlin.runtime.librar.0.choice.0.1.y.1.ies={0,choice,0#|1#|1<all }Kotlin runtime librar{0,choice,0#|1#y|1<ies}
|
||||
html.kotlin.library.b.0.b.has.outdated.binary.format.and.can.t.be.read.by.current.plugin.please.update.the.library.html=<html>Kotlin library <b>'{'0'}'</b> has outdated binary format and can''t be read by current plugin. Please update the library.</html>
|
||||
html.kotlin.library.b.0.b.was.compiled.with.a.newer.kotlin.compiler.and.can.t.be.read.please.update.kotlin.plugin.html=<html>Kotlin library <b>'{'0'}'</b> was compiled with a newer Kotlin compiler and can''t be read. Please update Kotlin plugin.</html>
|
||||
some.kotlin.libraries.attached.to.this.project.have.unsupported.binary.format.please.update.the.libraries.or.the.plugin=Some Kotlin libraries attached to this project have unsupported binary format. Please update the libraries or the plugin.
|
||||
some.kotlin.libraries.attached.to.this.project.have.outdated.binary.format.and.can.t.be.read.by.current.plugin.please.update.found.libraries=Some Kotlin libraries attached to this project have outdated binary format and can't be read by current plugin. Please update found libraries.
|
||||
some.kotlin.libraries.attached.to.this.project.were.compiled.with.a.newer.kotlin.compiler.and.can.t.be.read.please.update.kotlin.plugin=Some Kotlin libraries attached to this project were compiled with a newer Kotlin compiler and can't be read. Please update Kotlin plugin.
|
||||
go.to.0=Go to {0}
|
||||
details=Details
|
||||
update.plugin=Update plugin
|
||||
check=\ Check...
|
||||
can.t.show.all.paths.during.index.update=Can't show all paths during index update
|
||||
unsupported.format.plugin.version.0=Unsupported format, plugin version: {0}
|
||||
no.updates.found=No updates found
|
||||
0.1.expected.2={0} ({1}) - expected: {2}
|
||||
+7
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.util.PlatformUtils
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.configuration.*
|
||||
import org.jetbrains.kotlin.idea.util.projectStructure.allModules
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
@@ -24,7 +25,7 @@ abstract class ConfigureKotlinInProjectAction : AnAction() {
|
||||
|
||||
val modules = getConfigurableModules(project)
|
||||
if (modules.all(::isModuleConfigured)) {
|
||||
Messages.showInfoMessage("All modules with Kotlin files are configured", e.presentation.text!!)
|
||||
Messages.showInfoMessage(KotlinJvmBundle.message("all.modules.with.kotlin.files.are.configured"), e.presentation.text!!)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -32,7 +33,10 @@ abstract class ConfigureKotlinInProjectAction : AnAction() {
|
||||
|
||||
when {
|
||||
configurators.size == 1 -> configurators.first().configure(project, emptyList())
|
||||
configurators.isEmpty() -> Messages.showErrorDialog("There aren't configurators available", e.presentation.text!!)
|
||||
configurators.isEmpty() -> Messages.showErrorDialog(
|
||||
KotlinJvmBundle.message("there.aren.t.configurators.available"),
|
||||
e.presentation.text!!
|
||||
)
|
||||
else -> {
|
||||
val configuratorsPopup =
|
||||
KotlinSetupEnvironmentNotificationProvider.createConfiguratorsPopup(project, configurators.toList())
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.psi.search.FileTypeIndex
|
||||
import com.intellij.psi.search.GlobalSearchScope
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.core.util.getKotlinJvmRuntimeMarkerClass
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.effectiveKind
|
||||
@@ -307,6 +308,6 @@ fun addStdlibToJavaModuleInfo(module: Module, collector: NotificationMessageColl
|
||||
|
||||
if (!success) return false
|
||||
|
||||
collector.addMessage("Added $KOTLIN_STDLIB_MODULE_NAME requirement to module-info in ${module.name}")
|
||||
collector.addMessage(KotlinJvmBundle.message("added.0.requirement.to.module.info.in.1", KOTLIN_STDLIB_MODULE_NAME, module.name))
|
||||
return true
|
||||
}
|
||||
|
||||
+4
-14
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2016 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.
|
||||
* 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.configuration
|
||||
@@ -25,6 +14,7 @@ import com.intellij.openapi.roots.impl.libraries.LibraryEx
|
||||
import com.intellij.openapi.roots.libraries.DummyLibraryProperties
|
||||
import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.roots.libraries.LibraryType
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryKind
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryStdDescription
|
||||
import org.jetbrains.kotlin.idea.framework.JSLibraryType
|
||||
@@ -102,7 +92,7 @@ open class KotlinJsModuleConfigurator : KotlinWithLibraryConfigurator() {
|
||||
}
|
||||
}
|
||||
}
|
||||
collector.addMessage("Updated JavaScript libraries in module ${module.name}")
|
||||
collector.addMessage(KotlinJvmBundle.message("updated.javascript.libraries.in.module.0", module.name))
|
||||
}
|
||||
return brokenStdlib
|
||||
}
|
||||
|
||||
+9
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.intellij.psi.PsiManager
|
||||
import com.intellij.ui.EditorNotificationPanel
|
||||
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.project.TargetPlatformDetector
|
||||
@@ -93,10 +94,10 @@ class KotlinSetupEnvironmentNotificationProvider(private val myProject: Project)
|
||||
|
||||
private fun createKotlinNotConfiguredPanel(module: Module): EditorNotificationPanel {
|
||||
return EditorNotificationPanel().apply {
|
||||
setText("Kotlin not configured")
|
||||
setText(KotlinJvmBundle.message("kotlin.not.configured"))
|
||||
val configurators = getAbleToRunConfigurators(module).toList()
|
||||
if (configurators.isNotEmpty()) {
|
||||
createComponentActionLabel("Configure") { label ->
|
||||
createComponentActionLabel(KotlinJvmBundle.message("configure")) { label ->
|
||||
val singleConfigurator = configurators.singleOrNull()
|
||||
if (singleConfigurator != null) {
|
||||
singleConfigurator.apply(module.project)
|
||||
@@ -106,7 +107,7 @@ class KotlinSetupEnvironmentNotificationProvider(private val myProject: Project)
|
||||
}
|
||||
}
|
||||
|
||||
createComponentActionLabel("Ignore") {
|
||||
createComponentActionLabel(KotlinJvmBundle.message("ignore")) {
|
||||
SuppressNotificationState.suppressKotlinNotConfigured(module)
|
||||
EditorNotifications.getInstance(module.project).updateAllNotifications()
|
||||
}
|
||||
@@ -121,7 +122,10 @@ class KotlinSetupEnvironmentNotificationProvider(private val myProject: Project)
|
||||
}
|
||||
|
||||
fun createConfiguratorsPopup(project: Project, configurators: List<KotlinProjectConfigurator>): ListPopup {
|
||||
val step = object : BaseListPopupStep<KotlinProjectConfigurator>("Choose Configurator", configurators) {
|
||||
val step = object : BaseListPopupStep<KotlinProjectConfigurator>(
|
||||
KotlinJvmBundle.message("choose.configurator"),
|
||||
configurators
|
||||
) {
|
||||
override fun getTextFor(value: KotlinProjectConfigurator?) = value?.presentableText ?: "<none>"
|
||||
|
||||
override fun onChosen(selectedValue: KotlinProjectConfigurator?, finalChoice: Boolean): PopupStep<*>? {
|
||||
|
||||
+16
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.jetbrains.kotlin.config.ApiVersion
|
||||
import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.config.LanguageVersion
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.facet.getCleanRuntimeLibraryVersion
|
||||
import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion
|
||||
import org.jetbrains.kotlin.idea.facet.toApiVersion
|
||||
@@ -192,19 +193,19 @@ abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinPro
|
||||
|
||||
val jarVFile = LocalFileSystem.getInstance().findFileByIoFile(jarFile)
|
||||
if (jarVFile == null) {
|
||||
collector.addMessage("Can't find library JAR file " + jarFile)
|
||||
collector.addMessage(KotlinJvmBundle.message("can.t.find.library.jar.file.0", jarFile))
|
||||
return
|
||||
}
|
||||
val jarRoot = JarFileSystem.getInstance().getJarRootForLocalFile(jarVFile)
|
||||
if (jarRoot == null) {
|
||||
collector.addMessage("Couldn't configure library; JAR file $jarVFile may be corrupted")
|
||||
collector.addMessage(KotlinJvmBundle.message("couldn.t.configure.library.jar.file.0.may.be.corrupted", jarVFile))
|
||||
return
|
||||
}
|
||||
|
||||
if (jarRoot !in library.getFiles(libraryJarDescriptor.orderRootType)) {
|
||||
library.addRoot(jarRoot, libraryJarDescriptor.orderRootType)
|
||||
|
||||
collector.addMessage("Added $jarFile to library configuration")
|
||||
collector.addMessage(KotlinJvmBundle.message("added.0.to.library.configuration", jarFile))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +220,7 @@ abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinPro
|
||||
|
||||
val copy = FileUIUtils.copyWithOverwriteDialog(messageForOverrideDialog, toDir, file)
|
||||
if (copy != null) {
|
||||
collector.addMessage(file.name + " was copied to " + toDir)
|
||||
collector.addMessage(KotlinJvmBundle.message("0.was.copied.to.1", file.name, toDir))
|
||||
}
|
||||
return copy
|
||||
}
|
||||
@@ -233,7 +234,7 @@ abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinPro
|
||||
val kotlinLibrary = getKotlinLibrary(module)
|
||||
if (kotlinLibrary == null) {
|
||||
ModuleRootModificationUtil.addDependency(module, library, expectedDependencyScope, false)
|
||||
collector.addMessage(library.name + " library was added to module " + module.name)
|
||||
collector.addMessage(KotlinJvmBundle.message("0.library.was.added.to.module.1", library.name.toString(), module.name))
|
||||
} else {
|
||||
val libraryEntry = findLibraryOrderEntry(ModuleRootManager.getInstance(module).orderEntries, kotlinLibrary)
|
||||
if (libraryEntry != null) {
|
||||
@@ -242,8 +243,13 @@ abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinPro
|
||||
libraryEntry.scope = expectedDependencyScope
|
||||
|
||||
collector.addMessage(
|
||||
kotlinLibrary.name + " library scope has changed from " + libraryDependencyScope +
|
||||
" to " + expectedDependencyScope + " for module " + module.name
|
||||
KotlinJvmBundle.message(
|
||||
"0.library.scope.has.changed.from.1.to.2.for.module.3",
|
||||
kotlinLibrary.name.toString(),
|
||||
libraryDependencyScope,
|
||||
expectedDependencyScope,
|
||||
module.name
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -263,13 +269,13 @@ abstract class KotlinWithLibraryConfigurator protected constructor() : KotlinPro
|
||||
}
|
||||
}
|
||||
|
||||
collector.addMessage(library.name!! + " library was created")
|
||||
collector.addMessage(KotlinJvmBundle.message("0.library.was.created", library.name.toString()))
|
||||
return library
|
||||
}
|
||||
|
||||
private fun isProjectLibraryPresent(project: Project): Boolean {
|
||||
val library = getKotlinLibrary(project)
|
||||
return library != null && library.getUrls(OrderRootType.CLASSES).size > 0
|
||||
return library != null && library.getUrls(OrderRootType.CLASSES).isNotEmpty()
|
||||
}
|
||||
|
||||
protected abstract val libraryMatcher: (Library, Project) -> Boolean
|
||||
|
||||
+7
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.intellij.notification.Notification
|
||||
import com.intellij.notification.NotificationType
|
||||
import com.intellij.notification.Notifications
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import java.util.*
|
||||
|
||||
open class NotificationMessageCollector(
|
||||
@@ -37,5 +38,8 @@ open class NotificationMessageCollector(
|
||||
}
|
||||
}
|
||||
|
||||
fun createConfigureKotlinNotificationCollector(project: Project) =
|
||||
NotificationMessageCollector(project, "Configure Kotlin: info notification", "Configure Kotlin")
|
||||
fun createConfigureKotlinNotificationCollector(project: Project): NotificationMessageCollector = NotificationMessageCollector(
|
||||
project,
|
||||
"Configure Kotlin: info notification",
|
||||
KotlinJvmBundle.message("configure.kotlin")
|
||||
)
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.notification.NotificationListener
|
||||
import com.intellij.notification.NotificationType
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.project.Project
|
||||
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
|
||||
@@ -27,7 +28,7 @@ class ConfigureKotlinNotification(
|
||||
excludeModules: List<Module>,
|
||||
val notificationState: ConfigureKotlinNotificationState
|
||||
) : Notification(
|
||||
KotlinConfigurationCheckerComponent.CONFIGURE_NOTIFICATION_GROUP_ID, "Configure Kotlin",
|
||||
KotlinConfigurationCheckerComponent.CONFIGURE_NOTIFICATION_GROUP_ID, KotlinJvmBundle.message("configure.kotlin"),
|
||||
notificationState.notificationString,
|
||||
NotificationType.WARNING,
|
||||
NotificationListener { notification, event ->
|
||||
@@ -69,7 +70,7 @@ class ConfigureKotlinNotification(
|
||||
|
||||
return ConfigureKotlinNotificationState(
|
||||
project.name,
|
||||
"Configure $modulesString in '${project.name}' project<br/> $links",
|
||||
KotlinJvmBundle.message("configure.0.in.1.project.br.2", modulesString, project.name, links),
|
||||
configurableModules.map { it.baseModule.name }
|
||||
)
|
||||
}
|
||||
|
||||
+5
-8
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.intellij.openapi.application.runWriteAction
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacetType
|
||||
import org.jetbrains.kotlin.idea.formatter.*
|
||||
import org.jetbrains.kotlin.idea.util.isDefaultOfficialCodeStyle
|
||||
@@ -55,11 +56,7 @@ fun notifyKotlinStyleUpdateIfNeeded(project: Project) {
|
||||
private class KotlinCodeStyleChangedNotification(val project: Project, isProjectSettings: Boolean) : Notification(
|
||||
KOTLIN_UPDATE_CODE_STYLE_GROUP_ID,
|
||||
"Kotlin Code Style",
|
||||
"""
|
||||
<html>
|
||||
Default code style was updated to Kotlin Coding Conventions.
|
||||
</html>
|
||||
""".trimIndent(),
|
||||
"<html>${KotlinJvmBundle.message("default.code.style.was.updated.to.kotlin.coding.conventions")}</html>",
|
||||
NotificationType.WARNING,
|
||||
null
|
||||
) {
|
||||
@@ -67,7 +64,7 @@ private class KotlinCodeStyleChangedNotification(val project: Project, isProject
|
||||
val ktFormattingSettings = ktCodeStyleSettings(project)
|
||||
|
||||
if (isProjectSettings) {
|
||||
addAction(object : NotificationAction("Apply new code style") {
|
||||
addAction(object : NotificationAction(KotlinJvmBundle.message("apply.new.code.style")) {
|
||||
override fun actionPerformed(e: AnActionEvent, notification: Notification) {
|
||||
notification.expire()
|
||||
|
||||
@@ -81,7 +78,7 @@ private class KotlinCodeStyleChangedNotification(val project: Project, isProject
|
||||
}
|
||||
|
||||
if (ktFormattingSettings != null && ktFormattingSettings.canRestore()) {
|
||||
addAction(object : NotificationAction("Restore old settings") {
|
||||
addAction(object : NotificationAction(KotlinJvmBundle.message("restore.old.settings")) {
|
||||
override fun actionPerformed(e: AnActionEvent, notification: Notification) {
|
||||
notification.expire()
|
||||
|
||||
|
||||
+9
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.intellij.ide.IdeBundle
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.AddCustomLibraryDialog
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.platform.tooling
|
||||
import org.jetbrains.kotlin.platform.IdePlatformKind
|
||||
import org.jetbrains.kotlin.platform.TargetPlatform
|
||||
@@ -59,7 +60,7 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
}
|
||||
|
||||
override fun check(): ValidationResult {
|
||||
val targetPlatform = getPlatform() ?: return ValidationResult("No target platforms selected")
|
||||
val targetPlatform = getPlatform() ?: return ValidationResult(KotlinJvmBundle.message("no.target.platforms.selected"))
|
||||
|
||||
if (checkLibraryIsConfigured(targetPlatform.idePlatformKind)) {
|
||||
val conflictingPlatforms = IdePlatformKind.ALL_KINDS
|
||||
@@ -70,7 +71,12 @@ class FrameworkLibraryValidatorWithDynamicDescription(
|
||||
|
||||
if (conflictingPlatforms.isNotEmpty()) {
|
||||
val platformText = conflictingPlatforms.mapTo(LinkedHashSet()) { it.name }.joinToString()
|
||||
return ValidationResult("Libraries for the following platform are also present in the module dependencies: $platformText")
|
||||
return ValidationResult(
|
||||
KotlinJvmBundle.message(
|
||||
"libraries.for.the.following.platform.are.also.present.in.the.module.dependencies.0",
|
||||
platformText
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return ValidationResult.OK
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.framework
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.libraries.LibraryKind
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
|
||||
class CommonStandardLibraryDescription(project: Project?) : CustomLibraryDescriptorWithDeferredConfig(
|
||||
// TODO: KotlinCommonModuleConfigurator
|
||||
@@ -16,8 +17,8 @@ class CommonStandardLibraryDescription(project: Project?) : CustomLibraryDescrip
|
||||
val KOTLIN_COMMON_STDLIB_KIND = LibraryKind.create("kotlin-stdlib-common")
|
||||
val LIBRARY_NAME = "KotlinStdlibCommon"
|
||||
|
||||
val DIALOG_TITLE = "Create Kotlin Common Standard Library"
|
||||
val LIBRARY_CAPTION = "Kotlin Common Standard Library"
|
||||
val DIALOG_TITLE get() = KotlinJvmBundle.message("create.kotlin.common.standard.library")
|
||||
val LIBRARY_CAPTION get() = KotlinJvmBundle.message("kotlin.common.standard.library")
|
||||
val SUITABLE_LIBRARY_KINDS: Set<LibraryKind> = setOf(KOTLIN_COMMON_STDLIB_KIND)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.framework
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.roots.libraries.NewLibraryConfiguration
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinJsModuleConfigurator
|
||||
|
||||
/**
|
||||
@@ -31,9 +32,9 @@ class JSLibraryStdDescription(project: Project?) : CustomLibraryDescriptorWithDe
|
||||
companion object {
|
||||
val LIBRARY_NAME = "KotlinJavaScript"
|
||||
|
||||
val JAVA_SCRIPT_LIBRARY_CREATION = "JavaScript Library Creation"
|
||||
val DIALOG_TITLE = "Create Kotlin JavaScript Library"
|
||||
val LIBRARY_CAPTION = "Kotlin JavaScript Library"
|
||||
val JAVA_SCRIPT_LIBRARY_CREATION get() = KotlinJvmBundle.message("javascript.library.creation")
|
||||
val DIALOG_TITLE get() = KotlinJvmBundle.message("create.kotlin.javascript.library")
|
||||
val LIBRARY_CAPTION get() = KotlinJvmBundle.message("kotlin.javascript.library")
|
||||
val SUITABLE_LIBRARY_KINDS = setOf(JSLibraryKind)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.util.text.StringUtil
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.KotlinIcons
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import javax.swing.JComponent
|
||||
|
||||
class JSLibraryType : LibraryType<DummyLibraryProperties>(JSLibraryKind) {
|
||||
@@ -66,7 +67,10 @@ class JSLibraryType : LibraryType<DummyLibraryProperties>(JSLibraryKind) {
|
||||
)
|
||||
}
|
||||
|
||||
object JSRootFilter : FileTypeBasedRootFilter(OrderRootType.CLASSES, false, PlainTextFileType.INSTANCE, "JS files") {
|
||||
object JSRootFilter : FileTypeBasedRootFilter(
|
||||
OrderRootType.CLASSES, false, PlainTextFileType.INSTANCE,
|
||||
KotlinJvmBundle.message("js.files")
|
||||
) {
|
||||
override fun isFileAccepted(virtualFile: VirtualFile) = isAcceptedForJsLibrary(virtualFile.extension)
|
||||
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.intellij.openapi.roots.ModifiableModelsProvider
|
||||
import com.intellij.openapi.roots.ModifiableRootModel
|
||||
import com.intellij.openapi.roots.ui.configuration.FacetsProvider
|
||||
import com.intellij.openapi.roots.ui.configuration.libraries.CustomLibraryDescription
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.configuration.BuildSystemType
|
||||
import org.jetbrains.kotlin.idea.configuration.getBuildSystemType
|
||||
import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle
|
||||
@@ -48,7 +49,7 @@ class JavaFrameworkSupportProvider : FrameworkSupportInModuleProvider() {
|
||||
FrameworksCompatibilityUtils.suggestRemoveIncompatibleFramework(
|
||||
rootModel,
|
||||
JSLibraryStdDescription.SUITABLE_LIBRARY_KINDS,
|
||||
"Kotlin/\u200BJS"
|
||||
KotlinJvmBundle.message("kotlin.js")
|
||||
)
|
||||
|
||||
description!!.finishLibConfiguration(module, rootModel, false)
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.framework
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.projectRoots.Sdk
|
||||
import com.intellij.openapi.roots.libraries.LibraryKind
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.Kotlin2JvmCompilerArgumentsHolder
|
||||
import org.jetbrains.kotlin.idea.configuration.KotlinJavaModuleConfigurator
|
||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||
@@ -39,9 +40,9 @@ class JavaRuntimeLibraryDescription(project: Project?) : CustomLibraryDescriptor
|
||||
val KOTLIN_JAVA_RUNTIME_KIND = LibraryKind.create("kotlin-java-runtime")
|
||||
val LIBRARY_NAME = "KotlinJavaRuntime"
|
||||
|
||||
val JAVA_RUNTIME_LIBRARY_CREATION = "Java Runtime Library Creation"
|
||||
val DIALOG_TITLE = "Create Kotlin Java Runtime Library"
|
||||
val LIBRARY_CAPTION = "Kotlin Java Runtime Library"
|
||||
val JAVA_RUNTIME_LIBRARY_CREATION get() = KotlinJvmBundle.message("java.runtime.library.creation")
|
||||
val DIALOG_TITLE get() = KotlinJvmBundle.message("create.kotlin.java.runtime.library")
|
||||
val LIBRARY_CAPTION get() = KotlinJvmBundle.message("kotlin.java.runtime.library")
|
||||
val SUITABLE_LIBRARY_KINDS: Set<LibraryKind> = setOf(KOTLIN_JAVA_RUNTIME_KIND)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.framework
|
||||
@@ -24,6 +13,7 @@ import com.intellij.platform.ProjectTemplate
|
||||
import com.intellij.platform.ProjectTemplatesFactory
|
||||
import com.intellij.platform.templates.BuilderBasedTemplate
|
||||
import org.jetbrains.kotlin.idea.KotlinIcons
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.platform.js.JsPlatforms
|
||||
import org.jetbrains.kotlin.platform.jvm.JvmPlatforms
|
||||
|
||||
@@ -46,7 +36,7 @@ class KotlinTemplatesFactory : ProjectTemplatesFactory() {
|
||||
KotlinModuleBuilder(
|
||||
JvmPlatforms.unspecifiedJvmPlatform,
|
||||
"JVM | IDEA",
|
||||
"Kotlin project with a JVM target based on the IntelliJ IDEA build system",
|
||||
KotlinJvmBundle.message("kotlin.project.with.a.jvm.target.based.on.the.intellij.idea.build.system"),
|
||||
KotlinIcons.SMALL_LOGO
|
||||
)
|
||||
),
|
||||
@@ -54,7 +44,7 @@ class KotlinTemplatesFactory : ProjectTemplatesFactory() {
|
||||
BuilderBasedTemplate(
|
||||
KotlinModuleBuilder(
|
||||
JsPlatforms.defaultJsPlatform, "JS | IDEA",
|
||||
"Kotlin project with a JavaScript target based on the IntelliJ IDEA build system",
|
||||
KotlinJvmBundle.message("kotlin.project.with.a.javascript.target.based.on.the.intellij.idea.build.system"),
|
||||
KotlinIcons.JS
|
||||
)
|
||||
)
|
||||
|
||||
+5
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.intellij.plugins.intelliLang.Configuration
|
||||
import org.intellij.plugins.intelliLang.inject.*
|
||||
import org.intellij.plugins.intelliLang.inject.config.BaseInjection
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.patterns.KotlinPatterns
|
||||
import org.jetbrains.kotlin.idea.util.addAnnotation
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
@@ -73,7 +74,7 @@ class KotlinLanguageInjectionSupport : AbstractLanguageInjectionSupport() {
|
||||
|
||||
TemporaryPlacesRegistry.getInstance(project).removeHostWithUndo(project, psiElement)
|
||||
|
||||
project.executeWriteCommand("remove injection in-code instructions") {
|
||||
project.executeWriteCommand(KotlinJvmBundle.message("remove.injection.in.code.instructions")) {
|
||||
injectInstructions.forEach(PsiElement::delete)
|
||||
}
|
||||
|
||||
@@ -171,7 +172,7 @@ private fun addInjectionInstructionInCode(language: Language, host: PsiLanguageI
|
||||
val modifierListOwner = findElementToInjectWithAnnotation(ktHost)
|
||||
|
||||
if (modifierListOwner != null && canInjectWithAnnotation(ktHost)) {
|
||||
project.executeWriteCommand("Add injection annotation") {
|
||||
project.executeWriteCommand(KotlinJvmBundle.message("add.injection.annotation")) {
|
||||
modifierListOwner.addAnnotation(FqName(AnnotationUtil.LANGUAGE), "\"${language.id}\"")
|
||||
}
|
||||
|
||||
@@ -185,7 +186,7 @@ private fun addInjectionInstructionInCode(language: Language, host: PsiLanguageI
|
||||
val psiFactory = KtPsiFactory(project)
|
||||
val injectComment = psiFactory.createComment("//language=" + language.id)
|
||||
|
||||
project.executeWriteCommand("Add injection comment") {
|
||||
project.executeWriteCommand(KotlinJvmBundle.message("add.injection.comment")) {
|
||||
commentBeforeAnchor.parent.addBefore(injectComment, commentBeforeAnchor)
|
||||
}
|
||||
|
||||
|
||||
+6
-4
@@ -30,6 +30,7 @@ import org.intellij.plugins.intelliLang.Configuration
|
||||
import org.intellij.plugins.intelliLang.inject.*
|
||||
import org.intellij.plugins.intelliLang.inject.config.BaseInjection
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.patterns.KotlinPatterns
|
||||
import org.jetbrains.kotlin.idea.util.addAnnotation
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
@@ -40,7 +41,8 @@ import org.jetbrains.kotlin.psi.psiUtil.endOffset
|
||||
import org.jetbrains.kotlin.psi.psiUtil.siblings
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
|
||||
@NonNls val KOTLIN_SUPPORT_ID = "kotlin"
|
||||
@NonNls
|
||||
val KOTLIN_SUPPORT_ID = "kotlin"
|
||||
|
||||
class KotlinLanguageInjectionSupport : AbstractLanguageInjectionSupport() {
|
||||
override fun getId(): String = KOTLIN_SUPPORT_ID
|
||||
@@ -83,7 +85,7 @@ class KotlinLanguageInjectionSupport : AbstractLanguageInjectionSupport() {
|
||||
|
||||
TemporaryPlacesRegistry.getInstance(project).removeHostWithUndo(project, psiElement)
|
||||
|
||||
project.executeWriteCommand("remove injection in-code instructions") {
|
||||
project.executeWriteCommand(KotlinJvmBundle.message("remove.injection.in.code.instructions")) {
|
||||
injectInstructions.forEach(PsiElement::delete)
|
||||
}
|
||||
|
||||
@@ -182,7 +184,7 @@ private fun addInjectionInstructionInCode(language: Language, host: PsiLanguageI
|
||||
val modifierListOwner = findElementToInjectWithAnnotation(ktHost)
|
||||
|
||||
if (modifierListOwner != null && canInjectWithAnnotation(ktHost)) {
|
||||
project.executeWriteCommand("Add injection annotation") {
|
||||
project.executeWriteCommand(KotlinJvmBundle.message("add.injection.annotation")) {
|
||||
modifierListOwner.addAnnotation(FqName(AnnotationUtil.LANGUAGE), "\"${language.id}\"")
|
||||
}
|
||||
|
||||
@@ -198,7 +200,7 @@ private fun addInjectionInstructionInCode(language: Language, host: PsiLanguageI
|
||||
val psiFactory = KtPsiFactory(project)
|
||||
val injectComment = psiFactory.createComment("//language=" + language.id)
|
||||
|
||||
project.executeWriteCommand("Add injection comment") {
|
||||
project.executeWriteCommand(KotlinJvmBundle.message("add.injection.comment")) {
|
||||
commentBeforeAnchor.parent.addBefore(injectComment, commentBeforeAnchor)
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.ui.EditorNotificationPanel
|
||||
import com.intellij.ui.EditorNotifications
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet
|
||||
import org.jetbrains.kotlin.idea.framework.isGradleModule
|
||||
import org.jetbrains.kotlin.idea.util.findModule
|
||||
@@ -31,7 +32,7 @@ class JavaOutsideModuleDetector(private val project: Project) : EditorNotificati
|
||||
val nonKotlinPath = module.sourceRoots.map { it.path } - facetSettings.pureKotlinSourceFolders
|
||||
if (nonKotlinPath.any { filePath.startsWith(it) }) return null
|
||||
return EditorNotificationPanel().apply {
|
||||
text("This .java file is outside of Java source roots and won't be added to the classpath.")
|
||||
text(KotlinJvmBundle.message("this.java.file.is.outside.of.java.source.roots.and.won.t.be.added.to.the.classpath"))
|
||||
icon(AllIcons.General.Warning)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.intellij.psi.PsiReference
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.caches.resolve.KotlinCacheService
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.idea.highlighter.createSuppressWarningActions
|
||||
import org.jetbrains.kotlin.idea.inspections.api.IncompatibleAPIInspection.Companion.DEFAULT_REASON
|
||||
@@ -97,7 +98,7 @@ class IncompatibleAPIInspection : LocalInspectionTool(), CustomSuppressableInspe
|
||||
|
||||
companion object {
|
||||
const val SHORT_NAME = "IncompatibleAPI"
|
||||
const val DEFAULT_REASON = "Incompatible API"
|
||||
val DEFAULT_REASON get() = KotlinJvmBundle.message("incompatible.api")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.kotlin.codegen.KotlinCodegenFacade
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.*
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.debugger.DebuggerUtils
|
||||
import org.jetbrains.kotlin.idea.project.languageVersionSettings
|
||||
import org.jetbrains.kotlin.idea.project.platform
|
||||
@@ -180,7 +181,7 @@ class KotlinBytecodeToolWindow(private val myProject: Project, private val toolW
|
||||
val optionPanel = JPanel(FlowLayout())
|
||||
add(optionPanel, BorderLayout.NORTH)
|
||||
|
||||
decompile = JButton("Decompile")
|
||||
decompile = JButton(KotlinJvmBundle.message("decompile"))
|
||||
if (KotlinDecompilerService.getInstance() != null) {
|
||||
optionPanel.add(decompile)
|
||||
decompile.addActionListener {
|
||||
@@ -191,7 +192,11 @@ class KotlinBytecodeToolWindow(private val myProject: Project, private val toolW
|
||||
showDecompiledCode(file)
|
||||
} catch (ex: DecompileFailedException) {
|
||||
LOG.info(ex)
|
||||
Messages.showErrorDialog(myProject, "Failed to decompile " + file.name + ": " + ex, "Kotlin Bytecode Decompiler")
|
||||
Messages.showErrorDialog(
|
||||
myProject,
|
||||
KotlinJvmBundle.message("failed.to.decompile.0.1", file.name, ex),
|
||||
KotlinJvmBundle.message("kotlin.bytecode.decompiler")
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -199,11 +204,11 @@ class KotlinBytecodeToolWindow(private val myProject: Project, private val toolW
|
||||
}
|
||||
|
||||
/*TODO: try to extract default parameter from compiler options*/
|
||||
enableInline = JCheckBox("Inline", true)
|
||||
enableOptimization = JCheckBox("Optimization", true)
|
||||
enableAssertions = JCheckBox("Assertions", true)
|
||||
jvm8Target = JCheckBox("JVM 8 target", false)
|
||||
ir = JCheckBox("IR", false)
|
||||
enableInline = JCheckBox(KotlinJvmBundle.message("inline"), true)
|
||||
enableOptimization = JCheckBox(KotlinJvmBundle.message("optimization"), true)
|
||||
enableAssertions = JCheckBox(KotlinJvmBundle.message("assertions"), true)
|
||||
jvm8Target = JCheckBox(KotlinJvmBundle.message("jvm.8.target"), false)
|
||||
ir = JCheckBox(KotlinJvmBundle.message("ir"), false)
|
||||
optionPanel.add(enableInline)
|
||||
optionPanel.add(enableOptimization)
|
||||
optionPanel.add(enableAssertions)
|
||||
@@ -241,7 +246,7 @@ class KotlinBytecodeToolWindow(private val myProject: Project, private val toolW
|
||||
val state: GenerationState
|
||||
try {
|
||||
state = compileSingleFile(ktFile, configuration)
|
||||
?: return BytecodeGenerationResult.Error("Cannot compile ${ktFile.name} to bytecode.")
|
||||
?: return BytecodeGenerationResult.Error(KotlinJvmBundle.message("cannot.compile.0.to.bytecode", ktFile.name))
|
||||
} catch (e: ProcessCanceledException) {
|
||||
throw e
|
||||
} catch (e: Exception) {
|
||||
|
||||
+15
-23
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.internal.makeBackup
|
||||
@@ -32,6 +21,7 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vcs.changes.Change
|
||||
import com.intellij.util.WaitForProgressToShow
|
||||
import com.intellij.util.io.ZipUtil
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
@@ -39,7 +29,7 @@ import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging Kotlin incremental compilation") {
|
||||
class CreateIncrementalCompilationBackup : AnAction(KotlinJvmBundle.message("create.backup.for.debugging.kotlin.incremental.compilation")) {
|
||||
companion object {
|
||||
const val BACKUP_DIR_NAME = ".backup"
|
||||
const val PATCHES_TO_CREATE = 5
|
||||
@@ -50,14 +40,16 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
const val ZIP_FRACTION = 1.0 - PATCHES_FRACTION - LOGS_FRACTION - PROJECT_SYSTEM_FRACTION
|
||||
}
|
||||
|
||||
|
||||
override fun actionPerformed(e: AnActionEvent) {
|
||||
val project = e.project!!
|
||||
val projectBaseDir = File(project.baseDir!!.path)
|
||||
val backupDir = File(FileUtil.createTempDirectory("makeBackup", null), BACKUP_DIR_NAME)
|
||||
|
||||
ProgressManager.getInstance().run(
|
||||
object : Task.Backgroundable(project, "Creating backup for debugging Kotlin incremental compilation", true) {
|
||||
object : Task.Backgroundable(
|
||||
project,
|
||||
KotlinJvmBundle.message("creating.backup.for.debugging.kotlin.incremental.compilation"), true
|
||||
) {
|
||||
override fun run(indicator: ProgressIndicator) {
|
||||
createPatches(backupDir, project, indicator)
|
||||
copyLogs(backupDir, indicator)
|
||||
@@ -94,7 +86,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
if (label != null && label.startsWith(HISTORY_LABEL_PREFIX)) {
|
||||
val patchFile = File(patchesDir, label.removePrefix(HISTORY_LABEL_PREFIX) + ".patch")
|
||||
|
||||
indicator.text = "Creating patch $patchFile"
|
||||
indicator.text = KotlinJvmBundle.message("creating.patch.0", patchFile)
|
||||
indicator.fraction = PATCHES_FRACTION * patchesCreated / PATCHES_TO_CREATE
|
||||
|
||||
val differences = revisions[0].getDifferencesWith(rev)!!
|
||||
@@ -113,7 +105,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
}
|
||||
|
||||
private fun copyLogs(backupDir: File, indicator: ProgressIndicator) {
|
||||
indicator.text = "Copying logs"
|
||||
indicator.text = KotlinJvmBundle.message("copying.logs")
|
||||
indicator.fraction = PATCHES_FRACTION
|
||||
|
||||
val logsDir = File(backupDir, "logs")
|
||||
@@ -123,7 +115,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
}
|
||||
|
||||
private fun copyProjectSystemDir(backupDir: File, project: Project, indicator: ProgressIndicator) {
|
||||
indicator.text = "Copying project's system dir "
|
||||
indicator.text = KotlinJvmBundle.message("copying.project.s.system.dir")
|
||||
indicator.fraction = PATCHES_FRACTION
|
||||
|
||||
val projectSystemDir = File(backupDir, "project-system")
|
||||
@@ -147,7 +139,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
&& !(it.name.startsWith("make_backup_") && it.name.endsWith(".zip"))
|
||||
) {
|
||||
|
||||
indicator.text = "Scanning project dir: $it"
|
||||
indicator.text = KotlinJvmBundle.message("scanning.project.dir.0", it)
|
||||
|
||||
files.add(Pair(it, FileUtil.getRelativePath(dir, it)!!))
|
||||
totalBytes += it.length()
|
||||
@@ -171,7 +163,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
|
||||
zos.use {
|
||||
for ((file, relativePath) in files) {
|
||||
indicator.text = "Adding file to backup: $relativePath"
|
||||
indicator.text = KotlinJvmBundle.message("adding.file.to.backup.0", relativePath)
|
||||
indicator.fraction = PATCHES_FRACTION + LOGS_FRACTION + processedBytes.toDouble() / totalBytes * ZIP_FRACTION
|
||||
|
||||
ZipUtil.addFileToZip(zos, file, relativePath, null, null)
|
||||
@@ -186,8 +178,8 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
{
|
||||
RevealFileAction.showDialog(
|
||||
project,
|
||||
"Successfully created backup " + backupFile.absolutePath,
|
||||
"Created backup",
|
||||
KotlinJvmBundle.message("successfully.created.backup.0", backupFile.absolutePath),
|
||||
KotlinJvmBundle.message("created.backup"),
|
||||
backupFile,
|
||||
null
|
||||
)
|
||||
|
||||
+13
-9
@@ -32,6 +32,7 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vcs.changes.Change
|
||||
import com.intellij.util.WaitForProgressToShow
|
||||
import com.intellij.util.io.ZipUtil
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.util.application.runReadAction
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
@@ -39,7 +40,7 @@ import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging Kotlin incremental compilation") {
|
||||
class CreateIncrementalCompilationBackup : AnAction(KotlinJvmBundle.message("create.backup.for.debugging.kotlin.incremental.compilation")) {
|
||||
companion object {
|
||||
const val BACKUP_DIR_NAME = ".backup"
|
||||
const val PATCHES_TO_CREATE = 5
|
||||
@@ -56,7 +57,10 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
val backupDir = File(FileUtil.createTempDirectory("makeBackup", null), BACKUP_DIR_NAME)
|
||||
|
||||
ProgressManager.getInstance().run(
|
||||
object : Task.Backgroundable(project, "Creating backup for debugging Kotlin incremental compilation", true) {
|
||||
object : Task.Backgroundable(
|
||||
project,
|
||||
KotlinJvmBundle.message("creating.backup.for.debugging.kotlin.incremental.compilation"), true
|
||||
) {
|
||||
override fun run(indicator: ProgressIndicator) {
|
||||
createPatches(backupDir, project, indicator)
|
||||
copyLogs(backupDir, indicator)
|
||||
@@ -93,7 +97,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
if (label != null && label.startsWith(HISTORY_LABEL_PREFIX)) {
|
||||
val patchFile = File(patchesDir, label.removePrefix(HISTORY_LABEL_PREFIX) + ".patch")
|
||||
|
||||
indicator.text = "Creating patch $patchFile"
|
||||
indicator.text = KotlinJvmBundle.message("creating.patch.0", patchFile)
|
||||
indicator.fraction = PATCHES_FRACTION * patchesCreated / PATCHES_TO_CREATE
|
||||
|
||||
val differences = revisions[0].getDifferencesWith(rev)!!
|
||||
@@ -112,7 +116,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
}
|
||||
|
||||
private fun copyLogs(backupDir: File, indicator: ProgressIndicator) {
|
||||
indicator.text = "Copying logs"
|
||||
indicator.text = KotlinJvmBundle.message("copying.logs")
|
||||
indicator.fraction = PATCHES_FRACTION
|
||||
|
||||
val logsDir = File(backupDir, "logs")
|
||||
@@ -122,7 +126,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
}
|
||||
|
||||
private fun copyProjectSystemDir(backupDir: File, project: Project, indicator: ProgressIndicator) {
|
||||
indicator.text = "Copying project's system dir "
|
||||
indicator.text = KotlinJvmBundle.message("copying.project.s.system.dir")
|
||||
indicator.fraction = PATCHES_FRACTION
|
||||
|
||||
val projectSystemDir = File(backupDir, "project-system")
|
||||
@@ -146,7 +150,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
&& !(it.name.startsWith("make_backup_") && it.name.endsWith(".zip"))
|
||||
) {
|
||||
|
||||
indicator.text = "Scanning project dir: $it"
|
||||
indicator.text = KotlinJvmBundle.message("scanning.project.dir.0", it)
|
||||
|
||||
files.add(Pair(it, FileUtil.getRelativePath(dir, it)!!))
|
||||
totalBytes += it.length()
|
||||
@@ -170,7 +174,7 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
|
||||
zos.use {
|
||||
for ((file, relativePath) in files) {
|
||||
indicator.text = "Adding file to backup: $relativePath"
|
||||
indicator.text = KotlinJvmBundle.message("adding.file.to.backup.0", relativePath)
|
||||
indicator.fraction = PATCHES_FRACTION + LOGS_FRACTION + processedBytes.toDouble() / totalBytes * ZIP_FRACTION
|
||||
|
||||
ZipUtil.addFileToZip(zos, file, relativePath, null, null)
|
||||
@@ -185,8 +189,8 @@ class CreateIncrementalCompilationBackup : AnAction("Create backup for debugging
|
||||
{
|
||||
ShowFilePathAction.showDialog(
|
||||
project,
|
||||
"Successfully created backup " + backupFile.absolutePath,
|
||||
"Created backup",
|
||||
KotlinJvmBundle.message("successfully.created.backup.0", backupFile.absolutePath),
|
||||
KotlinJvmBundle.message("created.backup"),
|
||||
backupFile,
|
||||
null
|
||||
)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.config.KotlinFacetSettingsProvider
|
||||
import org.jetbrains.kotlin.config.LanguageFeature
|
||||
import org.jetbrains.kotlin.diagnostics.Diagnostic
|
||||
import org.jetbrains.kotlin.diagnostics.Errors
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.compiler.configuration.KotlinCommonCompilerArgumentsHolder
|
||||
import org.jetbrains.kotlin.idea.configuration.BuildSystemType
|
||||
import org.jetbrains.kotlin.idea.configuration.findApplicableConfigurator
|
||||
@@ -140,9 +141,11 @@ fun askUpdateRuntime(project: Project, requiredVersion: ApiVersion, librariesToU
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode) {
|
||||
val rc = Messages.showOkCancelDialog(
|
||||
project,
|
||||
"This language feature requires version $requiredVersion or later of the Kotlin runtime library. " +
|
||||
"Would you like to update the runtime library in your project?",
|
||||
"Update Runtime Library",
|
||||
KotlinJvmBundle.message(
|
||||
"this.language.feature.requires.version.0.or.later.of.the.kotlin.runtime.library.would.you.like.to.update.the.runtime.library.in.your.project",
|
||||
requiredVersion
|
||||
),
|
||||
KotlinJvmBundle.message("update.runtime.library"),
|
||||
Messages.getQuestionIcon()
|
||||
)
|
||||
if (rc != Messages.OK) return false
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.intellij.psi.PsiElement
|
||||
import com.intellij.refactoring.listeners.RefactoringElementAdapter
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListener
|
||||
import org.jdom.Element
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
||||
import org.jetbrains.kotlin.idea.run.KotlinRunConfiguration
|
||||
import org.jetbrains.kotlin.idea.run.script.standalone.KotlinStandaloneScriptRunConfigurationProducer.Companion.pathFromPsiElement
|
||||
@@ -143,11 +144,11 @@ class KotlinStandaloneScriptRunConfiguration(
|
||||
JavaRunConfigurationExtensionManager.checkConfigurationIsValid(this)
|
||||
|
||||
if (filePath.isNullOrEmpty()) {
|
||||
runtimeConfigurationWarning("File was not specified")
|
||||
runtimeConfigurationWarning(KotlinJvmBundle.message("file.was.not.specified"))
|
||||
}
|
||||
val virtualFile = LocalFileSystem.getInstance().findFileByIoFile(File(filePath))
|
||||
if (virtualFile == null || virtualFile.isDirectory) {
|
||||
runtimeConfigurationWarning("Could not find script file: $filePath")
|
||||
runtimeConfigurationWarning(KotlinJvmBundle.message("could.not.find.script.file.0", filePath.toString()))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -11,11 +11,12 @@ import com.intellij.execution.configurations.SimpleConfigurationType
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.NotNullLazyValue
|
||||
import org.jetbrains.kotlin.idea.KotlinIcons
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
|
||||
class KotlinStandaloneScriptRunConfigurationType : SimpleConfigurationType(
|
||||
"KotlinStandaloneScriptRunConfigurationType",
|
||||
"Kotlin script",
|
||||
"Run Kotlin script",
|
||||
KotlinJvmBundle.message("kotlin.script"),
|
||||
KotlinJvmBundle.message("run.kotlin.script"),
|
||||
NotNullLazyValue.createValue { KotlinIcons.SMALL_LOGO }
|
||||
) {
|
||||
override fun createTemplateConfiguration(project: Project): RunConfiguration {
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.
|
||||
* 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.scratch.actions
|
||||
@@ -21,12 +10,11 @@ import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.keymap.KeymapManager
|
||||
import com.intellij.openapi.keymap.KeymapUtil
|
||||
import com.intellij.openapi.project.DumbService
|
||||
import com.intellij.task.ProjectTaskContext
|
||||
import com.intellij.task.ProjectTaskManager
|
||||
import com.intellij.task.ProjectTaskNotification
|
||||
import com.intellij.task.ProjectTaskResult
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.scratch.*
|
||||
import org.jetbrains.kotlin.idea.scratch.ScratchFile
|
||||
import org.jetbrains.kotlin.idea.scratch.SequentialScratchExecutor
|
||||
import org.jetbrains.kotlin.idea.scratch.getScratchFileFromSelectedEditor
|
||||
import org.jetbrains.kotlin.idea.scratch.printDebugMessage
|
||||
import org.jetbrains.kotlin.idea.scratch.LOG as log
|
||||
|
||||
@@ -63,7 +51,7 @@ class RunScratchAction : ScratchAction(
|
||||
executor.execute()
|
||||
}
|
||||
} catch (ex: Throwable) {
|
||||
executor.errorOccurs("Exception occurs during Run Scratch Action", ex, true)
|
||||
executor.errorOccurs(KotlinJvmBundle.message("exception.occurs.during.run.scratch.action"), ex, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +65,7 @@ class RunScratchAction : ScratchAction(
|
||||
val project = scratchFile.project
|
||||
ProjectTaskManager.getInstance(project).build(module).onSuccess { executionResult ->
|
||||
if (executionResult.isAborted || executionResult.hasErrors()) {
|
||||
executor.errorOccurs("There were compilation errors in module ${module.name}")
|
||||
executor.errorOccurs(KotlinJvmBundle.message("there.were.compilation.errors.in.module.0", module.name))
|
||||
}
|
||||
|
||||
if (DumbService.isDumb(project)) {
|
||||
@@ -102,7 +90,7 @@ class RunScratchAction : ScratchAction(
|
||||
if (e.presentation.isEnabled) {
|
||||
e.presentation.text = templatePresentation.text
|
||||
} else {
|
||||
e.presentation.text = "Other Scratch file execution is in progress"
|
||||
e.presentation.text = KotlinJvmBundle.message("other.scratch.file.execution.is.in.progress")
|
||||
}
|
||||
|
||||
val project = e.project ?: return
|
||||
|
||||
@@ -60,7 +60,7 @@ class RunScratchAction : ScratchAction(
|
||||
executor.execute()
|
||||
}
|
||||
} catch (ex: Throwable) {
|
||||
executor.errorOccurs("Exception occurs during Run Scratch Action", ex, true)
|
||||
executor.errorOccurs(KotlinJvmBundle.message("exception.occurs.during.run.scratch.action"), ex, true)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ class RunScratchAction : ScratchAction(
|
||||
val project = scratchFile.project
|
||||
ProjectTaskManager.getInstance(project).build(arrayOf(module)) { result ->
|
||||
if (result.isAborted || result.errors > 0) {
|
||||
executor.errorOccurs("There were compilation errors in module ${module.name}")
|
||||
executor.errorOccurs(KotlinJvmBundle.message("there.were.compilation.errors.in.module.0", module.name))
|
||||
}
|
||||
|
||||
if (DumbService.isDumb(project)) {
|
||||
@@ -99,7 +99,7 @@ class RunScratchAction : ScratchAction(
|
||||
if (e.presentation.isEnabled) {
|
||||
e.presentation.text = templatePresentation.text
|
||||
} else {
|
||||
e.presentation.text = "Other Scratch file execution is in progress"
|
||||
e.presentation.text = KotlinJvmBundle.message("other.scratch.file.execution.is.in.progress")
|
||||
}
|
||||
|
||||
val project = e.project ?: return
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
* 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.scratch.actions
|
||||
@@ -30,7 +30,7 @@ class RunScratchFromHereAction : ScratchAction(
|
||||
try {
|
||||
executor.executeNew()
|
||||
} catch (ex: Throwable) {
|
||||
executor.errorOccurs("Exception occurs during Run Scratch Action", ex, true)
|
||||
executor.errorOccurs(KotlinJvmBundle.message("exception.occurs.during.run.scratch.action1"), ex, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.
|
||||
* 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.scratch.compile
|
||||
@@ -20,6 +9,7 @@ import com.intellij.execution.process.ProcessOutput
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
import org.jetbrains.kotlin.diagnostics.rendering.DefaultErrorMessages
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.analyzeWithAllCompilerChecks
|
||||
import org.jetbrains.kotlin.idea.refactoring.getLineNumber
|
||||
import org.jetbrains.kotlin.idea.scratch.*
|
||||
@@ -59,14 +49,14 @@ class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
||||
try {
|
||||
AnalyzingUtils.checkForSyntacticErrors(psiFile)
|
||||
} catch (e: IllegalArgumentException) {
|
||||
errorOccurs(e.message ?: "Couldn't compile ${psiFile.name}", isFatal = true)
|
||||
errorOccurs(e.message ?: KotlinJvmBundle.message("couldn.t.compile.0", psiFile.name), isFatal = true)
|
||||
return@runReadAction false
|
||||
}
|
||||
|
||||
val analysisResult = psiFile.analyzeWithAllCompilerChecks()
|
||||
|
||||
if (analysisResult.isError()) {
|
||||
errorOccurs(analysisResult.error.message ?: "Couldn't compile ${psiFile.name}", isFatal = true)
|
||||
errorOccurs(analysisResult.error.message ?: KotlinJvmBundle.message("couldn.t.compile.0", psiFile.name), isFatal = true)
|
||||
return@runReadAction false
|
||||
}
|
||||
|
||||
@@ -139,7 +129,10 @@ class KtCompilingExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
||||
val lineWoPrefix = line.removePrefix(KtScratchSourceFileProcessor.GENERATED_OUTPUT_PREFIX)
|
||||
if (isResultEnd(lineWoPrefix)) {
|
||||
val extractedLineInfo = extractLineInfoFrom(lineWoPrefix)
|
||||
?: return errorOccurs("Couldn't extract line info from line: $lineWoPrefix", isFatal = true)
|
||||
?: return errorOccurs(
|
||||
KotlinJvmBundle.message("couldn.t.extract.line.info.from.line.0", lineWoPrefix),
|
||||
isFatal = true
|
||||
)
|
||||
val (startLine, endLine) = extractedLineInfo
|
||||
val scratchExpression = expressions.findExpression(startLine, endLine)
|
||||
if (scratchExpression == null) {
|
||||
|
||||
+18
-5
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.codegen.KotlinCodegenFacade
|
||||
import org.jetbrains.kotlin.codegen.filterClassFiles
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
||||
import org.jetbrains.kotlin.idea.debugger.DebuggerUtils
|
||||
@@ -46,7 +47,10 @@ class KtScratchExecutionSession(
|
||||
private var backgroundProcessIndicator: ProgressIndicator? = null
|
||||
|
||||
fun execute(callback: () -> Unit) {
|
||||
val psiFile = file.getPsiFile() as? KtFile ?: return executor.errorOccurs("Couldn't find KtFile for current editor", isFatal = true)
|
||||
val psiFile = file.getPsiFile() as? KtFile ?: return executor.errorOccurs(
|
||||
KotlinJvmBundle.message("couldn.t.find.ktfile.for.current.editor"),
|
||||
isFatal = true
|
||||
)
|
||||
|
||||
val expressions = file.getExpressions()
|
||||
if (!executor.checkForErrors(psiFile, expressions)) return
|
||||
@@ -58,7 +62,7 @@ class KtScratchExecutionSession(
|
||||
is KtScratchSourceFileProcessor.Result.OK -> {
|
||||
LOG.printDebugMessage("After processing by KtScratchSourceFileProcessor:\n ${result.code}")
|
||||
|
||||
object : Task.Backgroundable(psiFile.project, "Running Kotlin Scratch...", true) {
|
||||
object : Task.Backgroundable(psiFile.project, KotlinJvmBundle.message("running.kotlin.scratch"), true) {
|
||||
override fun run(indicator: ProgressIndicator) {
|
||||
backgroundProcessIndicator = indicator
|
||||
|
||||
@@ -72,7 +76,11 @@ class KtScratchExecutionSession(
|
||||
if (e is ControlFlowException) throw e
|
||||
|
||||
LOG.printDebugMessage(result.code)
|
||||
executor.errorOccurs(e.message ?: "Couldn't compile ${psiFile.name}", e, isFatal = true)
|
||||
executor.errorOccurs(
|
||||
e.message ?: KotlinJvmBundle.message("couldn.t.compile.0", psiFile.name),
|
||||
e,
|
||||
isFatal = true
|
||||
)
|
||||
}
|
||||
}
|
||||
}.queue()
|
||||
@@ -107,7 +115,12 @@ class KtScratchExecutionSession(
|
||||
val executionResult = processHandler.runProcessWithProgressIndicator(indicator, TIMEOUT_MS)
|
||||
when {
|
||||
executionResult.isTimeout -> {
|
||||
executor.errorOccurs("Couldn't get scratch execution result - stopped by timeout ($TIMEOUT_MS ms)")
|
||||
executor.errorOccurs(
|
||||
KotlinJvmBundle.message(
|
||||
"couldn.t.get.scratch.execution.result.stopped.by.timeout.0.ms",
|
||||
TIMEOUT_MS
|
||||
)
|
||||
)
|
||||
}
|
||||
executionResult.isCancelled -> {
|
||||
// ignore
|
||||
|
||||
+10
-4
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.codegen.KotlinCodegenFacade
|
||||
import org.jetbrains.kotlin.codegen.filterClassFiles
|
||||
import org.jetbrains.kotlin.codegen.state.GenerationState
|
||||
import org.jetbrains.kotlin.config.CompilerConfiguration
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.getResolutionFacade
|
||||
import org.jetbrains.kotlin.idea.core.script.ScriptConfigurationManager
|
||||
import org.jetbrains.kotlin.idea.debugger.DebuggerUtils
|
||||
@@ -42,7 +43,7 @@ class KtScratchExecutionSession(
|
||||
private var backgroundProcessIndicator: ProgressIndicator? = null
|
||||
|
||||
fun execute(callback: () -> Unit) {
|
||||
val psiFile = file.getPsiFile() as? KtFile ?: return executor.errorOccurs("Couldn't find KtFile for current editor", isFatal = true)
|
||||
val psiFile = file.getPsiFile() as? KtFile ?: return executor.errorOccurs(KotlinJvmBundle.message("couldn.t.find.ktfile.for.current.editor"), isFatal = true)
|
||||
|
||||
val expressions = file.getExpressions()
|
||||
if (!executor.checkForErrors(psiFile, expressions)) return
|
||||
@@ -52,7 +53,7 @@ class KtScratchExecutionSession(
|
||||
is KtScratchSourceFileProcessor.Result.OK -> {
|
||||
LOG.printDebugMessage("After processing by KtScratchSourceFileProcessor:\n ${result.code}")
|
||||
|
||||
object : Task.Backgroundable(psiFile.project, "Running Kotlin Scratch...", true) {
|
||||
object : Task.Backgroundable(psiFile.project, KotlinJvmBundle.message("running.kotlin.scratch"), true) {
|
||||
override fun run(indicator: ProgressIndicator) {
|
||||
backgroundProcessIndicator = indicator
|
||||
|
||||
@@ -76,7 +77,12 @@ class KtScratchExecutionSession(
|
||||
val executionResult = processHandler.runProcessWithProgressIndicator(indicator, TIMEOUT_MS)
|
||||
when {
|
||||
executionResult.isTimeout -> {
|
||||
executor.errorOccurs("Couldn't get scratch execution result - stopped by timeout ($TIMEOUT_MS ms)")
|
||||
executor.errorOccurs(
|
||||
KotlinJvmBundle.message(
|
||||
"couldn.t.get.scratch.execution.result.stopped.by.timeout.0.ms",
|
||||
TIMEOUT_MS
|
||||
)
|
||||
)
|
||||
}
|
||||
executionResult.isCancelled -> {
|
||||
// ignore
|
||||
@@ -93,7 +99,7 @@ class KtScratchExecutionSession(
|
||||
if (e is ControlFlowException) throw e
|
||||
|
||||
LOG.printDebugMessage(result.code)
|
||||
executor.errorOccurs(e.message ?: "Couldn't compile ${psiFile.name}", e, isFatal = true)
|
||||
executor.errorOccurs(e.message ?: KotlinJvmBundle.message("couldn.t.compile.0", psiFile.name), e, isFatal = true)
|
||||
}
|
||||
}
|
||||
}.queue()
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.
|
||||
* 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.scratch.repl
|
||||
@@ -28,6 +17,7 @@ import org.jetbrains.kotlin.cli.common.repl.replRemoveLineBreaksInTheEnd
|
||||
import org.jetbrains.kotlin.cli.common.repl.replUnescapeLineBreaks
|
||||
import org.jetbrains.kotlin.console.KotlinConsoleKeeper
|
||||
import org.jetbrains.kotlin.console.actions.logError
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.scratch.*
|
||||
import org.jetbrains.kotlin.idea.scratch.output.ScratchOutput
|
||||
import org.jetbrains.kotlin.idea.scratch.output.ScratchOutputType
|
||||
@@ -68,7 +58,7 @@ class KtScratchReplExecutor(file: ScratchFile) : SequentialScratchExecutor(file)
|
||||
}
|
||||
sendCommandToProcess(":quit")
|
||||
} catch (e: Exception) {
|
||||
errorOccurs("Couldn't stop REPL process", e, false)
|
||||
errorOccurs(KotlinJvmBundle.message("couldn.t.stop.repl.process"), e, false)
|
||||
|
||||
processHandler.destroyProcess()
|
||||
clearState()
|
||||
@@ -90,7 +80,7 @@ class KtScratchReplExecutor(file: ScratchFile) : SequentialScratchExecutor(file)
|
||||
try {
|
||||
sendCommandToProcess(expression.element.text)
|
||||
} catch (e: Throwable) {
|
||||
errorOccurs("Couldn't execute statement: ${expression.element.text}", e, true)
|
||||
errorOccurs(KotlinJvmBundle.message("couldn.t.execute.statement.0", expression.element.text), e, true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.vcs.ui.RefreshableOnComponent
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.ui.NonFocusableCheckBox
|
||||
import com.intellij.util.PairConsumer
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.psi.NotNullableUserDataProperty
|
||||
import java.awt.GridLayout
|
||||
import java.io.File
|
||||
@@ -32,7 +33,10 @@ import javax.swing.JPanel
|
||||
private val BUNCH_PLUGIN_ID = PluginId.getId("org.jetbrains.bunch.tool.idea.plugin")
|
||||
|
||||
private var Project.bunchFileCheckEnabled: Boolean
|
||||
by NotNullableUserDataProperty(Key.create("IS_BUNCH_FILE_CHECK_ENABLED_KOTLIN"), !PluginManagerCore.isPluginInstalled(BUNCH_PLUGIN_ID))
|
||||
by NotNullableUserDataProperty(
|
||||
Key.create("IS_BUNCH_FILE_CHECK_ENABLED_KOTLIN"),
|
||||
!PluginManagerCore.isPluginInstalled(BUNCH_PLUGIN_ID)
|
||||
)
|
||||
|
||||
class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() {
|
||||
override fun createHandler(panel: CheckinProjectPanel, commitContext: CommitContext): CheckinHandler {
|
||||
@@ -46,7 +50,7 @@ class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() {
|
||||
if (PluginManagerCore.isPluginInstalled(BUNCH_PLUGIN_ID)) return null
|
||||
BunchFileUtils.bunchFile(project) ?: return null
|
||||
|
||||
val bunchFilesCheckBox = NonFocusableCheckBox(replaceMnemonicAmpersand("Check &bunch files"))
|
||||
val bunchFilesCheckBox = NonFocusableCheckBox(replaceMnemonicAmpersand(KotlinJvmBundle.message("check.bunch.files")))
|
||||
return object : RefreshableOnComponent {
|
||||
override fun getComponent(): JComponent {
|
||||
val panel = JPanel(GridLayout(1, 0))
|
||||
@@ -98,8 +102,13 @@ class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() {
|
||||
|
||||
when (Messages.showYesNoCancelDialog(
|
||||
project,
|
||||
"Several bunch files haven't been updated:\n\n${filePaths.joinToString("\n")}\n\nDo you want to review them before commit?",
|
||||
"Forgotten Bunch Files", "Review", "Commit", CommonBundle.getCancelButtonText(), Messages.getWarningIcon()
|
||||
KotlinJvmBundle.message(
|
||||
"several.bunch.files.haven.t.been.updated.0.do.you.want.to.review.them.before.commit",
|
||||
filePaths.joinToString("\n")
|
||||
),
|
||||
KotlinJvmBundle.message("forgotten.bunch.files"),
|
||||
KotlinJvmBundle.message("review"),
|
||||
KotlinJvmBundle.message("commit"), CommonBundle.getCancelButtonText(), Messages.getWarningIcon()
|
||||
)) {
|
||||
YES -> {
|
||||
return ReturnResult.CLOSE_WINDOW
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.intellij.openapi.vcs.ui.RefreshableOnComponent
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.ui.NonFocusableCheckBox
|
||||
import com.intellij.util.PairConsumer
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.psi.NotNullableUserDataProperty
|
||||
import java.awt.GridLayout
|
||||
import java.io.File
|
||||
@@ -46,7 +47,7 @@ class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() {
|
||||
if (PluginManager.isPluginInstalled(BUNCH_PLUGIN_ID)) return null
|
||||
BunchFileUtils.bunchFile(project) ?: return null
|
||||
|
||||
val bunchFilesCheckBox = NonFocusableCheckBox(replaceMnemonicAmpersand("Check &bunch files"))
|
||||
val bunchFilesCheckBox = NonFocusableCheckBox(replaceMnemonicAmpersand(KotlinJvmBundle.message("check.bunch.files")))
|
||||
return object : RefreshableOnComponent {
|
||||
override fun getComponent(): JComponent {
|
||||
val panel = JPanel(GridLayout(1, 0))
|
||||
@@ -98,8 +99,13 @@ class BunchFileCheckInHandlerFactory : CheckinHandlerFactory() {
|
||||
|
||||
when (Messages.showYesNoCancelDialog(
|
||||
project,
|
||||
"Several bunch files haven't been updated:\n\n${filePaths.joinToString("\n")}\n\nDo you want to review them before commit?",
|
||||
"Forgotten Bunch Files", "Review", "Commit", CommonBundle.getCancelButtonText(), Messages.getWarningIcon()
|
||||
KotlinJvmBundle.message(
|
||||
"several.bunch.files.haven.t.been.updated.0.do.you.want.to.review.them.before.commit",
|
||||
filePaths.joinToString("\n")
|
||||
),
|
||||
KotlinJvmBundle.message("forgotten.bunch.files"),
|
||||
KotlinJvmBundle.message("review"),
|
||||
KotlinJvmBundle.message("commit"), CommonBundle.getCancelButtonText(), Messages.getWarningIcon()
|
||||
)) {
|
||||
YES -> {
|
||||
return ReturnResult.CLOSE_WINDOW
|
||||
|
||||
+11
-7
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.JarFileSystem
|
||||
import com.intellij.openapi.vfs.LocalFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinJvmBundle
|
||||
import org.jetbrains.kotlin.idea.configuration.*
|
||||
import org.jetbrains.kotlin.idea.framework.JavaRuntimeDetectionUtil
|
||||
import org.jetbrains.kotlin.idea.framework.isExternalLibrary
|
||||
@@ -25,9 +26,8 @@ fun updateLibraries(project: Project, libraries: Collection<Library>) {
|
||||
if (project.allModules().any { module -> module.getBuildSystemType() != BuildSystemType.JPS }) {
|
||||
Messages.showMessageDialog(
|
||||
project,
|
||||
"Automatic library version update for Maven and Gradle projects is currently unsupported. " +
|
||||
"Please update your build scripts manually.",
|
||||
"Update Kotlin Runtime Library",
|
||||
KotlinJvmBundle.message("automatic.library.version.update.for.maven.and.gradle.projects.is.currently.unsupported.please.update.your.build.scripts.manually"),
|
||||
KotlinJvmBundle.message("update.kotlin.runtime.library"),
|
||||
Messages.getErrorIcon()
|
||||
)
|
||||
return
|
||||
@@ -93,8 +93,8 @@ private fun updateJar(
|
||||
} catch (e: IOException) {
|
||||
Messages.showErrorDialog(
|
||||
project,
|
||||
"Failed to update $jarPath: ${e.message}",
|
||||
"Library update failed"
|
||||
KotlinJvmBundle.message("failed.to.update.0.1", jarPath, e.message.toString()),
|
||||
KotlinJvmBundle.message("library.update.failed")
|
||||
)
|
||||
return
|
||||
}
|
||||
@@ -106,7 +106,11 @@ private fun updateJar(
|
||||
model.removeRoot(oldUrl, libraryJarDescriptor.orderRootType)
|
||||
|
||||
val newRoot = JarFileSystem.getInstance().getJarRootForLocalFile(newVFile) ?: run {
|
||||
Messages.showErrorDialog(project, "Failed to find root for file: ${newVFile.canonicalPath}", "Library update failed")
|
||||
Messages.showErrorDialog(
|
||||
project,
|
||||
KotlinJvmBundle.message("failed.to.find.root.for.file.0", newVFile.canonicalPath.toString()),
|
||||
KotlinJvmBundle.message("library.update.failed1")
|
||||
)
|
||||
return@runWriteAction
|
||||
}
|
||||
|
||||
|
||||
+40
-29
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
@@ -29,17 +29,13 @@ import com.intellij.ui.EditorNotificationPanel
|
||||
import com.intellij.ui.EditorNotifications
|
||||
import com.intellij.ui.HyperlinkAdapter
|
||||
import com.intellij.ui.HyperlinkLabel
|
||||
import org.jetbrains.kotlin.idea.KotlinFileType
|
||||
import org.jetbrains.kotlin.idea.KotlinPluginUpdater
|
||||
import org.jetbrains.kotlin.idea.KotlinPluginUtil
|
||||
import org.jetbrains.kotlin.idea.PluginUpdateStatus
|
||||
import org.jetbrains.kotlin.idea.*
|
||||
import org.jetbrains.kotlin.idea.project.TargetPlatformDetector
|
||||
import org.jetbrains.kotlin.metadata.deserialization.BinaryVersion
|
||||
import org.jetbrains.kotlin.platform.js.isJs
|
||||
import org.jetbrains.kotlin.platform.jvm.isJvm
|
||||
import java.awt.event.ComponentAdapter
|
||||
import java.awt.event.ComponentEvent
|
||||
import java.text.MessageFormat
|
||||
import java.util.*
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JLabel
|
||||
@@ -67,10 +63,8 @@ class UnsupportedAbiVersionNotificationPanelProvider(private val project: Projec
|
||||
val badRootsInRuntimeLibraries = findBadRootsInRuntimeLibraries(badRuntimeLibraries, badVersionedRoots)
|
||||
val otherBadRootsCount = badVersionedRoots.size - badRootsInRuntimeLibraries.size
|
||||
|
||||
val text = MessageFormat.format(
|
||||
"<html><b>{0,choice,0#|1#|1<Some }Kotlin runtime librar{0,choice,0#|1#y|1<ies}</b>" +
|
||||
"{1,choice,0#|1# and one other jar|1< and {1} other jars} " +
|
||||
"{1,choice,0#has|0<have} an unsupported binary format.</html>",
|
||||
val text = KotlinJvmBundle.message(
|
||||
"html.b.0.choice.0.1.1.some.kotlin.runtime.librar.0.choice.0.1.y.1.ies.b.1.choice.0.1.and.one.other.jar.1.and.1.other.jars.1.choice.0.has.0.have.an.unsupported.binary.format.html",
|
||||
badRuntimeLibraries.size,
|
||||
otherBadRootsCount
|
||||
)
|
||||
@@ -85,15 +79,16 @@ class UnsupportedAbiVersionNotificationPanelProvider(private val project: Projec
|
||||
val isPluginNewForAllRuntimeLibraries = badRootsInRuntimeLibraries.all { it.supportedVersion > it.version }
|
||||
|
||||
val updateAction = when {
|
||||
isPluginNewForAllRuntimeLibraries -> "Update"
|
||||
isPluginOldForAllRuntimeLibraries -> "Downgrade"
|
||||
else -> "Replace"
|
||||
isPluginNewForAllRuntimeLibraries -> KotlinJvmBundle.message("update")
|
||||
isPluginOldForAllRuntimeLibraries -> KotlinJvmBundle.message("downgrade")
|
||||
else -> KotlinJvmBundle.message("replace")
|
||||
}
|
||||
|
||||
val actionLabelText = MessageFormat.format(
|
||||
"$updateAction {0,choice,0#|1#|1<all }Kotlin runtime librar{0,choice,0#|1#y|1<ies} ",
|
||||
val actionLabelText = "$updateAction " + KotlinJvmBundle.message(
|
||||
"0.choice.0.1.1.all.kotlin.runtime.librar.0.choice.0.1.y.1.ies",
|
||||
badRuntimeLibraries.size
|
||||
)
|
||||
|
||||
answer.createActionLabel(actionLabelText) {
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
updateLibraries(project, badRuntimeLibraries)
|
||||
@@ -107,41 +102,54 @@ class UnsupportedAbiVersionNotificationPanelProvider(private val project: Projec
|
||||
|
||||
when {
|
||||
isPluginOldForAllRoots -> {
|
||||
answer.setText("<html>Kotlin library <b>'$presentableName'</b> was compiled with a newer Kotlin compiler and can't be read. Please update Kotlin plugin.</html>")
|
||||
answer.setText(
|
||||
KotlinJvmBundle.message(
|
||||
"html.kotlin.library.b.0.b.was.compiled.with.a.newer.kotlin.compiler.and.can.t.be.read.please.update.kotlin.plugin.html",
|
||||
presentableName
|
||||
)
|
||||
)
|
||||
createUpdatePluginLink(answer)
|
||||
}
|
||||
|
||||
isPluginNewForAllRoots ->
|
||||
answer.setText("<html>Kotlin library <b>'$presentableName'</b> has outdated binary format and can't be read by current plugin. Please update the library.</html>")
|
||||
answer.setText(
|
||||
KotlinJvmBundle.message(
|
||||
"html.kotlin.library.b.0.b.has.outdated.binary.format.and.can.t.be.read.by.current.plugin.please.update.the.library.html",
|
||||
presentableName
|
||||
)
|
||||
)
|
||||
|
||||
else -> {
|
||||
throw IllegalStateException("Bad root with compatible version found: $badVersionedRoot")
|
||||
}
|
||||
}
|
||||
|
||||
answer.createActionLabel("Go to $presentableName") { navigateToLibraryRoot(project, badVersionedRoot.file) }
|
||||
answer.createActionLabel(KotlinJvmBundle.message("go.to.0", presentableName)) {
|
||||
navigateToLibraryRoot(
|
||||
project,
|
||||
badVersionedRoot.file
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
isPluginOldForAllRoots -> {
|
||||
answer.setText(
|
||||
"Some Kotlin libraries attached to this project were compiled with a newer Kotlin compiler and can't be read. " +
|
||||
"Please update Kotlin plugin."
|
||||
KotlinJvmBundle.message("some.kotlin.libraries.attached.to.this.project.were.compiled.with.a.newer.kotlin.compiler.and.can.t.be.read.please.update.kotlin.plugin")
|
||||
)
|
||||
createUpdatePluginLink(answer)
|
||||
}
|
||||
|
||||
isPluginNewForAllRoots ->
|
||||
answer.setText(
|
||||
"Some Kotlin libraries attached to this project have outdated binary format and can't be read by current plugin. " +
|
||||
"Please update found libraries."
|
||||
KotlinJvmBundle.message("some.kotlin.libraries.attached.to.this.project.have.outdated.binary.format.and.can.t.be.read.by.current.plugin.please.update.found.libraries")
|
||||
)
|
||||
|
||||
else ->
|
||||
answer.setText("Some Kotlin libraries attached to this project have unsupported binary format. Please update the libraries or the plugin.")
|
||||
answer.setText(KotlinJvmBundle.message("some.kotlin.libraries.attached.to.this.project.have.unsupported.binary.format.please.update.the.libraries.or.the.plugin"))
|
||||
|
||||
}
|
||||
|
||||
createShowPathsActionLabel(module, answer, "Details")
|
||||
createShowPathsActionLabel(module, answer, KotlinJvmBundle.message("details"))
|
||||
|
||||
return answer
|
||||
}
|
||||
@@ -153,7 +161,7 @@ class UnsupportedAbiVersionNotificationPanelProvider(private val project: Projec
|
||||
assert(!badRoots.isEmpty()) { "This action should only be called when bad roots are present" }
|
||||
|
||||
val listPopupModel = LibraryRootsPopupModel(
|
||||
"Unsupported format, plugin version: " + KotlinPluginUtil.getPluginVersion(),
|
||||
KotlinJvmBundle.message("unsupported.format.plugin.version.0", KotlinPluginUtil.getPluginVersion()),
|
||||
project,
|
||||
badRoots
|
||||
)
|
||||
@@ -162,12 +170,15 @@ class UnsupportedAbiVersionNotificationPanelProvider(private val project: Projec
|
||||
|
||||
null
|
||||
}
|
||||
DumbService.getInstance(project).tryRunReadActionInSmartMode(task, "Can't show all paths during index update")
|
||||
DumbService.getInstance(project).tryRunReadActionInSmartMode(
|
||||
task,
|
||||
KotlinJvmBundle.message("can.t.show.all.paths.during.index.update")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun createUpdatePluginLink(answer: ErrorNotificationPanel) {
|
||||
answer.createProgressAction(" Check...", "Update plugin") { link, updateLink ->
|
||||
answer.createProgressAction(KotlinJvmBundle.message("check"), KotlinJvmBundle.message("update.plugin")) { link, updateLink ->
|
||||
KotlinPluginUpdater.getInstance().runCachedUpdate { pluginUpdateStatus ->
|
||||
when (pluginUpdateStatus) {
|
||||
is PluginUpdateStatus.Update -> {
|
||||
@@ -181,7 +192,7 @@ class UnsupportedAbiVersionNotificationPanelProvider(private val project: Projec
|
||||
})
|
||||
}
|
||||
is PluginUpdateStatus.LatestVersionInstalled -> {
|
||||
link.text = "No updates found"
|
||||
link.text = KotlinJvmBundle.message("no.updates.found")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,7 +269,7 @@ class UnsupportedAbiVersionNotificationPanelProvider(private val project: Projec
|
||||
|
||||
override fun getTextFor(root: BinaryVersionedFile<BinaryVersion>): String {
|
||||
val relativePath = VfsUtilCore.getRelativePath(root.file, project.baseDir, '/')
|
||||
return "${relativePath ?: root.file.path} (${root.version}) - expected: ${root.supportedVersion}"
|
||||
return KotlinJvmBundle.message("0.1.expected.2", relativePath ?: root.file.path, root.version, root.supportedVersion)
|
||||
}
|
||||
|
||||
override fun getIconFor(aValue: BinaryVersionedFile<BinaryVersion>): Icon? {
|
||||
|
||||
Reference in New Issue
Block a user