# How to add an action button to the upper right corner of the EditorTextField?

**URL:** <https://platform.jetbrains.com/t/how-to-add-an-action-button-to-the-upper-right-corner-of-the-editortextfield/3242>\
**Category:** IntelliJ Platform\
**Tags:** plugin-development\
**Created:** [December 2, 2025, 9:16am UTC](https://platform.jetbrains.com/t/how-to-add-an-action-button-to-the-upper-right-corner-of-the-editortextfield/3242 "2025-12-02T09:16:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hxl49508](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/hxl49508/32/1117_2.png) [@hxl49508](https://platform.jetbrains.com/u/hxl49508)\
**Post date:** [December 2, 2025, 9:16am UTC](https://platform.jetbrains.com/t/how-to-add-an-action-button-to-the-upper-right-corner-of-the-editortextfield/3242/1 "2025-12-02T09:16:41Z")

</div>

How to add an action button to the upper right corner of the EditorTextField?

 ![image](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/a/aca37746b8de27e18b3bdb42ffcb3796b0612872.png)

---

<div class="post-metadata">

**Author:** ![robert.novotny](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/robert.novotny/32/2046_2.png) [@robert.novotny](https://platform.jetbrains.com/u/robert.novotny)\
**Post date:** [December 2, 2025, 11:03am UTC](https://platform.jetbrains.com/t/how-to-add-an-action-button-to-the-upper-right-corner-of-the-editortextfield/3242/2 "2025-12-02T11:03:44Z")

</div>

Hello,  
I see no way how to do that properly. That particular widget is — to quote the [docs](https://github.com/JetBrains/intellij-community/blob/d20c6d528f98b758d165512a082b72e05a2e737b/plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/DecompilerInEditorListener.kt#L37) — a hack.

The alternative, contributing to the Inspection Widget, is an internal API in the `com.intellij.openapi.editor.ex.EditorMarkupModel#addInspectionWidgetAction`.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/2/2263ac202124059c575310db4f24482fa665e994.png)

In the future, you can use the [UI Inspector](https://plugins.jetbrains.com/docs/intellij/internal-ui-inspector.html) to investigate the source of this “Gear” UI element. Use Ctrl-Alt and click (Control+Option and Click on macOS) on that element. The UI inspector will show up. It will lead you to the `DecompilerInEditorListener` in the Community sources. There, you can discover additional comments and documentation.

---

<div class="post-metadata">

**Author:** ![hxl49508](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/hxl49508/32/1117_2.png) [@hxl49508](https://platform.jetbrains.com/u/hxl49508)\
**Post date:** [December 2, 2025, 11:59am UTC](https://platform.jetbrains.com/t/how-to-add-an-action-button-to-the-upper-right-corner-of-the-editortextfield/3242/3 "2025-12-02T11:59:45Z")

</div>

This method is marked for internal use. Is it safe for me to use it?

 ![image](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/4/49094cbb2c20f418126afa6acebe2a3542179f3d.png)

---

<div class="post-metadata">

**Author:** ![abrooksv](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/abrooksv/32/924_2.png) [@abrooksv](https://platform.jetbrains.com/u/abrooksv)\
**Post date:** [December 2, 2025, 5:03pm UTC](https://platform.jetbrains.com/t/how-to-add-an-action-button-to-the-upper-right-corner-of-the-editortextfield/3242/4 "2025-12-02T17:03:22Z")

</div>

The hard to find EP `com.intellij.iw.actionProvider` should be able to do it and not use any internal API

Interface: [intellij-community/platform/platform-api/src/com/intellij/openapi/editor/markup/InspectionWidgetActionProvider.kt at 56606a9ddbcf9c78723553f95683e01055aaae26 · JetBrains/intellij-community · GitHub](https://github.com/JetBrains/intellij-community/blob/56606a9ddbcf9c78723553f95683e01055aaae26/platform/platform-api/src/com/intellij/openapi/editor/markup/InspectionWidgetActionProvider.kt#L9)

---

<div class="post-metadata">

**Author:** ![robert.novotny](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/robert.novotny/32/2046_2.png) [@robert.novotny](https://platform.jetbrains.com/u/robert.novotny)\
**Post date:** [December 3, 2025, 10:48am UTC](https://platform.jetbrains.com/t/how-to-add-an-action-button-to-the-upper-right-corner-of-the-editortextfield/3242/5 "2025-12-03T10:48:53Z")

</div>

`@ApiStatus.Internal` are not to be used by 3rd party plugins. IntelliJ Plugin Verifier and JetBrains Marketplace will report such usages.

However, @abrooksv has a great point. The suggested API is not `@ApiStatus.Internal`. And on top, it is indeed quite hidden, the only implementation is in the _Reader Mode_.

 ![CleanShot 2025-12-03 at 11.35.17@2x](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/4/4f3c40ba13b2955430d742eb6ca0b21ba263be2b.png)

To contribute to the Inspection Widget, declare the `com.intellij.iw.actionProvider`:

```xml
<extensions defaultExtensionNs="com.intellij">
    <iw.actionProvider 
            implementation="com.portablesimula.MyInspectionWidgetActionProvider" />
</extensions>

```

Then, an implementation of `com.intellij.openapi.editor.markup.InspectionWidgetActionProvider` that provides `AnAction`

```kotlin
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.markup.InspectionWidgetActionProvider

class MyInspectionWidgetActionProvider : InspectionWidgetActionProvider {
    override fun createAction(editor: Editor): AnAction? {
        return ActionManager.getInstance().getAction("com.example.MyAction")
    }
}

```

Additional notes:

- `null` means that no action will be shown. Useful for cases when the editor does not support a particular action.
- `ActionGroup` elements will be flattened. For example, the built-in `ReaderModeActionProvider` provides a two-element action group: an action and a separator.

 ![image](https://us1.discourse-cdn.com/flex001/uploads/jetbrains_platform/original/2X/5/5a01e46f183ee1930c5299fc6e86a3a9cd90df05.png)
