Inline function: use "function" in GUI messages

This commit is contained in:
Mikhail Glukhikh
2017-03-30 13:32:20 +03:00
parent 93b624fdbe
commit fc0bf47067
2 changed files with 11 additions and 13 deletions

View File

@@ -41,7 +41,7 @@ class KotlinInlineFunctionDialog(
init {
myInvokedOnReference = reference != null
title = RefactoringBundle.message("inline.method.title")
title = "Inline function"
init()
}
@@ -51,23 +51,22 @@ class KotlinInlineFunctionDialog(
val occurrencesString =
if (occurrencesNumber > -1) " - $occurrencesNumber occurrence${if (occurrencesNumber == 1) "" else "s"}"
else ""
val methodText = "${function.nameAsSafeName}" + function.valueParameters.joinToString(prefix = "(", postfix = ")") {
val functionText = "${function.nameAsSafeName}" + function.valueParameters.joinToString(prefix = "(", postfix = ")") {
"${it.nameAsSafeName}: ${it.typeReference?.text}"
} + (function.getReturnTypeReference()?.let { ": " + it.text } ?: "")
return RefactoringBundle.message("inline.method.method.label", methodText, occurrencesString)
return "Function $functionText $occurrencesString"
}
override fun getBorderTitle(): String = RefactoringBundle.message("inline.method.border.title")
override fun getBorderTitle() = "Inline"
override fun getInlineThisText(): String = RefactoringBundle.message("this.invocation.only.and.keep.the.method")
override fun getInlineThisText() = "Inline this only and keep the function"
override fun getInlineAllText(): String = RefactoringBundle.message(
if (function.isWritable) "all.invocations.and.remove.the.method"
else "all.invocations.in.project"
)
override fun getInlineAllText() =
if (function.isWritable) "Inline all and remove the function"
else "All invocations in project"
override fun getKeepTheDeclarationText(): String =
if (function.isWritable) RefactoringBundle.message("all.invocations.keep.the.method")
if (function.isWritable) "Inline all and keep the function"
else super.getKeepTheDeclarationText()
public override fun doAction() {

View File

@@ -42,7 +42,7 @@ class KotlinInlineFunctionProcessor(
private val deleteAfter: Boolean
) : BaseRefactoringProcessor(project) {
private val commandName = RefactoringBundle.message("inline.method.command", DescriptiveNameUtil.getDescriptiveName(function))
private val commandName = "Inlining function ${DescriptiveNameUtil.getDescriptiveName(function)}"
override fun findUsages(): Array<UsageInfo> {
if (inlineThisOnly && reference != null) return arrayOf(UsageInfo(reference))
@@ -75,8 +75,7 @@ class KotlinInlineFunctionProcessor(
override fun getElements() = arrayOf(function)
override fun getProcessedElementsHeader(): String =
RefactoringBundle.message("inline.method.elements.header")
override fun getProcessedElementsHeader() = "Function to inline"
}
}
}