From 87f73f1ce633032c2913b4dbcc69942b80f3c403 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Tue, 10 Dec 2024 09:30:28 +0100 Subject: [PATCH] Move some action content to plugin_configuration_file.md and reduce content duplication --- topics/basics/basic_action_system.md | 47 ++----------------- .../plugin_configuration_file.md | 25 +++++++--- .../working_with_custom_actions.md | 4 +- 3 files changed, 25 insertions(+), 51 deletions(-) diff --git a/topics/basics/basic_action_system.md b/topics/basics/basic_action_system.md index fd3f21f66..8a5bbfdb5 100644 --- a/topics/basics/basic_action_system.md +++ b/topics/basics/basic_action_system.md @@ -190,50 +190,11 @@ See the [](grouping_action.md) tutorial for examples of creating action groups. ## Registering Actions -There are two main ways to register an action: either by listing it in the [``](plugin_configuration_file.md#idea-plugin__actions) section of a plugin's [plugin.xml](plugin_configuration_file.md) file or through code. +There are two main ways to register an action: either by [registering it in the plugin.xml file](#registering-actions-in-pluginxml) or [through code](#registering-actions-from-code). ### Registering Actions in plugin.xml -Registering actions in plugin.xml is demonstrated in the following reference examples, which document all elements and attributes used in the [``](plugin_configuration_file.md#idea-plugin__actions) section and describe each element's meaning. - -#### Setting the `override-text` Element - - -An alternate version of an action's menu text can be declared for use depending on where an action appears. -Using the [``](plugin_configuration_file.md#idea-plugin__actions__action__override-text) element, the menu text for an action can be different depending on context: menu location, toolbar, and other. -This is also available for groups in 2020.3 and later. - -In the `` element [reference example](#action-declaration-reference) with `id` attribute `VssIntegration.GarbageCollection`, the default is to use the menu text "Garbage Collector: Collect _Garbage." -The `` element declares the action is added to the Tools menu. - -However, the `` element declares that text for `VssIntegration.GarbageCollection` displayed anywhere in the main menu system should be the alternate text "Collect _Garbage." -The Tools menu is part of the main menu, so the displayed menu text is "Collect _Garbage." -A different context, such as searching for the action using Help | Find Action, displays the default text "Garbage Collector: Collect _Garbage" to give the user additional information about the action. - -A second `` element uses `place` and `use-text-of-place` attributes to declare the same version of the text used in the main menu is also used in the editor popup menu. -Additional `` elements could be used to specify other places where the main menu text should be used. - -An example of using `` is demonstrated in the [Creating Actions](working_with_custom_actions.md#using-override-text-for-an-action) tutorial. - -#### Setting the `synonym` Element - -_2020.3_
-Users can locate actions via their name by invoking Help | Find Action. - -To allow using alternative names in search, add one or more [``](plugin_configuration_file.md#idea-plugin__actions__action__synonym) elements inside [``](plugin_configuration_file.md#idea-plugin__actions__action) or [``](plugin_configuration_file.md#idea-plugin__actions__group__reference): - -```xml - - - -``` - -To provide a localized synonym, specify `key` instead of the `text` attribute. - -#### Disabling Search for Group - - -To exclude a group from appearing in Help | Find Action results (for example, New... popup), specify `searchable="false"`. +Registering actions in [plugin.xml](plugin_configuration_file.md) is demonstrated in the following reference examples, which document all elements and attributes used in the [``](plugin_configuration_file.md#idea-plugin__actions) section and describe each element's meaning. #### Localizing Actions and Groups @@ -390,7 +351,9 @@ This and additional information can also be found by using the [Code Completion] It can also have an child element. --> - + + + + + + ``` - Overridden text reused from the `MainMenu` place: ```xml @@ -1032,7 +1045,7 @@ Required Attributes : - `key` _(`key` or `text` is **required**)_
- The key of the synonym text provided in a message bundle. + The key of the synonym text provided in a [message bundle](basic_action_system.md#localizing-actions-and-groups). - `text` _(`key` or `text` is **required**)_
The synonym text. @@ -1224,7 +1237,7 @@ Attributes Separator text is displayed only in specific contexts such as popup menus, toolbars, etc. - `key` _(optional)_
- The message key for the separator text. + The [message key]([message key](https://plugins.jetbrains.com/docs/intellij/basic-action-system.html#localizing-actions-and-groups)) for the separator text. The message bundle for use should be registered via the `resource-bundle` attribute of the [``](#idea-plugin__actions) element. The attribute is ignored if the `text` attribute is specified. diff --git a/topics/tutorials/action_system/working_with_custom_actions.md b/topics/tutorials/action_system/working_with_custom_actions.md index 3f3fad6f4..129ad9e87 100644 --- a/topics/tutorials/action_system/working_with_custom_actions.md +++ b/topics/tutorials/action_system/working_with_custom_actions.md @@ -139,10 +139,8 @@ The full declaration is: #### Using `override-text` for an Action -By using the `override-text` element, the action text can be different depending on the context of where the action appears: menu, toolbar, etc. -The example above uses this element to ensure the shorter text "Popup Dialog Action" is shown anywhere the action appears in the main menu structure. +The example above uses the [`override-text`](plugin_configuration_file.md#idea-plugin__actions__action__override-text) element to ensure the shorter text "Popup Dialog Action" is shown anywhere the action appears in the main menu structure. Otherwise, the default, more explanatory text "Action Basics Plugin: Popup Dialog Action" is shown. -For more information, see [](basic_action_system.md#setting-the-override-text-element). > Use inspection Settings | Editor | Inspections | Plugin DevKit | Code | Component/Action not registered for reporting unregistered actions.