Revert "[kotlin] K2 J2K: Customize dialog in K2 mode, show "Alpha" warning"

KTIJ-21123

This reverts commit 2ac6bc85

GitOrigin-RevId: 844bba3b212c10c8663cdeebb7253254e37141cd
This commit is contained in:
Alexey Belkov
2024-07-17 18:05:01 +04:00
committed by intellij-monorepo-bot
parent 817eecf186
commit d943fb93c2
2 changed files with 3 additions and 16 deletions

View File

@@ -324,8 +324,6 @@ quick.doc.section.replace.with=Replace with:
quick.doc.section.java.declaration=Java declaration:
action.j2k.name=Convert Java to Kotlin
action.j2k.k2.name=Convert Java to Kotlin (Alpha)
action.j2k.k2.warning=<b>Note</b>: the K2 version of Java to Kotlin converter is in Alpha, some functionality is not supported yet.
action.j2k.task.name=Convert Files from Java to Kotlin
action.j2k.correction.investigate=Investigate Errors
action.j2k.correction.proceed=Proceed with Conversion

View File

@@ -20,7 +20,6 @@ import com.intellij.openapi.ui.MessageType
import com.intellij.openapi.ui.Messages
import com.intellij.openapi.ui.ex.MessagesEx
import com.intellij.openapi.ui.popup.JBPopupFactory
import com.intellij.openapi.util.NlsContexts
import com.intellij.openapi.util.text.StringUtil
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.openapi.wm.WindowManager
@@ -57,11 +56,7 @@ import kotlin.system.measureTimeMillis
class JavaToKotlinAction : AnAction() {
object Handler {
val title: String
get() {
val messageKey = if (isK2Mode()) "action.j2k.k2.name" else "action.j2k.name"
return KotlinBundle.message(messageKey)
}
val title: String = KotlinBundle.message("action.j2k.name")
@OptIn(KaAllowAnalysisOnEdt::class)
fun convertFiles(
@@ -100,9 +95,10 @@ class JavaToKotlinAction : AnAction() {
}
// Perform user interaction first to avoid interrupting J2K in the middle of conversion and breaking "undo"
val question = KotlinBundle.message("action.j2k.correction.required")
val shouldProcessExternalCode = enableExternalCodeProcessing &&
(!askExternalCodeProcessing ||
Messages.showYesNoDialog(project, getQuestionText(), title, Messages.getQuestionIcon()) == Messages.YES)
Messages.showYesNoDialog(project, question, title, Messages.getQuestionIcon()) == Messages.YES)
var newFiles: List<KtFile> = emptyList()
@@ -151,13 +147,6 @@ class JavaToKotlinAction : AnAction() {
return newFiles
}
@NlsContexts.DialogMessage
private fun getQuestionText(): String {
val prefix = if (isK2Mode()) KotlinBundle.message("action.j2k.k2.warning") + "\n\n" else ""
val question = KotlinBundle.message("action.j2k.correction.required")
return prefix + question
}
private fun prepareExternalCodeUpdate(project: Project, processing: ExternalCodeProcessing?, isEnabled: Boolean): (() -> Unit)? {
if (!isEnabled || processing == null) return null