generated from JetBrains/intellij-platform-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feat] Code Snap Drop-down tab option feature development
- Loading branch information
Showing
2 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
src/main/kotlin/com/github/raoe/codesnapidea/actions/AsciiCodeSnapAction.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters