i18n, KotlinSurrounderUtils: convert field to function

#KT-37483
This commit is contained in:
Dmitry Gridin
2020-03-26 13:05:53 +07:00
parent 986bc3fb8f
commit c70809553f
4 changed files with 11 additions and 6 deletions
@@ -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) {
@@ -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;
}
@@ -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;
}
@@ -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;
}