i18n: update bundle for idea
This commit is contained in:
@@ -1821,4 +1821,56 @@ expression=Expression
|
||||
statement=Statement
|
||||
class=Class
|
||||
object.declaration=Object declaration
|
||||
top.level=Top-level
|
||||
top.level=Top-level
|
||||
analyse.modules.with.different.platforms.together=Analyse modules with different platforms together
|
||||
toggle.composite.analysis.mode.for.multiplatform=Toggle composite analysis mode for multiplatform
|
||||
rethrow.stored.pce.as.a.new.runtime.exception=Rethrow stored PCE as a new runtime exception
|
||||
internal.toggle.throwing.cached.pce=Internal: toggle throwing cached PCE
|
||||
minimal.line.count=Minimal line count
|
||||
files.to.visit=Files to visit
|
||||
random.seed=Random seed
|
||||
number.of.attempts.then.files.in.project.0=Number of attempts > then files in project, {0}
|
||||
text.done=Done
|
||||
file.lines=File lines
|
||||
max.functions.to.visit=Max functions to visit
|
||||
move.refactoring.testing=Move refactoring testing
|
||||
compiling.project=Compiling project...
|
||||
saving.files=Saving files...
|
||||
perform.refactoring=Perform refactoring ...
|
||||
update.indices=Update indices...
|
||||
reset.files=Reset files...
|
||||
cannot.get.or.create.results.file=Cannot get or create results file
|
||||
cannot.get.project.root.directory=Cannot get project root directory
|
||||
0.try.1.with.2.fails.and.3.verifications={0} [Try {1} with {2} fails and {3} verifications]
|
||||
test.result.log.file.will.be.placed.here=Test result log file will be placed here
|
||||
maximum.count.of.applied.refactoring.before.validity.check=Maximum count of applied refactoring before validity check
|
||||
move.refactoring.test=Move refactoring test
|
||||
resolve.pasted.references=resolve pasted references
|
||||
create.kotlin.file=Create Kotlin file
|
||||
type.alias.0=Type alias "{0}"
|
||||
type.parameter.0=Type parameter "{0}"
|
||||
parameter.0=Parameter "{0}"
|
||||
property.0=Property "{0}"
|
||||
function.01=Function "{0}"
|
||||
object.0=Object "{0}"
|
||||
interface=Interface
|
||||
constructor=Constructor
|
||||
implicit.nothing.type=Implicit `Nothing?` type
|
||||
move.suspicious.callable.reference.into.parentheses=Move suspicious callable reference into parentheses '()'
|
||||
local.variable=Local variable
|
||||
const.property=Const property
|
||||
private.property=Private property
|
||||
object.or.top.level.property=Object or top-level property
|
||||
property=Property
|
||||
test.function=Test function
|
||||
function=Function
|
||||
enum.entry=Enum entry
|
||||
create.subclass=Create subclass
|
||||
implement.sealed.class=Implement sealed class
|
||||
implement.abstract.class=Implement abstract class
|
||||
implement.interface=Implement interface
|
||||
implement.abstract.function=Implement abstract function
|
||||
implement.abstract.property=Implement abstract property
|
||||
replace.explicit.lambda.parameter.with.it=Replace explicit lambda parameter with 'it'
|
||||
create.test=Create test
|
||||
convert.class.0.to.kotlin=Convert class ''{0}'' to Kotlin
|
||||
+6
-1
@@ -7,12 +7,17 @@ package org.jetbrains.kotlin.idea.actions.internal
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.ToggleAction
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.project.KotlinMultiplatformAnalysisModeComponent
|
||||
import org.jetbrains.kotlin.idea.project.KotlinMultiplatformAnalysisModeComponent.Mode
|
||||
import org.jetbrains.kotlin.idea.project.useCompositeAnalysis
|
||||
|
||||
class MultiplatformCompositeAnalysisToggleAction :
|
||||
ToggleAction("Toggle composite analysis mode for multiplatform", "Analyse modules with different platforms together", null) {
|
||||
ToggleAction(
|
||||
KotlinBundle.message("toggle.composite.analysis.mode.for.multiplatform"),
|
||||
KotlinBundle.message("analyse.modules.with.different.platforms.together"),
|
||||
null
|
||||
) {
|
||||
|
||||
override fun isSelected(e: AnActionEvent): Boolean = e.project?.useCompositeAnalysis == true
|
||||
|
||||
|
||||
+6
-1
@@ -19,11 +19,16 @@ package org.jetbrains.kotlin.idea.actions.internal
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||
import com.intellij.openapi.actionSystem.ToggleAction
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.utils.WrappedValues
|
||||
|
||||
|
||||
class StoredExceptionsThrowToggleAction :
|
||||
ToggleAction("Internal: toggle throwing cached PCE", "Rethrow stored PCE as a new runtime exception", null) {
|
||||
ToggleAction(
|
||||
KotlinBundle.message("internal.toggle.throwing.cached.pce"),
|
||||
KotlinBundle.message("rethrow.stored.pce.as.a.new.runtime.exception"),
|
||||
null
|
||||
) {
|
||||
override fun isSelected(e: AnActionEvent): Boolean {
|
||||
return WrappedValues.throwWrappedProcessCanceledException
|
||||
}
|
||||
|
||||
+9
-5
@@ -36,6 +36,7 @@ import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.addBoxWithLabel
|
||||
import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.collectSuitableKotlinFiles
|
||||
import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.shuffledSequence
|
||||
@@ -59,7 +60,10 @@ class HighlightingBenchmarkAction : AnAction() {
|
||||
val ktFiles = collectSuitableKotlinFiles(project) { it.getLineCount() >= settings.lines }
|
||||
|
||||
if (ktFiles.size < settings.files) {
|
||||
AbstractCompletionBenchmarkAction.showPopup(project, "Number of attempts > then files in project, ${ktFiles.size}")
|
||||
AbstractCompletionBenchmarkAction.showPopup(
|
||||
project,
|
||||
KotlinBundle.message("number.of.attempts.then.files.in.project.0", ktFiles.size)
|
||||
)
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -122,9 +126,9 @@ class HighlightingBenchmarkAction : AnAction() {
|
||||
|
||||
val jPanel = JBPanel<JBPanel<*>>(GridLayoutManager(3, 2)).apply {
|
||||
var i = 0
|
||||
cSeed = addBoxWithLabel("Random seed", default = "0", i = i++)
|
||||
cFiles = addBoxWithLabel("Files to visit", default = "20", i = i++)
|
||||
cLines = addBoxWithLabel("Minimal line count", default = "100", i = i)
|
||||
cSeed = addBoxWithLabel(KotlinBundle.message("random.seed"), default = "0", i = i++)
|
||||
cFiles = addBoxWithLabel(KotlinBundle.message("files.to.visit"), default = "20", i = i++)
|
||||
cLines = addBoxWithLabel(KotlinBundle.message("minimal.line.count"), default = "100", i = i)
|
||||
}
|
||||
dialogBuilder.centerPanel(jPanel)
|
||||
if (!dialogBuilder.showAndGet()) return null
|
||||
@@ -211,7 +215,7 @@ class HighlightingBenchmarkAction : AnAction() {
|
||||
}
|
||||
})
|
||||
}
|
||||
AbstractCompletionBenchmarkAction.showPopup(project, "Done")
|
||||
AbstractCompletionBenchmarkAction.showPopup(project, KotlinBundle.message("text.done"))
|
||||
}
|
||||
|
||||
override fun update(e: AnActionEvent) {
|
||||
|
||||
+6
-5
@@ -21,6 +21,7 @@ import com.intellij.openapi.ui.DialogBuilder
|
||||
import com.intellij.ui.components.JBPanel
|
||||
import com.intellij.ui.components.JBTextField
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.randomElement
|
||||
import org.jetbrains.kotlin.idea.completion.CompletionBenchmarkSink
|
||||
import org.jetbrains.kotlin.idea.core.util.getLineCount
|
||||
@@ -49,7 +50,7 @@ class LocalCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() {
|
||||
}
|
||||
|
||||
if (ktFiles.size < settings.files) {
|
||||
showPopup(project, "Number of attempts > then files in project, ${ktFiles.size}")
|
||||
showPopup(project, KotlinBundle.message("number.of.attempts.then.files.in.project.0", ktFiles.size))
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -79,10 +80,10 @@ class LocalCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() {
|
||||
val jPanel = JBPanel<JBPanel<*>>(GridLayoutManager(4, 2)).apply {
|
||||
var i = 0
|
||||
|
||||
cSeed = addBoxWithLabel("Random seed", default = "0", i = i++)
|
||||
cFiles = addBoxWithLabel("Files to visit", default = "20", i = i++)
|
||||
cFunctions = addBoxWithLabel("Max functions to visit", default = "20", i = i++)
|
||||
cLines = addBoxWithLabel("File lines", default = "100", i = i)
|
||||
cSeed = addBoxWithLabel(KotlinBundle.message("random.seed"), default = "0", i = i++)
|
||||
cFiles = addBoxWithLabel(KotlinBundle.message("files.to.visit"), default = "20", i = i++)
|
||||
cFunctions = addBoxWithLabel(KotlinBundle.message("max.functions.to.visit"), default = "20", i = i++)
|
||||
cLines = addBoxWithLabel(KotlinBundle.message("file.lines"), default = "100", i = i)
|
||||
}
|
||||
dialogBuilder.centerPanel(jPanel)
|
||||
if (!dialogBuilder.showAndGet()) return null
|
||||
|
||||
+5
-4
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiWhiteSpace
|
||||
import com.intellij.ui.components.JBPanel
|
||||
import com.intellij.ui.components.JBTextField
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.actions.internal.benchmark.AbstractCompletionBenchmarkAction.Companion.randomElement
|
||||
import org.jetbrains.kotlin.idea.completion.CompletionBenchmarkSink
|
||||
import org.jetbrains.kotlin.idea.core.util.getLineCount
|
||||
@@ -51,7 +52,7 @@ class TopLevelCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() {
|
||||
}
|
||||
|
||||
if (ktFiles.size < settings.files) {
|
||||
showPopup(project, "Number of attempts > then files in project, ${ktFiles.size}")
|
||||
showPopup(project, KotlinBundle.message("number.of.attempts.then.files.in.project.0", ktFiles.size))
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -78,9 +79,9 @@ class TopLevelCompletionBenchmarkAction : AbstractCompletionBenchmarkAction() {
|
||||
|
||||
val jPanel = JBPanel<JBPanel<*>>(GridLayoutManager(3, 2)).apply {
|
||||
var i = 0
|
||||
cSeed = addBoxWithLabel("Random seed", default = "0", i = i++)
|
||||
cFiles = addBoxWithLabel("Files to visit", default = "20", i = i++)
|
||||
cLines = addBoxWithLabel("File lines", default = "100", i = i)
|
||||
cSeed = addBoxWithLabel(KotlinBundle.message("random.seed"), default = "0", i = i++)
|
||||
cFiles = addBoxWithLabel(KotlinBundle.message("files.to.visit"), default = "20", i = i++)
|
||||
cLines = addBoxWithLabel(KotlinBundle.message("file.lines"), default = "100", i = i)
|
||||
}
|
||||
dialogBuilder.centerPanel(jPanel)
|
||||
if (!dialogBuilder.showAndGet()) return null
|
||||
|
||||
+17
-10
@@ -19,6 +19,7 @@ import com.intellij.openapi.project.guessProjectDir
|
||||
import com.intellij.openapi.ui.Messages
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.cases.MoveRefactoringCase
|
||||
import org.jetbrains.kotlin.idea.util.application.runWriteAction
|
||||
import java.io.File
|
||||
@@ -30,7 +31,7 @@ import java.time.format.DateTimeFormatter
|
||||
class MoveRefactoringAction : AnAction() {
|
||||
|
||||
companion object {
|
||||
const val WINDOW_TITLE: String = "Move refactoring testing"
|
||||
val WINDOW_TITLE: String get() = KotlinBundle.message("move.refactoring.testing")
|
||||
const val RECENT_SELECTED_PATH = "org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.RECENT_SELECTED_PATH"
|
||||
}
|
||||
|
||||
@@ -52,18 +53,18 @@ class MoveRefactoringAction : AnAction() {
|
||||
) {
|
||||
|
||||
try {
|
||||
setIndicator("Update indices...", 0.0)
|
||||
setIndicator(KotlinBundle.message("update.indices"), 0.0)
|
||||
|
||||
DumbService.getInstance(project).waitForSmartMode()
|
||||
|
||||
setIndicator("Perform refactoring ...", 0.1)
|
||||
setIndicator(KotlinBundle.message("perform.refactoring"), 0.1)
|
||||
|
||||
fileTracker.reset()
|
||||
|
||||
var refactoringResult: RandomMoveRefactoringResult = RandomMoveRefactoringResult.Failed
|
||||
edtExecute {
|
||||
refactoringResult = refactoring.tryCreateAndRun(project, refactoringCountBeforeCheck)
|
||||
setIndicator("Saving files...", 0.3)
|
||||
setIndicator(KotlinBundle.message("saving.files"), 0.3)
|
||||
FileDocumentManager.getInstance().saveAllDocuments()
|
||||
VfsUtil.markDirtyAndRefresh(false, true, true, projectRoot)
|
||||
}
|
||||
@@ -72,7 +73,7 @@ class MoveRefactoringAction : AnAction() {
|
||||
is RandomMoveRefactoringResult.Success -> {
|
||||
verifications++
|
||||
|
||||
setIndicator("Compiling project...", 0.7)
|
||||
setIndicator(KotlinBundle.message("compiling.project"), 0.7)
|
||||
if (!actionRunner.checkByBuild(cancelledChecker)) {
|
||||
fails++
|
||||
resultsFile.appendText("${localRefactoringResult.caseData}\n\n")
|
||||
@@ -87,7 +88,7 @@ class MoveRefactoringAction : AnAction() {
|
||||
}
|
||||
|
||||
} finally {
|
||||
setIndicator("Reset files...", 0.9)
|
||||
setIndicator(KotlinBundle.message("reset.files"), 0.9)
|
||||
|
||||
fileTracker.createdFiles.toList().map {
|
||||
try {
|
||||
@@ -104,7 +105,7 @@ class MoveRefactoringAction : AnAction() {
|
||||
gitReset(project, projectRoot)
|
||||
}
|
||||
|
||||
setIndicator("Done", 1.0)
|
||||
setIndicator(KotlinBundle.message("text.done"), 1.0)
|
||||
}
|
||||
|
||||
private fun createFileIfNotExist(targetPath: String): File? {
|
||||
@@ -128,7 +129,7 @@ class MoveRefactoringAction : AnAction() {
|
||||
val projectRoot = project?.guessProjectDir()
|
||||
|
||||
if (projectRoot === null) {
|
||||
Messages.showErrorDialog(project, "Cannot get project root directory", WINDOW_TITLE)
|
||||
Messages.showErrorDialog(project, KotlinBundle.message("cannot.get.project.root.directory"), WINDOW_TITLE)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -141,7 +142,7 @@ class MoveRefactoringAction : AnAction() {
|
||||
|
||||
val resultsFile = createFileIfNotExist(targetPath)
|
||||
if (resultsFile === null) {
|
||||
Messages.showErrorDialog(project, "Cannot get or create results file", WINDOW_TITLE)
|
||||
Messages.showErrorDialog(project, KotlinBundle.message("cannot.get.or.create.results.file"), WINDOW_TITLE)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -188,7 +189,13 @@ class MoveRefactoringAction : AnAction() {
|
||||
try {
|
||||
while (!cancelledChecker()) {
|
||||
iteration++
|
||||
indicator.text = "$WINDOW_TITLE [Try $iteration with $fails fails and $verifications verifications]"
|
||||
indicator.text = KotlinBundle.message(
|
||||
"0.try.1.with.2.fails.and.3.verifications",
|
||||
WINDOW_TITLE,
|
||||
iteration,
|
||||
fails,
|
||||
verifications
|
||||
)
|
||||
|
||||
randomRefactoringAndCheck(
|
||||
project = project,
|
||||
|
||||
+4
-3
@@ -16,6 +16,7 @@ import com.intellij.ui.components.JBLabelDecorator
|
||||
import com.intellij.ui.components.JBTextField
|
||||
import com.intellij.util.ui.FormBuilder
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.core.util.onTextChange
|
||||
import java.io.File
|
||||
import javax.swing.InputVerifier
|
||||
@@ -26,9 +27,9 @@ class MoveRefactoringActionDialog(
|
||||
) : DialogWrapper(project, true) {
|
||||
|
||||
companion object {
|
||||
const val WINDOW_TITLE = "Move refactoring test"
|
||||
const val COUNT_LABEL_TEXT = "Maximum count of applied refactoring before validity check"
|
||||
const val LOG_FILE_WILL_BE_PLACED_HERE = "Test result log file will be placed here"
|
||||
val WINDOW_TITLE get() = KotlinBundle.message("move.refactoring.test")
|
||||
val COUNT_LABEL_TEXT get() = KotlinBundle.message("maximum.count.of.applied.refactoring.before.validity.check")
|
||||
val LOG_FILE_WILL_BE_PLACED_HERE get() = KotlinBundle.message("test.result.log.file.will.be.placed.here")
|
||||
|
||||
const val RECENT_SELECTED_PATH = "org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.RECENT_SELECTED_PATH"
|
||||
const val RECENT_SELECTED_RUN_COUNT = "org.jetbrains.kotlin.idea.actions.internal.refactoringTesting.RECENT_SELECTED_RUN_COUNT"
|
||||
|
||||
@@ -351,7 +351,7 @@ class KotlinCopyPasteReferenceProcessor : CopyPastePostProcessor<BasicKotlinRefe
|
||||
showRestoreReferencesDialog(project, referencesPossibleToRestore)
|
||||
if (selectedReferencesToRestore.isEmpty()) return@invokeLater
|
||||
|
||||
project.executeWriteCommand("resolve pasted references") {
|
||||
project.executeWriteCommand(KotlinBundle.message("resolve.pasted.references")) {
|
||||
val imported = TreeSet<String>()
|
||||
restoreReferences(selectedReferencesToRestore, file, imported)
|
||||
|
||||
|
||||
@@ -70,5 +70,8 @@ private fun StringBuilder.appendBr(line: String) = this.append("$line<br/>")
|
||||
private fun StringBuilder.appendIndentBr(line: String) = appendBr(" $line")
|
||||
|
||||
private const val KOTLIN_MIGRATION_NOTIFICATION_ID = "Kotlin Migration"
|
||||
private val KOTLIN_MIGRATION_NOTIFICATION_GROUP =
|
||||
NotificationGroup(KOTLIN_MIGRATION_NOTIFICATION_ID, NotificationDisplayType.STICKY_BALLOON, true)
|
||||
private val KOTLIN_MIGRATION_NOTIFICATION_GROUP = NotificationGroup(
|
||||
KOTLIN_MIGRATION_NOTIFICATION_ID,
|
||||
NotificationDisplayType.STICKY_BALLOON,
|
||||
true
|
||||
)
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.intellij.psi.JavaDirectoryService
|
||||
import com.intellij.psi.PsiDocumentManager
|
||||
import com.intellij.psi.util.PsiTreeUtil
|
||||
import com.intellij.util.IncorrectOperationException
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
@@ -37,7 +38,7 @@ class KotlinFilePasteProvider : PasteProvider {
|
||||
|
||||
@Suppress("UsePropertyAccessSyntax")
|
||||
val directory = ideView.getOrChooseDirectory() ?: return
|
||||
project.executeWriteCommand("Create Kotlin file") {
|
||||
project.executeWriteCommand(KotlinBundle.message("create.kotlin.file")) {
|
||||
val file = try {
|
||||
directory.createFile(fileName)
|
||||
} catch (e: IncorrectOperationException) {
|
||||
|
||||
+2
-2
@@ -18,10 +18,10 @@ package org.jetbrains.kotlin.idea.inspections
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToDescriptorIfAny
|
||||
import org.jetbrains.kotlin.idea.core.getModalityFromDescriptor
|
||||
import org.jetbrains.kotlin.idea.intentions.SpecifyTypeExplicitlyIntention
|
||||
import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.psi.KtCallableDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtProperty
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.kotlin.types.typeUtil.isNullableNothing
|
||||
class ImplicitNullableNothingTypeInspection : IntentionBasedInspection<KtCallableDeclaration>(
|
||||
intention = SpecifyTypeExplicitlyIntention::class,
|
||||
additionalChecker = { declaration -> declaration.check() },
|
||||
problemText = "Implicit `Nothing?` type"
|
||||
problemText = KotlinBundle.message("implicit.nothing.type")
|
||||
) {
|
||||
override fun inspectionTarget(element: KtCallableDeclaration) = element.nameIdentifier
|
||||
}
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ class MoveSuspiciousCallableReferenceIntoParenthesesInspection : AbstractKotlinI
|
||||
}
|
||||
|
||||
class MoveIntoParenthesesIntention : ConvertLambdaToReferenceIntention(
|
||||
"Move suspicious callable reference into parentheses '()'"
|
||||
KotlinBundle.message("move.suspicious.callable.reference.into.parentheses")
|
||||
) {
|
||||
override fun buildReferenceText(element: KtLambdaExpression): String? {
|
||||
val callableReferenceExpression =
|
||||
|
||||
@@ -179,7 +179,7 @@ sealed class NamingConventionInspection(
|
||||
}
|
||||
|
||||
class ClassNameInspection : NamingConventionInspection(
|
||||
"Class",
|
||||
KotlinBundle.message("class"),
|
||||
"[A-Z][A-Za-z\\d]*",
|
||||
START_UPPER, NO_UNDERSCORES, NO_BAD_CHARACTERS
|
||||
) {
|
||||
@@ -197,7 +197,7 @@ class ClassNameInspection : NamingConventionInspection(
|
||||
}
|
||||
|
||||
class EnumEntryNameInspection : NamingConventionInspection(
|
||||
"Enum entry",
|
||||
KotlinBundle.message("enum.entry"),
|
||||
"[A-Z]([A-Za-z\\d]*|[A-Z_\\d]*)",
|
||||
START_UPPER, NO_BAD_CHARACTERS_OR_UNDERSCORE
|
||||
) {
|
||||
@@ -207,7 +207,7 @@ class EnumEntryNameInspection : NamingConventionInspection(
|
||||
}
|
||||
|
||||
class FunctionNameInspection : NamingConventionInspection(
|
||||
"Function",
|
||||
KotlinBundle.message("function"),
|
||||
"[a-z][A-Za-z\\d]*",
|
||||
START_LOWER, NO_UNDERSCORES, NO_BAD_CHARACTERS
|
||||
) {
|
||||
@@ -224,7 +224,7 @@ class FunctionNameInspection : NamingConventionInspection(
|
||||
}
|
||||
|
||||
class TestFunctionNameInspection : NamingConventionInspection(
|
||||
"Test function",
|
||||
KotlinBundle.message("test.function"),
|
||||
"[a-z][A-Za-z_\\d]*",
|
||||
START_LOWER
|
||||
) {
|
||||
@@ -279,30 +279,30 @@ abstract class PropertyNameInspectionBase protected constructor(
|
||||
|
||||
class PropertyNameInspection :
|
||||
PropertyNameInspectionBase(
|
||||
PropertyKind.NORMAL, "Property", "[a-z][A-Za-z\\d]*",
|
||||
PropertyKind.NORMAL, KotlinBundle.message("property"), "[a-z][A-Za-z\\d]*",
|
||||
START_LOWER, NO_UNDERSCORES, NO_BAD_CHARACTERS
|
||||
)
|
||||
|
||||
class ObjectPropertyNameInspection :
|
||||
PropertyNameInspectionBase(
|
||||
PropertyKind.OBJECT_OR_TOP_LEVEL,
|
||||
"Object or top-level property",
|
||||
KotlinBundle.message("object.or.top.level.property"),
|
||||
"[A-Za-z][_A-Za-z\\d]*",
|
||||
NO_START_UNDERSCORE, NO_BAD_CHARACTERS_OR_UNDERSCORE
|
||||
)
|
||||
|
||||
class PrivatePropertyNameInspection :
|
||||
PropertyNameInspectionBase(
|
||||
PropertyKind.PRIVATE, "Private property", "_?[a-z][A-Za-z\\d]*",
|
||||
PropertyKind.PRIVATE, KotlinBundle.message("private.property"), "_?[a-z][A-Za-z\\d]*",
|
||||
NO_MIDDLE_UNDERSCORES, NO_BAD_CHARACTERS_OR_UNDERSCORE
|
||||
)
|
||||
|
||||
class ConstPropertyNameInspection :
|
||||
PropertyNameInspectionBase(PropertyKind.CONST, "Const property", "[A-Z][_A-Z\\d]*")
|
||||
PropertyNameInspectionBase(PropertyKind.CONST, KotlinBundle.message("const.property"), "[A-Z][_A-Z\\d]*")
|
||||
|
||||
class LocalVariableNameInspection :
|
||||
PropertyNameInspectionBase(
|
||||
PropertyKind.LOCAL, "Local variable", "[a-z][A-Za-z\\d]*",
|
||||
PropertyKind.LOCAL, KotlinBundle.message("local.variable"), "[a-z][A-Za-z\\d]*",
|
||||
START_LOWER, NO_UNDERSCORES, NO_BAD_CHARACTERS
|
||||
)
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.inspections
|
||||
|
||||
import org.jetbrains.kotlin.idea.KotlinBundle
|
||||
import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.psi.psiUtil.isPropertyParameter
|
||||
|
||||
@@ -23,13 +24,16 @@ import org.jetbrains.kotlin.psi.psiUtil.isPropertyParameter
|
||||
* @return string description of declaration, like `Function "describe"`
|
||||
*/
|
||||
fun KtNamedDeclaration.describe(): String? = when (this) {
|
||||
is KtClass -> "${if (isInterface()) "Interface" else "Class"} \"$name\""
|
||||
is KtObjectDeclaration -> "Object \"$name\""
|
||||
is KtNamedFunction -> "Function \"$name\""
|
||||
is KtSecondaryConstructor -> "Constructor"
|
||||
is KtProperty -> "Property \"$name\""
|
||||
is KtParameter -> if (this.isPropertyParameter()) "Property \"$name\"" else "Parameter \"$name\""
|
||||
is KtTypeParameter -> "Type parameter \"$name\""
|
||||
is KtTypeAlias -> "Type alias \"$name\""
|
||||
is KtClass -> "${if (isInterface()) KotlinBundle.message("interface") else KotlinBundle.message("class")} \"$name\""
|
||||
is KtObjectDeclaration -> KotlinBundle.message("object.0", name.toString())
|
||||
is KtNamedFunction -> KotlinBundle.message("function.01", name.toString())
|
||||
is KtSecondaryConstructor -> KotlinBundle.message("constructor")
|
||||
is KtProperty -> KotlinBundle.message("property.0", name.toString())
|
||||
is KtParameter -> if (this.isPropertyParameter())
|
||||
KotlinBundle.message("property.0", name.toString())
|
||||
else
|
||||
KotlinBundle.message("parameter.0", name.toString())
|
||||
is KtTypeParameter -> KotlinBundle.message("type.parameter.0", name.toString())
|
||||
is KtTypeAlias -> KotlinBundle.message("type.alias.0", name.toString())
|
||||
else -> null
|
||||
}
|
||||
@@ -60,13 +60,12 @@ class CreateKotlinSubClassIntention : SelfTargetingRangeIntention<KtClass>(
|
||||
return TextRange(element.startOffset, element.body?.lBrace?.startOffset ?: element.endOffset)
|
||||
}
|
||||
|
||||
private fun getImplementTitle(baseClass: KtClass) =
|
||||
when {
|
||||
baseClass.isInterface() -> "Implement interface"
|
||||
baseClass.isAbstract() -> "Implement abstract class"
|
||||
baseClass.isSealed() -> "Implement sealed class"
|
||||
else /* open class */ -> "Create subclass"
|
||||
}
|
||||
private fun getImplementTitle(baseClass: KtClass) = when {
|
||||
baseClass.isInterface() -> KotlinBundle.message("implement.interface")
|
||||
baseClass.isAbstract() -> KotlinBundle.message("implement.abstract.class")
|
||||
baseClass.isSealed() -> KotlinBundle.message("implement.sealed.class")
|
||||
else /* open class */ -> KotlinBundle.message("create.subclass")
|
||||
}
|
||||
|
||||
override fun startInWriteAction() = false
|
||||
|
||||
|
||||
@@ -222,8 +222,8 @@ abstract class ImplementAbstractMemberIntentionBase :
|
||||
|
||||
class ImplementAbstractMemberIntention : ImplementAbstractMemberIntentionBase() {
|
||||
override fun computeText(element: KtNamedDeclaration): String? = when (element) {
|
||||
is KtProperty -> "Implement abstract property"
|
||||
is KtNamedFunction -> "Implement abstract function"
|
||||
is KtProperty -> KotlinBundle.message("implement.abstract.property")
|
||||
is KtNamedFunction -> KotlinBundle.message("implement.abstract.function")
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ import org.jetbrains.kotlin.psi.psiUtil.getParentOfType
|
||||
import org.jetbrains.kotlin.resolve.DescriptorToSourceUtils
|
||||
|
||||
class ReplaceExplicitFunctionLiteralParamWithItIntention : PsiElementBaseIntentionAction() {
|
||||
override fun getFamilyName() = "Replace explicit lambda parameter with 'it'"
|
||||
override fun getFamilyName() = KotlinBundle.message("replace.explicit.lambda.parameter.with.it")
|
||||
|
||||
override fun isAvailable(project: Project, editor: Editor, element: PsiElement): Boolean {
|
||||
val functionLiteral = targetFunctionLiteral(element, editor.caretModel.offset) ?: return false
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.projectWizard
|
||||
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.kotlin.idea.statistics.FUSEventGroups
|
||||
import org.jetbrains.kotlin.idea.statistics.KotlinFUSLogger
|
||||
|
||||
@@ -36,7 +37,7 @@ data class UiEditorUsageStats(
|
||||
)
|
||||
}
|
||||
|
||||
private enum class WizardStatsEvent(val text: String) {
|
||||
private enum class WizardStatsEvent(@NonNls val text: String) {
|
||||
PROJECT_CREATED("Project Created"),
|
||||
WIZARD_STATE_CHANGE("New Wizard enabled or disable")
|
||||
}
|
||||
|
||||
@@ -41,7 +41,10 @@ import org.jetbrains.kotlin.psi.psiUtil.hasExpectModifier
|
||||
import org.jetbrains.kotlin.psi.psiUtil.startOffset
|
||||
import java.util.*
|
||||
|
||||
class KotlinCreateTestIntention : SelfTargetingRangeIntention<KtNamedDeclaration>(KtNamedDeclaration::class.java, "Create test") {
|
||||
class KotlinCreateTestIntention : SelfTargetingRangeIntention<KtNamedDeclaration>(
|
||||
KtNamedDeclaration::class.java,
|
||||
KotlinBundle.message("create.test")
|
||||
) {
|
||||
override fun applicabilityRange(element: KtNamedDeclaration): TextRange? {
|
||||
if (element.hasExpectModifier() || element.nameIdentifier == null) return null
|
||||
if (ModuleUtilCore.findModuleForPsiElement(element) == null) return null
|
||||
@@ -154,7 +157,10 @@ class KotlinCreateTestIntention : SelfTargetingRangeIntention<KtNamedDeclaration
|
||||
val generatedFile = generatedClass.containingFile as? PsiJavaFile ?: return@runWhenSmart
|
||||
|
||||
if (generatedClass.language == JavaLanguage.INSTANCE) {
|
||||
project.executeCommand<Unit>("Convert class '${generatedClass.name}' to Kotlin", this) {
|
||||
project.executeCommand<Unit>(
|
||||
KotlinBundle.message("convert.class.0.to.kotlin", generatedClass.name.toString()),
|
||||
this
|
||||
) {
|
||||
runWriteAction {
|
||||
generatedClass.methods.forEach {
|
||||
it.throwsList.referenceElements.forEach { referenceElement -> referenceElement.delete() }
|
||||
|
||||
Reference in New Issue
Block a user