default -> companion: fix message for quick fix

This commit is contained in:
Pavel V. Talanov
2015-03-18 14:27:39 +03:00
parent e69a1d6aba
commit 41b65205b0
6 changed files with 15 additions and 15 deletions
@@ -180,10 +180,10 @@ options.kotlin.attribute.descriptor.smart.cast=Smart-cast value
options.kotlin.attribute.descriptor.label=Label
change.to.function.invocation=Change to function invocation
migrate.sure=Replace sure() calls by !! in project
migrate.class.object.to.default=Replace 'class' keyword with 'default' modifier
migrate.class.object.to.default.family=Replace 'class' Keyword with 'default' Modifier
migrate.class.object.to.default.in.whole.project=Replace 'class' keyword with 'default' modifier in whole project
migrate.class.object.to.default.in.whole.project.family=Replace 'class' Keyword with 'default' Modifier in Whole Project
migrate.class.object.to.companion=Replace 'class' keyword with 'companion' modifier
migrate.class.object.to.companion.family=Replace 'class' Keyword with 'companion' Modifier
migrate.class.object.to.companion.in.whole.project=Replace 'class' keyword with 'companion' modifier in whole project
migrate.class.object.to.companion.in.whole.project.family=Replace 'class' Keyword with 'companion' Modifier in Whole Project
remove.val.var.from.parameter=Remove ''{0}'' from parameter
add.override.to.equals.hashCode.toString=Add 'override' to equals, hashCode, toString in project
add.when.else.branch.action.family.name=Add Else Branch
@@ -25,19 +25,19 @@ import org.jetbrains.kotlin.lexer.JetTokens
import org.jetbrains.kotlin.psi.*
public class ClassObjectToCompanionObjectFix(private val elem: JetObjectDeclaration) : JetIntentionAction<JetObjectDeclaration>(elem) {
override fun getText(): String = JetBundle.message("migrate.class.object.to.default")
override fun getText(): String = JetBundle.message("migrate.class.object.to.companion")
override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.default.family")
override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.companion.family")
override fun invoke(project: Project, editor: Editor, file: JetFile) {
classKeywordToDefaultModifier(elem)
classKeywordToCompanionModifier(elem)
}
class object Factory : JetSingleIntentionActionFactory() {
override fun createAction(diagnostic: Diagnostic) =
(diagnostic.getPsiElement() as? JetObjectDeclaration)?.let { ClassObjectToCompanionObjectFix(it) }
fun classKeywordToDefaultModifier(objectDeclaration: JetObjectDeclaration) {
fun classKeywordToCompanionModifier(objectDeclaration: JetObjectDeclaration) {
objectDeclaration.getClassKeyword()?.delete()
if (!objectDeclaration.hasModifier(JetTokens.COMPANION_KEYWORD)) {
objectDeclaration.addModifier(JetTokens.COMPANION_KEYWORD)
@@ -47,9 +47,9 @@ public class ClassObjectToCompanionObjectFix(private val elem: JetObjectDeclarat
}
public class ClassObjectToCompanionObjectInWholeProjectFix(private val elem: JetObjectDeclaration) : JetIntentionAction<JetObjectDeclaration>(elem) {
override fun getText(): String = JetBundle.message("migrate.class.object.to.default.in.whole.project")
override fun getText(): String = JetBundle.message("migrate.class.object.to.companion.in.whole.project")
override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.default.in.whole.project.family")
override fun getFamilyName(): String = JetBundle.message("migrate.class.object.to.companion.in.whole.project.family")
override fun invoke(project: Project, editor: Editor, file: JetFile) {
val files = PluginJetFilesProvider.allFilesInProject(file.getProject())
@@ -61,7 +61,7 @@ public class ClassObjectToCompanionObjectInWholeProjectFix(private val elem: Jet
override fun visitObjectDeclaration(objectDeclaration: JetObjectDeclaration) {
objectDeclaration.acceptChildren(this)
if (objectDeclaration.getClassKeyword() != null) {
ClassObjectToCompanionObjectFix.classKeywordToDefaultModifier(objectDeclaration)
ClassObjectToCompanionObjectFix.classKeywordToCompanionModifier(objectDeclaration)
}
}
}
@@ -1,4 +1,4 @@
// "Replace 'class' keyword with 'default' modifier" "true"
// "Replace 'class' keyword with 'companion' modifier" "true"
class A {
public companion object {
@@ -1,4 +1,4 @@
// "Replace 'class' keyword with 'default' modifier" "true"
// "Replace 'class' keyword with 'companion' modifier" "true"
class A {
public class<caret> object {
@@ -1,4 +1,4 @@
// "Replace 'class' keyword with 'default' modifier in whole project" "true"
// "Replace 'class' keyword with 'companion' modifier in whole project" "true"
class A {
public companion object {
@@ -1,4 +1,4 @@
// "Replace 'class' keyword with 'default' modifier in whole project" "true"
// "Replace 'class' keyword with 'companion' modifier in whole project" "true"
class A {
public class<caret> object {