diff --git a/src/main/kotlin/com/github/raoe/codesnapidea/actions/AsciiCodeSnapAction.kt b/src/main/kotlin/com/github/raoe/codesnapidea/actions/AsciiCodeSnapAction.kt new file mode 100644 index 0000000..7df525f --- /dev/null +++ b/src/main/kotlin/com/github/raoe/codesnapidea/actions/AsciiCodeSnapAction.kt @@ -0,0 +1,39 @@ +package com.github.raoe.codesnapidea.actions + +import com.intellij.openapi.actionSystem.AnAction +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.actionSystem.CommonDataKeys +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.project.Project +import com.intellij.openapi.ui.Messages +import javax.swing.Icon + +/** + * ClassName:AsciiCodeSnapAction +Package:com.github.raoe.codesnapidea.actions +@DATE:10/11/2024 4:02 pm +@Author:XuYuanFeng +TODO: ASCII CodeSnap + */ +class AsciiCodeSnapAction: AnAction() { + override fun actionPerformed(event: AnActionEvent) { + val editor: Editor? = event.getData(CommonDataKeys.EDITOR) + val project: Project? = event.getData(CommonDataKeys.PROJECT) + val selectedText: String? = editor?.selectionModel?.selectedText + val message = StringBuilder() + if (!selectedText.isNullOrEmpty()) { + message.append(selectedText).append(" Selected!JPG") + // call the native function + } else { + message.append("No text selected!") + } + val title = "Selection Info" + val icon: Icon = Messages.getInformationIcon() + Messages.showMessageDialog( + project, + message.toString(), + title, + icon + ) + } +} \ No newline at end of file diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 0a4baab..8d2bce5 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -32,9 +32,10 @@ - - - + + + +