i18n, KotlinSurrounderUtils: convert field to function
#KT-37483
This commit is contained in:
+8
-3
@@ -19,8 +19,13 @@ import org.jetbrains.kotlin.resolve.bindingContextUtil.BindingContextUtilsKt;
|
|||||||
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
|
import org.jetbrains.kotlin.resolve.lazy.BodyResolveMode;
|
||||||
|
|
||||||
public class KotlinSurrounderUtils {
|
public class KotlinSurrounderUtils {
|
||||||
public static String SURROUND_WITH = KotlinIdeaCoreBundle.message("surround.with.title");
|
public static String SURROUND_WITH() {
|
||||||
public static String SURROUND_WITH_ERROR = KotlinIdeaCoreBundle.message("surround.with.error.cannot.perform.action");
|
return KotlinIdeaCoreBundle.message("surround.with.title");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String SURROUND_WITH_ERROR() {
|
||||||
|
return KotlinIdeaCoreBundle.message("surround.with.error.cannot.perform.action");
|
||||||
|
}
|
||||||
|
|
||||||
private KotlinSurrounderUtils() {
|
private KotlinSurrounderUtils() {
|
||||||
}
|
}
|
||||||
@@ -34,7 +39,7 @@ public class KotlinSurrounderUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void showErrorHint(@NotNull Project project, @NotNull Editor editor, @NotNull String message) {
|
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) {
|
public static boolean isUsedAsStatement(@NotNull KtExpression expression) {
|
||||||
|
|||||||
+1
-1
@@ -34,7 +34,7 @@ public class KotlinFunctionLiteralSurrounder extends KotlinStatementsSurrounder
|
|||||||
statements = MoveDeclarationsOutHelperKt.move(container, statements, true);
|
statements = MoveDeclarationsOutHelperKt.move(container, statements, true);
|
||||||
|
|
||||||
if (statements.length == 0) {
|
if (statements.length == 0) {
|
||||||
KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR);
|
KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -44,7 +44,7 @@ public abstract class KotlinIfSurrounderBase extends KotlinStatementsSurrounder
|
|||||||
statements = MoveDeclarationsOutHelperKt.move(container, statements, isGenerateDefaultInitializers());
|
statements = MoveDeclarationsOutHelperKt.move(container, statements, isGenerateDefaultInitializers());
|
||||||
|
|
||||||
if (statements.length == 0) {
|
if (statements.length == 0) {
|
||||||
KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR);
|
KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -40,7 +40,7 @@ public abstract class KotlinTrySurrounderBase extends KotlinStatementsSurrounder
|
|||||||
statements = MoveDeclarationsOutHelperKt.move(container, statements, true);
|
statements = MoveDeclarationsOutHelperKt.move(container, statements, true);
|
||||||
|
|
||||||
if (statements.length == 0) {
|
if (statements.length == 0) {
|
||||||
KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR);
|
KotlinSurrounderUtils.showErrorHint(project, editor, KotlinSurrounderUtils.SURROUND_WITH_ERROR());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user