[pycharm] PY-79243 Debugger: fix the review

(cherry picked from commit 7c4082ba2322e3096d7d6e0557ad78da293bbee3)

GitOrigin-RevId: 4eb63b7b2ecc4f9fc223f3e190fe8ef1e4dd5f58
This commit is contained in:
ekaterina.itsenko
2025-03-01 01:47:55 +01:00
committed by intellij-monorepo-bot
parent 82f1f4558e
commit c19106ab29

View File

@@ -4,7 +4,7 @@ package org.intellij.images.scientific.action
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.fileChooser.FileChooserFactory
import com.intellij.openapi.fileChooser.FileSaverDescriptor
import com.intellij.openapi.project.DumbAwareAction
@@ -14,12 +14,13 @@ import org.intellij.images.scientific.ScientificUtils
import java.io.IOException
import java.nio.file.Files
class SaveImageAction : DumbAwareAction() {
internal class SaveImageAction : DumbAwareAction() {
override fun actionPerformed(e: AnActionEvent) {
val project = e.project
val virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE)
if (virtualFile == null || project == null) {
LOG.error("Missing project or image file.")
logger.error("Missing project or image file.")
return
}
@@ -33,7 +34,7 @@ class SaveImageAction : DumbAwareAction() {
Files.write(wrapper.file.toPath(), virtualFile.contentsToByteArray())
}
catch (e: IOException) {
LOG.warn("Failed to save image", e)
logger.warn("Failed to save image", e)
}
}
@@ -45,8 +46,9 @@ class SaveImageAction : DumbAwareAction() {
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
companion object {
private val LOG = thisLogger()
private const val IMAGE_FORMAT = "png"
private const val IMAGE_DEFAULT_NAME: String = "myimg"
}
}
}
private val logger = Logger.getInstance(SaveImageAction::class.java)