From 08b6da9919e24ef120541c4bcb202a4c652bcc46 Mon Sep 17 00:00:00 2001 From: Karol Lewandowski Date: Mon, 8 Apr 2024 12:36:23 +0200 Subject: [PATCH] grouping_action.md: Add code formatting to titles --- topics/tutorials/action_system/grouping_action.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/topics/tutorials/action_system/grouping_action.md b/topics/tutorials/action_system/grouping_action.md index f979cf9e3..5f2c968cb 100644 --- a/topics/tutorials/action_system/grouping_action.md +++ b/topics/tutorials/action_system/grouping_action.md @@ -1,9 +1,9 @@ - - -Organizing actions in custom groups and attaching them to the existing ones. + # Grouping Actions +Organizing actions in custom groups and attaching them to the existing ones. + If an implementation requires several actions, or there are simply too many actions that overload the menu, the actions can be placed into groups. This tutorial demonstrates adding an action to an existing group, creating a new action group, and action groups with a variable number of actions. The sample code discussed in this tutorial is from the code sample [`action_basics`](%gh-sdk-samples%/action_basics). @@ -99,7 +99,7 @@ The steps below show how to make a group of actions available and visible if cer In this case, the condition is having an instance of available editor. This condition is needed because the custom action group is added to an IntelliJ menu that is only enabled for editing. -### Extending DefaultActionGroup +### Extending `DefaultActionGroup` The [`DefaultActionGroup`](%gh-ic%/platform/platform-api/src/com/intellij/openapi/actionSystem/DefaultActionGroup.java) is an implementation of [`ActionGroup`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/ActionGroup.java). The `DefaultActionGroup` class is used to add child actions and separators between them to a group. @@ -177,6 +177,7 @@ group.org.intellij.sdk.action.CustomDefaultActionGroup.description=Custom defaul ``` ### Providing Specific Behavior for the Custom Group + Override the `CustomDefaultActionGroup.update()` method to make the group visible only if there's an instance of the editor available. Also, a custom icon is added to demonstrate that group icons can be changed depending on the action context: