mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
working_with_custom_actions.md: Cleanup
This commit is contained in:
parent
34e852b738
commit
a5bf79efb0
@ -15,7 +15,7 @@ Using the SDK code sample [`action_basics`](%gh-sdk-samples-master%/action_basic
|
|||||||
Custom actions extend the abstract class [`AnAction`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java).
|
Custom actions extend the abstract class [`AnAction`](%gh-ic%/platform/editor-ui-api/src/com/intellij/openapi/actionSystem/AnAction.java).
|
||||||
Classes that extend it should override `AnAction.update()`, and must override `AnAction.actionPerformed()`.
|
Classes that extend it should override `AnAction.update()`, and must override `AnAction.actionPerformed()`.
|
||||||
* The `update()` method implements the code that enables or disables an action.
|
* The `update()` method implements the code that enables or disables an action.
|
||||||
* The `actionPerformed()` method implements the code that executes when an action is invoked by the user.
|
* The `actionPerformed()` method implements the code that executes when the user invokes an action.
|
||||||
* When targeting IntelliJ Platform 2022.3 or later, `AnAction.getActionUpdateThread()` must be implemented
|
* When targeting IntelliJ Platform 2022.3 or later, `AnAction.getActionUpdateThread()` must be implemented
|
||||||
|
|
||||||
As an example, [`PopupDialogAction`](%gh-sdk-samples-master%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) overrides `AnAction` for the `action_basics` code sample.
|
As an example, [`PopupDialogAction`](%gh-sdk-samples-master%/action_basics/src/main/java/org/intellij/sdk/action/PopupDialogAction.java) overrides `AnAction` for the `action_basics` code sample.
|
||||||
@ -60,7 +60,7 @@ A more comprehensive explanation of action registration is available in the [](b
|
|||||||
|
|
||||||
### Registering an Action with the New Action Form
|
### Registering an Action with the New Action Form
|
||||||
|
|
||||||
To register `PopupDialogAction` and set up its basic attributes press <shortcut>Alt+Shift+Enter</shortcut>.
|
To register `PopupDialogAction` and set up its basic attributes, press <shortcut>Alt+Shift+Enter</shortcut>.
|
||||||
Fill out the <control>New Action</control> form to set up the parameters for `PopupDialogAction`:
|
Fill out the <control>New Action</control> form to set up the parameters for `PopupDialogAction`:
|
||||||
|
|
||||||
{width="800"}
|
{width="800"}
|
||||||
@ -94,10 +94,17 @@ After finishing the <control>New Action</control> form and applying the changes,
|
|||||||
</actions>
|
</actions>
|
||||||
```
|
```
|
||||||
|
|
||||||
The [`<action>`](plugin_configuration_file.md#idea-plugin__actions__action) element declares the <control>Action ID</control> (`id`), <control>Class Name</control> (`class`), <control>Name</control> (`text`), and <control>Description</control> from the <control>New Action</control> form.
|
The [`<action>`](plugin_configuration_file.md#idea-plugin__actions__action) element declares the:
|
||||||
|
- <control>Action ID</control> (`id`)
|
||||||
|
- <control>Class Name</control> (`class`)
|
||||||
|
- <control>Name</control> (`text`)
|
||||||
|
- <control>Description</control>
|
||||||
|
|
||||||
|
from the <control>New Action</control> form.
|
||||||
|
|
||||||
The [`<add-to-group>`](plugin_configuration_file.md#idea-plugin__actions__action__add-to-group) element declares where the action will appear and mirrors the names of entries from the form.
|
The [`<add-to-group>`](plugin_configuration_file.md#idea-plugin__actions__action__add-to-group) element declares where the action will appear and mirrors the names of entries from the form.
|
||||||
|
|
||||||
This declaration is adequate, but adding more attributes is discussed in the next section.
|
This declaration is sufficient, but adding more attributes is discussed in the next section.
|
||||||
|
|
||||||
### Setting Registration Attributes Manually
|
### Setting Registration Attributes Manually
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user