basic_action_system.md: Add information about executing actions programmatically

This commit is contained in:
Karol Lewandowski 2023-11-09 11:17:46 +01:00
parent c182a4da93
commit 8b7c2d7d13
2 changed files with 17 additions and 0 deletions

View File

@ -427,3 +427,13 @@ Use [`BackAction`](%gh-ic%/platform/platform-api/src/com/intellij/ui/navigation/
For actions registered at runtime (e.g., in a tool window toolbar), add an [`<action>`](plugin_configuration_file.md#idea-plugin__actions__action) entry with
[`EmptyAction`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/actionSystem/EmptyAction.java)
to "reserve" Action ID, so they become visible in <ui-path>Settings | Keymap</ui-path>.
## Executing Actions Programmatically
Sometimes, it is required to execute actions programmatically, e.g., executing an action implementing logic we need and the implementation is out of our control.
Executing actions can be achieved with [`ActionUtils.invokeAction()`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/actionSystem/ex/ActionUtil.java).
> Executing actions programmatically should be avoided whenever possible.
> If an action executed programmatically is under your control, extract its logic to a service or util and call it directly.
>
{style="warning"}

View File

@ -12,6 +12,13 @@ See [GitHub Changelog](https://github.com/JetBrains/intellij-sdk-docs/commits/ma
## 2023
### November
{#november-23}
Minor Changes and Additions
:
- Add information about [executing actions programmatically](basic_action_system.md#executing-actions-programmatically).
### October
{#october-23}