User: rednesto Date: 10 Jul 24 14:17 Revision: 71a946e8d6a30449ef4d409921322c3052187813 Summary: Translation: Remove superfluous "Convert to translation" action TeamCity URL: https://ci.mcdev.io/viewModification.html?tab=vcsModificationFiles&modId=9396&personal=false Index: src/main/kotlin/translations/actions/ConvertToTranslationAction.kt =================================================================== --- src/main/kotlin/translations/actions/ConvertToTranslationAction.kt (revision bef547ed8cd90dfc824b1237e452f307c05139f9) +++ src/main/kotlin/translations/actions/ConvertToTranslationAction.kt (revision bef547ed8cd90dfc824b1237e452f307c05139f9) @@ -1,51 +0,0 @@ -/* - * Minecraft Development for IntelliJ - * - * https://mcdev.io/ - * - * Copyright (C) 2024 minecraft-dev - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation, version 3.0 only. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program. If not, see . - */ - -package com.demonwav.mcdev.translations.actions - -import com.demonwav.mcdev.translations.intentions.ConvertToTranslationIntention -import com.intellij.openapi.actionSystem.ActionUpdateThread -import com.intellij.openapi.actionSystem.AnAction -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.LangDataKeys -import com.intellij.openapi.actionSystem.PlatformDataKeys -import com.intellij.psi.PsiLiteral - -class ConvertToTranslationAction : AnAction() { - override fun actionPerformed(e: AnActionEvent) { - val file = e.getData(LangDataKeys.PSI_FILE) ?: return - val editor = e.getData(PlatformDataKeys.EDITOR) ?: return - val element = file.findElementAt(editor.caretModel.offset) ?: return - ConvertToTranslationIntention().invoke(editor.project ?: return, editor, element) - } - - override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT - - override fun update(e: AnActionEvent) { - val file = e.getData(LangDataKeys.PSI_FILE) - val editor = e.getData(PlatformDataKeys.EDITOR) - if (file == null || editor == null) { - e.presentation.isEnabledAndVisible = false - return - } - val element = file.findElementAt(editor.caretModel.offset) - e.presentation.isEnabledAndVisible = (element?.parent as? PsiLiteral)?.value is String - } -} Index: src/main/resources/META-INF/plugin.xml =================================================================== --- src/main/resources/META-INF/plugin.xml (revision bef547ed8cd90dfc824b1237e452f307c05139f9) +++ src/main/resources/META-INF/plugin.xml (revision 71a946e8d6a30449ef4d409921322c3052187813) @@ -1213,11 +1213,6 @@ description="Lookup MCP mapping info on a SRG field or method"> - - -