From c70809553f8619873a0a9758ccb48ee1282a78fa Mon Sep 17 00:00:00 2001 From: Dmitry Gridin Date: Thu, 26 Mar 2020 13:05:53 +0700 Subject: [PATCH] i18n, KotlinSurrounderUtils: convert field to function #KT-37483 --- .../idea/core/surroundWith/KotlinSurrounderUtils.java | 11 ++++++++--- .../statement/KotlinFunctionLiteralSurrounder.java | 2 +- .../statement/KotlinIfSurrounderBase.java | 2 +- .../statement/KotlinTrySurrounderBase.java | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/surroundWith/KotlinSurrounderUtils.java b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/surroundWith/KotlinSurrounderUtils.java index ff19f891ae4..4a3594a77a1 100644 --- a/idea/idea-core/src/org/jetbrains/kotlin/idea/core/surroundWith/KotlinSurrounderUtils.java +++ b/idea/idea-core/src/org/jetbrains/kotlin/idea/core/surroundWith/KotlinSurrounderUtils.java @@ -19,8 +19,13 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt; import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode; public class KotlinSurrounderUtils { - public static String SURROUND_WITH = KotlinIdeaCoreBundle.message("surround.with.title"); - public static String SURROUND_WITH_ERROR = KotlinIdeaCoreBundle.message("surround.with.error.cannot.perform.action"); + public static String SURROUND_WITH() { + return KotlinIdeaCoreBundle.message("surround.with.title"); + } + + public static String SURROUND_WITH_ERROR() { + return KotlinIdeaCoreBundle.message("surround.with.error.cannot.perform.action"); + } private KotlinSurrounderUtils() { } @@ -34,7 +39,7 @@ public class KotlinSurrounderUtils { } public static void showErrorHint(@NotNull Project project, @NotNull Editor editor, @NotNull String message) { - CodeInsightUtils.showErrorHint(project, editor, message, SURROUND_WITH, null); + CodeInsightUtils.showErrorHint(project, editor, message, SURROUND_WITH(), null); } public static boolean isUsedAsStatement(@NotNull KtExpression expression) { diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinFunctionLiteralSurrounder.java b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinFunctionLiteralSurrounder.java index 4c04a74865c..d05286dd068 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinFunctionLiteralSurrounder.java +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinFunctionLiteralSurrounder.java @@ -34,7 +34,7 @@ public class KotlinFunctionLiteralSurrounder extends KotlinStatementsSurrounder statements = MoveDeclarationsOutHelperKt.move(container, statements, true); if (statements.length == 0) { - KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR); + KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR()); return null; } diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java index 08cafee6989..ac667d50bad 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinIfSurrounderBase.java @@ -44,7 +44,7 @@ public abstract class KotlinIfSurrounderBase extends KotlinStatementsSurrounder statements = MoveDeclarationsOutHelperKt.move(container, statements, isGenerateDefaultInitializers()); if (statements.length == 0) { - KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR); + KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR()); return null; } diff --git a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinTrySurrounderBase.java b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinTrySurrounderBase.java index 42728ca250c..a40b377da72 100644 --- a/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinTrySurrounderBase.java +++ b/idea/src/org/jetbrains/kotlin/idea/codeInsight/surroundWith/statement/KotlinTrySurrounderBase.java @@ -40,7 +40,7 @@ public abstract class KotlinTrySurrounderBase extends KotlinStatementsSurrounder statements = MoveDeclarationsOutHelperKt.move(container, statements, true); if (statements.length == 0) { - KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR); + KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR()); return null; }